-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
Load/save from/to Github Repo #155
Comments
I'm going to be working on this over the next week. |
Ok so I'm still working on this, there were a few other things that needed doing first. So a quick update as to where this is at. The working branch is here orangemug/editor@fix/update-deps...orangemug:feature/github-v2 It's basically hacked together in order to prove out the concept, it seems to work great. Here's what works (try to ignore the global variables 😱)
These commits were made through the Maputnik UI using that process https://github.com/orangemug-test/style-test/commits/master On my local machine this is all running inside docker containers via https://github.com/orangemug/maputnik-services including the GitHub authentication via micro-github (see https://github.com/orangemug/maputnik-services/blob/master/docker-compose.yml#L27-L43). I've also started on a flags section it's basically Next up, find a place to host micro-github, I'm currently thinking https://zeit.co/pricing but if anyone has any better ideas feel free to share. As always any feedback is welcome. |
Sounds great. Couple of quick comments:
|
@stevage thanks for the feedback. Basically my aim initially is to to get the core working so we can iterate. I'll have a think about the above comments and get back to you. Any UI suggestions are also welcome. |
It's more complicated than I anticipated. :) I'll try to take a look at it tomorrow. |
OK, today I end on:
I'll get back to it tomorrow. |
Hey @gregorywolanski I wouldn't bother testing this yet, as it's still a work in progress. |
Hi @orangemug we would like to add this save/load via github thing . Do you thing starting with your branch orangemug/editor@fix/update-deps...orangemug:feature/github-v2 is a good starting point ? do you have hints to provide before I start? |
Hey @oterral glad for the help. So there is a reason why this hasn't been worked on in a while (sorry for that). I've been fixing other parts of the codebase for a new UI to make GitHub integration make sense. See #252 https://281-84182601-gh.circle-artifacts.com/0/tmp/circle-artifacts.YPaobNs/build/index.html#0.36/0/0 basically we also need somewhere to store git history in context to the UI and also context for what repository is open. I think that UI gives us those abilities. There are also a few other decisions (features) in that branch
Lets create a plan of action and then we can divide up into smaller tickets, I'm happy to help out. So things to do
I'm pretty busy for the next couple of days but will try to find the time to respond. |
I have 2 weeks full time to work on this. What we want is: We could potentially add multiple repositories. Maybe all the github stuff could be another Icon in the left menu. If we do it correctly, any users could add in the same way different kind of repository , github is not only one. Click on it, opens a first panel with the login page for github if not logged in or the list of repositories added if already logged in. Click on repository, opens the 2nd panel wich allows to browse the current repository Then when you find your style click it to load in the map. Your thoughts? |
Just a couple of comments from the sidelines:
|
Yes It's important I think. we could also have a new button in the left menu which opens a first panel, with buttons "login with github", "login with gitlab" and others.
Yes we want that too. But it's more something for the export menu, I guess. I need to think about it. |
So I have some thoughts. Basically my motivations here getting the right solution and not wasting anybodies time (with regards to development). Maputnik doesn't currently have a server and I'd personally like to keep it that way. In this ticket I'm currently using https://github.com/mxstbr/micro-github via https://github.com/orangemug/maputnik-services which means Maputnik just talks to an auth server. micro-github however is not very secure as far as I can tell. It sends back the auth token in the querystring, which means it will stay about in the browser history (can somebody confirm this). I'd also be nervous about adding this into master unless we can get some other security concerns addressed. We basically have the same access as It's also worth noting that we could approach this a different way. @lukasmartinelli added filesystem access to the editor via maputnik/desktop we could extend filesystem access to add git support. This would also require less development because we'd instantly be supporting all git services. The downside is that we'd be moving towards a 'download' model for the editor. Let me know your thoughts? |
If I understand correctly, instead of using micro-github we could use an auth0 server or whatever auth server, am I right? |
I had a look to maputnink-services with micro-github. It sends backs the access_token in the querystring and it stays in the history, but it's only temporary token. I don't think it's a hudge problem if you 'r using https. We could try to pass it as POST request or in the header instead of the query string. Otherwise your branch works well. I can load/save without problem in github. |
First off @oterral thank you for looking at this issue. Sorry it's taken me some time to get back to you I've been super busy with the day job. I am however going to suggest we hold off on this issue for the time being. The reason being that I think we have some other serious usability issues to resolve. So currently styling for one of the major sources is easy just pick openmaptiles from the data sources and away you go. Styling one of your own sources is somewhat more difficult this is due to the ugliness that is
Right now that's really a lot more difficult than it should be. The steps are basically upload GeoJSON to a server that supports HTTPS and CORs, which is not an ideal experience. Mostly I run Maputnik locally, because it's always running for development of the code base. Which means I'm not experiencing these issues. Possible solutions to this problem are as follows
Here's the catch for the branch in this ticket.
I know some people will be disappointed. I am too, I really want Git support in Maputnik but it seems the right thing to hold off until the we have the other issues resolved. |
Currently https://github.com/mapbox/geojson.io is being built again (:tada:): https://github.com/tmcw/geojson.net Maybe it's worth to take a look how geojson.net is going to implement GitHub integration, there is also micro-github involved: tmcw/geojson.net#8 Also geojson.net is using |
I understand all your concerns @orangemug but I don't think using maputnik as desktop software is an option for us (internal security issues. Thx for the link @pathmapper indeed what geojson.io/net does is exactly what I need. I will have a look. |
geojson.io uses https://github.com/prose/gatekeeper instead of micro-github. The big diffference I see is GateKeeper is only used to get the access_token safely. The SPA directly requests the authorize code and uses GateKeeper only to get the access_token which it receives back in the response. No redirect url with access_token in querystring. |
Ithnik maputnik should do the same and asks the github token directly. |
@oterral yeah gatekeeper uses the correct approach. Temp token with the real token returned in the response 👍
Yeah sorry @pathmapper I probably wasn't clear here. So the issue isn't loading styles but loading sources. Any sources served over So basically if you have a data source at I think it's a pretty common use case to have local data and services from other applications either locally ( |
@oterral if you could drop a comment in #164 as to what you using Maputnik for, that'd be much appreciated. |
I have finally a working version with github (browsing all the repos) and gatekeeper base on @orangemug work. See here: https://github.com/oterral/maputnik-service To make it work you need to put the app oauth client id in the editor too: https://github.com/oterral/editor/blob/5f91018cce2ba886d072ba2d364ddefe1b30f7e5/src/components/modals/GitHubSection.jsx#L17 |
@oterral congrats on getting it working! I'm a bit busy for the next couple of days but will find time to take a proper look at the weekend. Note: Also I think #164 (comment) has convinced me we should just add this to Maputnik |
This issue appears in the answers to question “What annoys you about Maputnik?” in the survey (original spelling):
|
This was tracked in #3, which was partially implemented with Gist support, but no repo saving/loading yet.
The text was updated successfully, but these errors were encountered: