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

Is it possible to push to a github repo? #72

Open
iliakan opened this issue Mar 7, 2023 · 2 comments
Open

Is it possible to push to a github repo? #72

iliakan opened this issue Mar 7, 2023 · 2 comments

Comments

@iliakan
Copy link

iliakan commented Mar 7, 2023

Let's say we cloned a (public) github repository.

Is there a way to push there?

The only problem I see is credentials (reading can be public, writing - cannot). Any other issues?

For credentials, let's say, we're using our proxy (we have to do so anyway due to same-origin policy).
Maybe we can use a Github App to get permissions for a repo, and then add these credentials to push requests (basically add auth tokens to requests)?

@nikitavoloboev
Copy link

You can check this github proxy, it authorises the requests and lets you git push too. I assume something similar would work with wasm-git too.

@petersalomonsen
Copy link
Owner

You can also alter the XMLHttpRequest.prototype.open in the worker to set the request header with bearer token or basic auth. This is how I do it in WebAssembly Music:

XMLHttpRequest.prototype._open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (method, url, async, user, password) {
  this._open(method, url, async, user, password);
  this.setRequestHeader('Authorization', `Bearer ${accessToken}`);
  lastHttpRequest = this;
}

https://github.com/petersalomonsen/javascriptmusic/blob/master/wasmaudioworklet/wasmgit/wasmgitworker.js#L31

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

No branches or pull requests

3 participants