sfreytag / simonlikesmaps

Project management for https://www.simonlikesmaps.com
0 stars 0 forks source link

Add browser polyfill for crypto.randomUUID #53

Closed tasker25 closed 7 months ago

tasker25 commented 7 months ago

Original

In the old version, I logged in using my google account without providing an email which was the original method to login. In the new version, even though I provide the gmail address associated with my google account, it cannot find my previous routes.

Diagnosis

See discussion below. The browser did not support crypto.randomUUID so a polyfill is needed - eg https://www.npmjs.com/package/crypto-randomuuid?activeTab=readme

sfreytag commented 7 months ago

Thanks for raising this, I had a look just now and there was a bug with gmail addresses. The old SLM is integrated into Google App Engine which means gmail addresses are handled without the @gmail.com and just using the first part. This requires splitting them up before querying the DB and that bit was not quite right. Now fixed, and available to try on https://new.simonlikesmaps.com

In the old database I can see you have 2 gmail accounts. Your main one has 245 routes and the other one has 3 - this is under the same email address but the a 2 before the @gmail.com

Hope you find the new version preferable. Any thoughts / feedback would be welcome, either here or you can now email robot@simonlikesmaps.com

GPX files are next up in #50 and I will look at your feedback in #49 at the same time.

tasker25 commented 7 months ago

I can now see the names of all my old routes in the new version. Unfortunately when In try to import them, there is an error in every case.

I had not realised I had three routes stored under an alternative gmail address - that was an accident. I must have been logged in at the time to that alternative account and not realised when I used that to log in to SLM. I will transfer them to my main account.

Not really had time to try the new version yet.

sfreytag commented 7 months ago

I can see your request to the old server for the route list and also all the individual lists. I can't see any errors on the new server. Hopefully therefore there might be an error message in your browser. Do you know how to open the developer tools and look in the JavaSscript console? For each route that is marked with an error there should be a corresponding error in the console. If you could paste one of those here that might provide some insight.

I can migrate your routes successfully on my test environment. I created a simonlikesmapstest@gmail account to test with @gmail.com addresses and that worked ok. And a few people other than just me have migrated their routes, so I am optimistic this is fixable.

tasker25 commented 7 months ago

The problem appears to be that I was using an older standalone version of Firefox. There was a TypeError message on every line of which this is an example: Object { key: "ahFlfnNpbW9ubGlrZXNtYXBzMnISCxIFUm91dGUYgICAvOG3mwsM", user_id: "105474194604793571139", name: "Hart Crag variant", tags: [], blob_key: "", colour: "#d70bfa", default_map: "OS Maps", epsg4326_coords: (15) […], waypoints: null, default_access: "VIEW", … } SyncView-fe77122a.js:1:4586 TypeError: crypto.randomUUID is not a function migrate https://new.simonlikesmaps.com/assets/SyncView-fe77122a.js:1 V https://new.simonlikesmaps.com/assets/SyncView-fe77122a.js:1 F https://new.simonlikesmaps.com/assets/SyncView-fe77122a.js:1 When I used the latest version of Firefox it imported successfully and I can now revert to my standalone version.

sfreytag commented 7 months ago

Thanks! That is useful information - I have perhaps been too keen to adopt crypto.randomUUID without checking its browser support.

sfreytag commented 7 months ago

I've pushed up a fix for this so hopefully it will now work in your older Firefox. This might be useful because if you add or change routes in the old SLM you can re-run the sync to copy the new details into the new SLM - it will update the existing plan rather than creating a new, duplicate one.

tasker25 commented 7 months ago

I confirm I can now import routes when using my older version of Firefox and that updating routes that have been changed in the old version of SLM also works. Also very pleased I can now modify uploaded gps tracks including inserting additional points which was something I had raised re the old version when the gpx file contained speed/time tags. One annoyance is that routes imported from the old SLM are all changed to the standard red colour, even if they had been changed to a different colour in the old version.

I like being able to scroll down the list of plans without having to go page by page as in the old version. However, I don't like all routes/plans beginning with lower case coming after those beginning with uppercase. In the old version, case did not matter for alphabetical listing. As a possible future enhancement, it would be useful to have an option to order the list of plans/routes by date uploaded rather than just alphabetical.

All in all, I think the new version is a definite improvement on a very useful website/app. I find the overlay of OSM paths very valuable (I know that was in the old version). I hope you will be able to continue to use Bing Maps without charging - I suspect too many lookups might hit some limit.

sfreytag commented 7 months ago

Thanks for those thoughts!

colours - now fixed, if you re-run the migration it should pick them up. It was UK vs US spelling error - the old DB uses colour and the new one color and I did not map one to the other correctly.

name sorting - now fixed. That was an interesting one, it was fine on my laptop that I use for development but not on the server. The underlying database collation was different even though it is nominally PostgreSQL in both cases.

date sorting - I've opened that as a new issue - #54

usage limits - yes, this is a bit of a concern if SLM ever becomes very popular. I've never promoted it, it just acquired new users organically, probably via the link sharing mechanism and word of mouth. I don't think I want to promote it - I mostly work on it for enjoyment, because it helps me keep up to date with new tech for the day job, and because it still does a few useful things that other mapping tools don't (as you say, topo map + OSM overlay + satellite spy). It is then a nice bonus that other people find it useful too. Did WalkHighlands run into this issue years ago? They had a limited number of OS tiles available each day and eventually they stopped serving those in favour of their own hybrid map (which is where the idea of OSM data overlaid on a contour map came from). If I ever did run into similar problems then one idea I had was to keep the website free and have a paid-for mobile app that might cover any running costs. But then there's an entire discussion to be had about what a mobile app might do. I am now using OutdoorActive and OSMAnd on my phone, which have excellent offline capability that would be hard to replicate. My approach is to use SLM on the web to generate a GPX which then goes into one of those apps to use outside. However, a mobile app of just the current web site would still be quite nice, because you'd gain more screen space (by removing the browser toolbars) and it would load faster with the app code being already downloaded in the app.

sfreytag commented 7 months ago

Will close this - I think all loose ends are fixed or transferred to new issues. Let me know if not.