Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add client generator #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bryangerlach
Copy link

This generator will default to using my hosted generator to create the custom clients. This requires no extra setup for the end users. However, I have included instructions in 'generator_setup.md' for setting it up to use your own github account.

One thing I could do would be to include the github actions on the infiniteremote repository. This would allow users to fork infiniteremote/rustdesk-api-server to setup their generator instead of forking bryangerlach/rdgen. Let me know if you prefer this and I will add the github action scripts to this PR.

@gitondezhuts
Copy link

hello! yes probably best they fork this repo, but Im thinking the install script installs from this repo so would there be a way to connect it to a users github for github actions via the web gui? that way itll work for everyone?

@bryangerlach
Copy link
Author

If the actions are added to this repo (infiniteremote/rustdesk-api-server) then users would need to have a fork of that repo and setup a github action token for running the actions. I'm not sure I understand your question. I don't think there would be a way to have the installer automatically set up their github account for them.

I imagine most people will want to setup their generator with their own github account, and it is fairly easy to do. However, those that do not want to set this up will still be able to use the generator through my github account.

@gitondezhuts
Copy link

yeah I was wondering about a settings page on the web interface and control the github actions from there, something like below (chatgpt I think explains it better than I can)

  1. Set Up GitHub API Access:
    Generate a GitHub personal access token with permissions for your repository’s actions.
    Store this token securely in Django, ideally using Django’s settings file or environment variables.
  2. Create a page in Django to Trigger Actions:
    Use Django's view functions to set up endpoints that trigger actions. This endpoint would make requests to GitHub’s API to start workflows, passing any required parameters.
    GitHub's API lets you start workflows by making a POST request to https://api.github.com/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches.
  3. Define Parameters and Interactions in Django Forms:
    Create Django forms to collect information needed to trigger specific workflows (e.g., branch, tag, or custom parameters).
    Connect the form to your view so that users can interact with it to start the workflow.
  4. Track Workflow Status in Django:
    To monitor the status of a workflow, use Django’s task scheduler (e.g., Celery) to poll GitHub’s API for updates.
    You can store status updates in a model and display the current status on your frontend.
  5. Secure and Control Access:
    Implement user access controls so that only authorized users can trigger workflows or view their statuses.

@bryangerlach
Copy link
Author

Yeah, number 1,2, and 3 are how it already works. The github username and token are setup in Django's settings file by getting the corresponding environment variables. For number 4, that would definitely be nice to have, but is likely complicated to implement and would likely need to be in another PR entirely. And number 5, the web GUI already has login so only authorized users can trigger the workflows.

Currently the github action status is stored in a database, so the status is easily accessible. The installers.hmtl page would just need to be adjusted to poll the database and automatically upload the status for the generated files. Maybe have a spinning progress wheel or something where the download link would be.

@gitondezhuts
Copy link

Ok cool, so just thinking then if that was through the web rather than in Djangos settings file it would be more user friendly.

So the flow would kinda be

  1. install infinite remote
  2. go to generator page which tells you to fork the repo
  3. fork repo,
  4. enter github username and password on page in step 2 and then can generate agents

If thats how it works sorry, I just havent been able to test it yet

thank you so much for your work on this

@bryangerlach
Copy link
Author

Ok, so then we would likely need to store the github username and token in the user database table.

The current "as is" flow is like this:

  1. install infinite remote
  2. go to the generator page, generate your agents
  3. done
    OR if you want to use your own github actions
  4. install infinite remote
  5. fork infiniteremote/rustdesk-api-server
  6. login to github and setup access token (this is required as username and password won't work)
  7. set environment variables for GHUSER and GHBEARER (these are username and token)
  8. go to the generator page, generate your agents using your own github account

So after installing infinite remote, the generator is already available without any other actions. It just uses my github account. The only way to make setting up to use your own github account easier would be to allow entering the user and token from the web GUI on the generator page. I think I can do this fairly easily, but I likely won't have time to work on this until next week most likely.

@gitondezhuts
Copy link

gitondezhuts commented Nov 14, 2024

Ok, that makes sense to me, I dont think we need to be in a rush to release this feature but I do think its a game changer for a true opensource alternative to anydesk and teamviewer.

Being able to add their own code signing etc will make it easier for people so think we should have that as an option to add that, if you dont mind?

Also up to you if it uses your account or our account, I dont mind either way, I see this as a community project and one to continue some of the great groundwork from rustdesk before they got too greedy

@bryangerlach
Copy link
Author

Yeah, the windows code signing can be set with environment variables, but I can change that over to setting in in the web GUI like the github user and token.

I wonder if there is a way to use infinite remote github and token without exposing the token in the source code.

@gitondezhuts
Copy link

sorry been thinking about this, could make a separate repo for this to keep it away from everything else then exposing tokens etc wouldnt be so bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants