Re: [openstreetmap/openstreetmap-website] Allow getting a GPX in the browser outside openstreetmap.org (Issue #5639)

2025-02-10 Thread Harel M via rails-dev
Here's an example of a call to get the data of one of my traces:
Running the following code in the browser console when surfing to 
https://israelhiking.osm.org.il/:
```js
fetch("https://api.openstreetmap.org/api/0.6/gpx/4192873/data";).then(r => 
r.text()).then(console.log)
```

![Image](https://github.com/user-attachments/assets/6e1f4a01-2bca-4b80-b83e-8556f3110a33)

Which is expected, as this trace is not "fully public", and thus requires 
authentication.
When adding the OAath2 token as a header I get this:
```js
fetch("https://api.openstreetmap.org/api/0.6/gpx/4192873/data";, { method: 
"GET", headers: {Authorization: "Bearer my-token-reducted"}}).then(r => 
r.text()).then(console.log)
```
I get the following error:

![Image](https://github.com/user-attachments/assets/63feb184-ae74-4b0f-9ae6-dbc2f2a94f53)

While there might not be a need to send preflight request, the browser does 
this anyway and thus prevents from getting the data right from the browser.
Is it possible to add CORS support for the relevant endpoint?
Am I doing something wrong?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5639#issuecomment-2647253954
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Allow getting a GPX in the browser outside openstreetmap.org (Issue #5639)

2025-02-10 Thread Harel M via rails-dev
Thanks for looking into this and for the super quick response as usual!
If there's more information I can provide or otherwise help, do let me know.
Relaxing the CORS sounds like the right direction.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5639#issuecomment-2647399354
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


[openstreetmap/openstreetmap-website] Add support for json response for `/api/0.6/user/gpx_files` endpoint (Issue #5646)

2025-02-10 Thread Harel M via rails-dev
### Problem

Client side javascript parsing for xml isn't great (although possible).


### Description

It would be great to have json support for the `/api/0.6/user/gpx_files` 
endpoint like other supported json responses.

### Screenshots

N/A.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5646
You are receiving this because you are subscribed to this thread.

Message ID: ___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] OAuth2 login flow returns error 500 (Issue #5400)

2024-12-16 Thread Harel M via rails-dev
Thanks for the link @HolgerJeromin! I thought that the fact that I can see the 
openstreetmap.org site means the failure was resolved, but I now learned that 
it's in read-only mode.
I'll wait patiently for the resolution.
Thanks for all the hard work around OSM, it is very much appreciated! Keep it 
up.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5400#issuecomment-2545810987
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


[openstreetmap/openstreetmap-website] OAuth2 login flow returns error 500 (Issue #5400)

2024-12-15 Thread Harel M via rails-dev
### URL

Https://israelhiking.osm.org.il

### How to reproduce the issue?

This is a standard login flow from a third party app:
1. Go to israelhiking.osm.org.il
2. Click the sad face after the intro screen to login
3. Enter osm credentials where needed
4. Approve the scope
5. See the error

### Screenshot(s) or anything else?

![Screenshot_20241216_081736_Chrome](https://github.com/user-attachments/assets/c88abbb2-3a2e-4100-b090-30e9eac3e9d1)

I think this is relatively new, maybe after the outage yesterday, but it might 
existed even before.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5400
You are receiving this because you are subscribed to this thread.

Message ID: ___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


[openstreetmap/openstreetmap-website] Allow getting a GPX in the browser outside openstreetmap.org (Issue #5639)

2025-02-09 Thread Harel M via rails-dev
### Problem

My site (and app) are uploading the recording to OSM by default to enrich OSM 
with the data people are collecting.
I would like to avoid the need to go through my backend to fetch a GPX file 
(private one).
Currently the api returns a 302 redirect, which can't be handled by the browser 
since there's an authentication header needed in order to get the route (OAuth 
2).


### Description

I would like to get the GPX trace in the browser outside openstreetmap.org 
using the OSM api endpoint to allow seeing it, editing it if needed and share 
it with other people outside the OSM website.

The API exists, but since there's a redirect there, it's impossible to fetch it 
in the browser without going through a proxy...



### Screenshots

![Image](https://github.com/user-attachments/assets/afd5c75a-f443-4d46-99ee-143e7e5b2fbd)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5639
You are receiving this because you are subscribed to this thread.

Message ID: ___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Added JSON response format support for /api/0.6/user/gpx_files endpoint (PR #5779)

2025-04-18 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5779)

Is there a way I can push this forward? I'd like to use this feature, so I'll 
be happy to help out.
I don't mind opening a new PR with the same changes if that's what's needed (to 
solve the merge commits), but I'm not sure I understand the comment @tomhughes 
wrote:
>I don't think we can really add this without also doing the non-user scoped 
>version



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5779#issuecomment-2812744486
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Added JSON response format support for /api/0.6/user/gpx_files endpoint (PR #5779)

2025-04-17 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5779)

Ahh, interesting, was not aware of this endpoint...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5779#issuecomment-2813792066
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

Thanks for the review, I'll look into addressing the issues.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2822085243
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

65a6aae9788062d3987f8747b6c792584e002824  Update 
app/controllers/api/traces_controller.rb

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/7c055537b93648ad89a41892e5a6ff2fdb48cf1d..65a6aae9788062d3987f8747b6c792584e002824
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

6b78ddd4d4a3509065a0df20561d12a2940d44c4  Add format to test where it was 
missing

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/b8da5fcb1bc8164007dcc97db30204f25bf903ff..6b78ddd4d4a3509065a0df20561d12a2940d44c4
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

Ah, I wasn't expecting this file to contain this information, cool, thanks, 
looks like this is what I was looking for.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2822528484
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

Thanks for the info regarding the `before_action`. I'll see how I can improve 
the git history once everything is passing.
BTW, why not simply use squash merge?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2822531786
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

Sure, I'll try and squash everything to a single commit, hopefully easier...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2822539298
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

b6d5339f7e7df11ecb0845f8fd036d45ba8b719e  Add missing request formats definition

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/6b78ddd4d4a3509065a0df20561d12a2940d44c4..b6d5339f7e7df11ecb0845f8fd036d45ba8b719e
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

b8da5fcb1bc8164007dcc97db30204f25bf903ff  Added routing and json tests

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/42e841c31dc9b006b0fe1a6ba7eaa4413b9da5f3..b8da5fcb1bc8164007dcc97db30204f25bf903ff
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

Ok. Everything should be in a single commit now.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2822572244
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

e4709176c2ec0ff8100f1c039ffb35f1a7b68533  Fix rubocop errors

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/65a6aae9788062d3987f8747b6c792584e002824..e4709176c2ec0ff8100f1c039ffb35f1a7b68533
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

42e841c31dc9b006b0fe1a6ba7eaa4413b9da5f3  Remove unneeded content type 
definition

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/e4709176c2ec0ff8100f1c039ffb35f1a7b68533..42e841c31dc9b006b0fe1a6ba7eaa4413b9da5f3
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
@HarelM commented on this pull request.



> @@ -7,7 +7,10 @@ class TracesController < ApiController
 
   def index
 @traces = current_user.traces.reload
-render :content_type => "application/xml"
+respond_to do |format|
+  format.xml { render :content_type => "application/xml" }
+  format.json { render :content_type => "application/json" }
+end

Done in: 42e841c31dc9b006b0fe1a6ba7eaa4413b9da5f3

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#discussion_r2054837629
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

I kept the traces as and array of objects, each one of them a trace, but 
without the `{ trace: { ... } }`, was your comment about including the `trace` 
property for every trace in the array intentional?

Regardless, this is now ready for review, the tests are passing in my actions 
in the fork and I squashed everything to a single commit.

Let me know what else is missing, or if more changes are needed.
Thanks!

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2825365613
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

These cycles are too long, I'll work on trying to run this locally and make 
sure the tests pass...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2824972886
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Support Sign in with Apple (#2799)

2025-05-02 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#2799)

Below is the message that I got from Apple today.
I generally **think** that OSM adheres to the requirements, but I think Apple 
is pushing to allow their login by rejecting application and making the 
developers (like me) try and push their login system to everywhere...

### Guideline 4.8 - Design - Login Services

The app uses a third-party login service, but does not appear to offer an 
equivalent login option with all of the following features:


- The login option limits data collection to the user’s name and email address.

- The login option allows users to keep their email address private from all 
parties as part of setting up their account.

- The login option does not collect interactions with the app for advertising 
purposes without consent.


Next Steps


Revise the app to offer an equivalent login option that meets all of the above 
requirements.


If the app already includes a login option that meets all of the above 
requirements, reply to App Review in App Store Connect, identify which login 
option meets all of the requirements, and explain why it meets all of the 
requirements.


Note that Sign in with Apple meets all the requirements specified in [guideline 
4.8](https://developer.apple.com/app-store/review/guidelines/#login-services).


Resources


Learn about the [benefits of Sign in with 
Apple](https://developer.apple.com/sign-in-with-apple/).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2799#issuecomment-2847412646
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Support Sign in with Apple (#2799)

2025-05-02 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#2799)

My use case is an app that runs capacitor and opens a secured browser season 
for OSM login.
You can check it out here if you'd like: 
Https://israelhiking.osm.org.il/
This will prompt you to install the app, which you can try the login flow by 
clicking the sad face.

The bottom line is that I'm getting app rejection in the Apple app store 
submission...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2799#issuecomment-2848111239
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-24 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

I wanted to see that it is deployed first, but sure, I've updated the wiki page.
As a side note, wouldn't it be easier to simply generate an openAPI/swagger 
page that is generated from the code itself to avoid mismatches?


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2828850367
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Allow getting a GPX in the browser outside openstreetmap.org (Issue #5639)

2025-04-25 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5639)

I'm not sure this is a different problem or not, but I'm also unable to get the 
trace's icon using Oauth2 header, i.e:
https://www.openstreetmap.org/user/Harel%20M/traces/11959548/icon
With the header of Authorization: Bearer .

I do see that the request in the browser is using cookies, which is probably 
the easiest solution for images, but this makes presenting the trace's icon 
from outside OSM site harder... 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5639#issuecomment-2829792159
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

Thanks for the info! I'll look into aligning those so that it will return in a 
similar way.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2825119149
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

3282a4cf3c0ba08b91930ecc26a84aa7a1632524  Change json structure

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/f68891fc0b865c0feb4ec78d640528feb71ec25f..3282a4cf3c0ba08b91930ecc26a84aa7a1632524
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

f68891fc0b865c0feb4ec78d640528feb71ec25f  Apply suggestions from code review

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/bd886baa110042deef226f01ada411960a1a2d74..f68891fc0b865c0feb4ec78d640528feb71ec25f
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

I've changed the structure according to what suggested.
Sorry for being a noob :-/
Unfortunately, when running the docker CI code on my mac not all the tests 
pass, so I'm having a hard time running the tests locally before I commit.
I've enabled the GitHub actions on my fork, so I'll be able to see the failing 
tests there.




-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2825328499
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

10d9ede3b85b31f699826fcd7f8b7aa72ae28f26  Fix typo in show json.

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/3282a4cf3c0ba08b91930ecc26a84aa7a1632524..10d9ede3b85b31f699826fcd7f8b7aa72ae28f26
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

2dfd922598c216aafbbed7257578a5b8704a6dca  Add tags testing to json

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/b5bcdba346fc5239acde1e4326db6f8683680c57..2dfd922598c216aafbbed7257578a5b8704a6dca
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
@HarelM pushed 1 commit.

b5bcdba346fc5239acde1e4326db6f8683680c57  Update 
app/controllers/api/traces_controller.rb

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943/files/1c7cad22805e5aa6806b69e17d12e19fe8dc365c..b5bcdba346fc5239acde1e4326db6f8683680c57
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-23 Thread Harel M via rails-dev
@HarelM commented on this pull request.



> +assert_equal trace1.id, js["traces"][0]["id"]
+assert_equal trace2.id, js["traces"][1]["id"]

Added checks. 
Let me know if anything is missing.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#discussion_r205758
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Documenting API using Swagger / rswag (#3107)

2025-04-24 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#3107)

+1 for swagger/openAPI generated docs instead of a wiki maintenance, see my 
comment here: https://github.com/openstreetmap/openstreetmap-website/pull/5943.

In general, now that OSM backend supports Oauth2 token, one can set this token 
in a swagger UI to send authenticated requests through this UI, which is also 
great for testing and a great developer experience.

I have an example of my site. which is written in C# and has the swagger UI 
generated from the code, as can be seen here:
https://israelhiking.osm.org.il/swagger/index.html
Since my site uses OSM as third party authentication you can use your OSM token 
there to get user data (If you are interested in trying it out).

I have very little experience with ruby, so I wouldn't know where to start in 
order to integrate it, but in general, you can start by only integrating it and 
not exposing it until you are happy with what it offers.
In C# you only add annotations to the functions of the controller, and some 
comments, and swashbuckle (probably the equivalent of rswag) generates the open 
API spec and the swagger UI straight from the code, no need to maintain 
anything beside code documentation, which lies next to the code itself, and is 
really easy to maintain.

But I don't know if this is easy for ruby...
According to chatGPT this is process (which I believe is at least 50% 
implemented already):

With **Rswag**, you document your API **by writing RSpec tests** that describe 
each endpoint's behavior, inputs, and outputs.

It's a clever setup because it:

✅ **Documents** your API (OpenAPI-compliant YAML/JSON)  
✅ **Tests** that your API behaves as expected  
✅ **Feeds** that documentation directly into Swagger UI

---

### 📌 Why this approach?

Instead of writing Swagger YAML manually (which can get messy and out of sync), 
you:

- Write a test for `GET /posts`
- Describe its parameters, responses, and schema
- Run the test, which generates the Swagger JSON
- View the result in Swagger UI

---

### 🧠 Example: Document + test `GET /users`

Let's say you have a `UsersController` with an index action. You can create a 
test like this:

```ruby
# spec/integration/users_spec.rb
require 'swagger_helper'

RSpec.describe 'Users API', type: :request do
  path '/users' do
get 'Retrieves all users' do
  tags 'Users'
  produces 'application/json'

  response '200', 'users found' do
schema type: :array, items: {
  type: :object,
  properties: {
id: { type: :integer },
name: { type: :string },
email: { type: :string }
  },
  required: [ 'id', 'name', 'email' ]
}

run_test!
  end
end
  end
end
```

That does **two things at once**:

- 🎯 Describes the endpoint to Swagger
- ✅ Validates that a 200 response is returned and matches the schema

---

So yeah—you're integrating Swagger by writing **RSpec tests that double as 
documentation**. It's a two-for-one deal: test coverage + interactive docs.

Want help writing one for a real route in your app? Just tell me which 
controller/action you'd like to document.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/3107#issuecomment-2828915771
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Allow getting a GPX in the browser outside openstreetmap.org (Issue #5639)

2025-04-24 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5639)

Any updates on this? Is there anyway I can help?
I'm removing part of my backend that are only a passthrough to OSM API and this 
is still a problem unfortunately when running from the browser...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5639#issuecomment-2828946535
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-22 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5943)

I've added some tests according to what I saw in other controllers' tests.
Let me know if more tests are needed.

As to contributing, I think it's missing some explanation of default users that 
are automatically created and how to login to those (like the nobody user). And 
how to create users in case those are needed.

How to boot the app and see that everything is working as expected might need 
to be a bit more explicitly written I think.

I can open a PR against the contributing.md for what I think might help future 
developers if that might be of interest. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#issuecomment-2822498239
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Support Sign in with Apple (#2799)

2025-05-02 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#2799)

@tomhughes is the gap here are only the 79 EU a year or are there still 
technical issues preventing this from getting completed?
I use OSM login for my app in the app store and it keeps getting rejection due 
to missing Apple login flow.
I'm willing to pay the developer account fee if that's what's preventing the 
commits you did to get through.
Please let me know how else I can help.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2799#issuecomment-2846987134
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Support Sign in with Apple (#2799)

2025-05-02 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#2799)

That's a valid point, and I can totally respect that, but I'm mainly trying to 
get my life easier since I need to respond every time they reject my app :-/ 
I can reframe that implementing this would be helpful to my app and thus to OSM 
as my app is the main reason for OSM contribution in Israel, I believe. I hope 
this argument is stronger than not giving Apple the satisfaction :-)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2799#issuecomment-2847016641
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Support Sign in with Apple (#2799)

2025-05-03 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#2799)

That's partially true. Implementing this will reduce the friction, and allow a 
smoother review of my app, that uses OSM as the provider for user login.
Since my app is basically a webview wrapped in native code, adding this feature 
will automatically add Apple login option to my app.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2799#issuecomment-2849001082
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Added JSON response format support for /api/0.6/user/gpx_files endpoint (PR #5779)

2025-04-21 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5779)

I've created another PR here:
- #5943

I'm extremely out of my comfort zone as I have never written a single line in 
ruby or ruby on rails...
Never-the-less, I'm willing to invest the time to see this through.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5779#issuecomment-2819409552
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


[openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

2025-04-21 Thread Harel M via rails-dev
### Description

This adds support for json for traces API (both for `index` and `show`).
This PR is to replace #5779.

To copy from the PR initial post there:
This PR adds JSON format support to the user's GPX files API endpoint, 
enhancing the API's flexibility and consistency with other endpoints that 
already support JSON responses. The implementation:

Adds JSON format handling to the traces controller (index, show)
Creates a JSON view template matching the XML structure
Ensures proper content type headers are set
This enhancement improves client-side parsing efficiency while maintaining 
backward compatibility with the existing XML format.
Resolves https://github.com/openstreetmap/openstreetmap-website/issues/5646

### How has this been tested?
Unfortunately, I was not able to test this.

Is there a more comprehensive guide as to how to setup a development 
environment? I've looked at what the CI does, mainly for the docker build 
and was able to boot up and instance, but I wasn't sure how I can create 
users there and if the mail stuff will work and how, so I was not able to test 
it properly.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/5943

-- Commit Summary --

  * Add support for json traces API

-- File Changes --

M app/controllers/api/traces_controller.rb (9)
M app/controllers/api/users/traces_controller.rb (5)
A app/views/api/traces/_trace.json.jbuilder (15)
A app/views/api/traces/show.json.jbuilder (3)
A app/views/api/users/traces/index.json.jbuilder (3)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5943.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5943.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Allow getting a GPX in the browser outside openstreetmap.org (Issue #5639)

2025-03-01 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5639)

Should I be opening a different issue or should this issue be reopened?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5639#issuecomment-2692427652
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add support for json response for `/api/0.6/user/gpx_files` endpoint (Issue #5646)

2025-03-08 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5646)

Thanks for looking into this @Satya900!
You can link the issue from the PR as well to automatically close this issue 
when the PR is merged (by adding a comment on the PR main message with 
"resolves #xxx"

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5646#issuecomment-2708400990
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Allow getting a GPX in the browser outside openstreetmap.org (Issue #5639)

2025-02-23 Thread Harel M via rails-dev
HarelM left a comment (openstreetmap/openstreetmap-website#5639)

Thanks for looking into this!
I'm still getting the same error message as above though.
I'm testing this from the browser console when the site 
https://israelhiking.osm.org.il and I'm running the following fetch (using my 
OAuth2 header):
```js
fetch("https://api.openstreetmap.org/api/0.6/gpx/4192873/data";, { method: 
"GET", headers: {Authorization: "Bearer my-token-reducted"}}).then(r => 
r.text()).then(console.log)
```

Let me know if I I'm missing anything...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5639#issuecomment-2677129517
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev