diff --git a/1856337628.gpx b/1856337628.gpx
deleted file mode 100644
index c750260..0000000
--- a/1856337628.gpx
+++ /dev/null
@@ -1,2 +0,0 @@
-
-02824 Sentier du Talent613.7999877929688613.7999877929688613.7999877929688613.7999877929688617.3999938964844617.3999938964844617.3999938964844617.1999816894531616.7999877929688616.7999877929688616.7999877929688616.7999877929688616.5616.5999755859375616.6999816894531616.6999816894531616.6999816894531616.5999755859375616.6999816894531616.6999816894531616.6999816894531616.6999816894531616.6999816894531616.7999877929688617617.0999755859375616.8999938964844617617616.6999816894531616.6999816894531616.1999816894531616.0999755859375616615.8999938964844615.8999938964844615.8999938964844616616616.2999877929688616.5999755859375616.8999938964844616.8999938964844616.8999938964844616.8999938964844617.1999816894531617.5617.5999755859375617.6999816894531617.6999816894531617.5999755859375617.3999938964844617.5999755859375617.6999816894531617.8999938964844618.1999816894531618.7999877929688619619619619619.1999816894531619.0999755859375619.0999755859375619.1999816894531619.1999816894531619.0999755859375619618.8999938964844618.7999877929688618.7999877929688618.7999877929688618.7999877929688618.6999816894531618.6999816894531618.1999816894531617.8999938964844617.7999877929688617.7999877929688617.6999816894531619.0999755859375619.5620620.0999755859375620.0999755859375620.2999877929688620.5620.6999816894531621621.3999938964844622.1999816894531622.3999938964844622.5999755859375622.8999938964844623.1999816894531623.2999877929688623.3999938964844623.3999938964844623.3999938964844623.3999938964844623.3999938964844623.5623.6999816894531623.6999816894531623.8999938964844624.0999755859375624.0999755859375623.8999938964844623.6999816894531623.7999877929688623.7999877929688623.7999877929688623.7999877929688623.6999816894531623.5999755859375623.5623.2999877929688623.5623.6999816894531623.3999938964844623.3999938964844623.5623.7999877929688624.3999938964844624.7999877929688624.7999877929688624.5624.0999755859375623.2999877929688622.7999877929688622.6999816894531622.5622.1999816894531621.8999938964844621.3999938964844621.0999755859375620.7999877929688620.3999938964844619.8999938964844619.5999755859375619.1999816894531618.7999877929688618.8999938964844621.6999816894531623.6999816894531623.6999816894531623.5999755859375623.0999755859375622.6999816894531620.5619.8999938964844619.5999755859375619.3999938964844619.1999816894531619618.7999877929688618.5999755859375618617.8999938964844618618.0999755859375618.5999755859375619.0999755859375619.5619.2999877929688619.3999938964844619.3999938964844619.3999938964844619.3999938964844619.2999877929688618.7999877929688618.5999755859375618.5618.5618.6999816894531619.1999816894531619.2999877929688619.2999877929688619.3999938964844619.5999755859375620.0999755859375620.5619.8999938964844619.7999877929688619.7999877929688619.7999877929688619.7999877929688620620.2999877929688620.5999755859375620.6999816894531620.7999877929688620.7999877929688620.8999938964844621.1999816894531621.5999755859375621.6999816894531621.8999938964844622.1999816894531622.2999877929688622621.5621.0999755859375620.8999938964844620.8999938964844620.1999816894531620.8999938964844620.7999877929688620.8999938964844620.8999938964844621621621.1999816894531621.1999816894531621.2999877929688621.3999938964844621.3999938964844621.5999755859375621.8999938964844622.2999877929688622.5999755859375623.0999755859375623.6999816894531624624.0999755859375624623.7999877929688624624.2999877929688624.3999938964844624.5999755859375625.1999816894531625.3999938964844625.3999938964844625.5625.5999755859375624.8999938964844624.6999816894531624.8999938964844625.1999816894531625.7999877929688625.6999816894531625.1999816894531625625.0999755859375625.1999816894531625.1999816894531625.2999877929688625.5625.7999877929688626.5999755859375627.6999816894531627.2999877929688627.1999816894531627.1999816894531627.1999816894531627.2999877929688627.3999938964844627.5627.8999938964844628.2999877929688628.5999755859375628.5999755859375628.6999816894531628.8999938964844628.7999877929688628.5999755859375628.5628.7999877929688629.0999755859375629.0999755859375629628.8999938964844629629.1999816894531629.1999816894531629.2999877929688629.5629.7999877929688630630.1999816894531630.2999877929688630.2999877929688630.5630.6999816894531630.8999938964844631.0999755859375631.2999877929688631630.6999816894531630.5999755859375630.6999816894531630.7999877929688630.7999877929688630.5999755859375630.5630.3999938964844630.3999938964844630.5630.5630.5999755859375630.5999755859375630.7999877929688631.0999755859375631.1999816894531631.3999938964844631.3999938964844631.3999938964844631.3999938964844631.3999938964844631.3999938964844631.5631.5999755859375631.5999755859375631.7999877929688631.7999877929688631.8999938964844632.0999755859375632.1999816894531632.5632.8999938964844633.0999755859375633.2999877929688633.5999755859375634.0999755859375634.5999755859375635635.3999938964844635.6999816894531635.6999816894531635.5635634.5999755859375634.1999816894531634.0999755859375633.8999938964844633.8999938964844633.7999877929688633.6999816894531634634.6999816894531634.7999877929688635.0999755859375636.5639.1999816894531643.2999877929688646.2999877929688647.3999938964844648.2999877929688648.7999877929688649.5650650.5999755859375651.0999755859375651.5999755859375651.6999816894531651.7999877929688651.8999938964844651.5999755859375652.0999755859375652.5999755859375653652.8999938964844652.6999816894531651.8999938964844650.7999877929688649.7999877929688648.5999755859375647.8999938964844648.0999755859375648.2999877929688649.0999755859375649.3999938964844649.1999816894531648.5647646.0999755859375644.8999938964844644.2999877929688643.5643.0999755859375642.8999938964844642.6999816894531642.2999877929688641.8999938964844641.3999938964844640.8999938964844639.8999938964844639.3999938964844639.2999877929688639.8999938964844639.8999938964844639.3999938964844639638.6999816894531638.5999755859375638.1999816894531638.1999816894531638.1999816894531638.1999816894531638.3999938964844639639.7999877929688640640.0999755859375640.2999877929688639.5999755859375639.5639.5639.5639.2999877929688638.7999877929688637.8999938964844637.7999877929688637.6999816894531637.8999938964844638.1999816894531638.1999816894531638.2999877929688638.2999877929688638.5638.5638.7999877929688638.8999938964844639.2999877929688640.0999755859375640.8999938964844641641640.6999816894531640.6999816894531641641641.3999938964844641.3999938964844641.3999938964844641.3999938964844641.6999816894531641.3999938964844641.7999877929688641.7999877929688641.8999938964844640.8999938964844642.0999755859375641.5999755859375642641.8999938964844642.0999755859375641.8999938964844641.5641.8999938964844642.0999755859375642.0999755859375642.0999755859375642.0999755859375642.2999877929688642.7999877929688642.7999877929688642.6999816894531642.6999816894531642.8999938964844643643.0999755859375642.8999938964844642.8999938964844643643.0999755859375643643.1999816894531643.3999938964844643.2999877929688643.0999755859375643.1999816894531643.1999816894531643.5643.6999816894531643.1999816894531643.3999938964844643.6999816894531643.7999877929688643.6999816894531643.5999755859375643.7999877929688643.5999755859375643.5643.2999877929688643.0999755859375643643.0999755859375643643.0999755859375642.8999938964844642.8999938964844643.1999816894531643.1999816894531643.3999938964844643.5999755859375643.5643.5999755859375643.6999816894531643.8999938964844643.5999755859375643.5643.5999755859375643.5643.6999816894531643.7999877929688643.6999816894531644.0999755859375644644.0999755859375644.1999816894531644644644.1999816894531644.2999877929688644.1999816894531644.1999816894531644.3999938964844644.6999816894531644.5999755859375644.5644.5999755859375644.8999938964844645.3999938964844645.5999755859375645.5645.1999816894531644.5999755859375644.5645.3999938964844644.8999938964844644.6999816894531644.7999877929688645.2999877929688644.6999816894531644.8999938964844645.2999877929688645.1999816894531645.0999755859375645.3999938964844645.3999938964844645.6999816894531646.5646.3999938964844647.5648.5650649.5647.2999877929688645.5999755859375645.1999816894531645.1999816894531645.2999877929688645.5999755859375646.1999816894531646.6999816894531646.5999755859375646645.5645.6999816894531645.6999816894531646.3999938964844646.2999877929688645.8999938964844645.8999938964844645.8999938964844645.6999816894531646.6999816894531646.6999816894531646.6999816894531646.7999877929688647647.2999877929688648.6999816894531648.8999938964844649.3999938964844649.8999938964844650.3999938964844650.3999938964844650.7999877929688651.3999938964844651.6999816894531652652.3999938964844652.7999877929688653.5999755859375654.3999938964844654.8999938964844655.1999816894531655.3999938964844655.5999755859375656657.1999816894531658.2999877929688658.7999877929688659659.2999877929688659.3999938964844659.8999938964844660.5999755859375660.3999938964844659.0999755859375657.3999938964844656.2999877929688655.7999877929688655.5655.2999877929688655654.8999938964844654.7999877929688654.6999816894531654.5999755859375654.8999938964844654.5654.5999755859375654.8999938964844654.7999877929688655654.7999877929688654.6999816894531654.5999755859375654.6999816894531654.5654.5654.3999938964844654.2999877929688655.0999755859375654.7999877929688654.7999877929688654.8999938964844654.7999877929688655655.0999755859375655.3999938964844655.0999755859375654.8999938964844655655.3999938964844655.0999755859375655.2999877929688655.1999816894531655.0999755859375655655655.0999755859375655.0999755859375655.2999877929688655.1999816894531655.2999877929688655.5655.6999816894531655.6999816894531655.3999938964844655.6999816894531655.8999938964844655.5999755859375655.2999877929688655.7999877929688655.7999877929688655.5999755859375655.8999938964844655.5999755859375655.6999816894531655.8999938964844655.7999877929688655.6999816894531655.3999938964844655.7999877929688656655.6999816894531655.7999877929688655.7999877929688655.6999816894531655.6999816894531655.7999877929688655.7999877929688655.6999816894531655.6999816894531655.6999816894531655.6999816894531655.5999755859375656.5999755859375656.6999816894531657.1999816894531658.5659658.8999938964844658.3999938964844658.3999938964844658.2999877929688658.2999877929688658.2999877929688658657.8999938964844657.8999938964844657.5657656.8999938964844657.0999755859375657.0999755859375657.1999816894531657.2999877929688657.5999755859375657.8999938964844658.2999877929688658.3999938964844658.3999938964844658.3999938964844658.5999755859375659659.1999816894531659.7999877929688660.0999755859375660.7999877929688661.0999755859375661.5661.6999816894531662.0999755859375661.2999877929688660.7999877929688659.7999877929688659.3999938964844659.2999877929688659.5659.7999877929688660.1999816894531660.5999755859375659.7999877929688659.8999938964844660.2999877929688660.8999938964844661.8999938964844662.5662.8999938964844663.1999816894531663.2999877929688663.5999755859375664664.6999816894531665665.5666.5666.5999755859375667667.2999877929688667.8999938964844667.6999816894531666.8999938964844666665.2999877929688664.2999877929688664663.7999877929688663.6999816894531663.5999755859375663.5999755859375663.5999755859375663.3999938964844663.5663.2999877929688663.2999877929688663.3999938964844663.7999877929688664.0999755859375664.0999755859375664.1999816894531664.5999755859375665665.3999938964844666667.6999816894531669669.3999938964844669.7999877929688670.1999816894531670.8999938964844672674676677.8999938964844679.1999816894531680.5681.8999938964844683.5684.6999816894531685.5686.3999938964844683.8999938964844683.5999755859375682.7999877929688682.2999877929688681.2999877929688680.7999877929688680.2999877929688680.0999755859375679.5999755859375678.5678.5999755859375678.5999755859375677.7999877929688676.8999938964844675.7999877929688671.8999938964844671.7999877929688671.0999755859375670.6999816894531670.8999938964844672672.3999938964844672.8999938964844673.1999816894531674674.7999877929688675.6999816894531677.2999877929688678.5679.5679.5678.3999938964844677.3999938964844676.5999755859375675.0999755859375674.1999816894531673.5999755859375673.3999938964844673.5999755859375674.2999877929688675675.0999755859375675.3999938964844675.2999877929688675.0999755859375674672.8999938964844672.1999816894531670.6999816894531670.5670.6999816894531670.7999877929688670.7999877929688671.0999755859375671.5672672.6999816894531673.0999755859375673.1999816894531673.3999938964844673.6999816894531674674.3999938964844674.6999816894531674.8999938964844675.0999755859375676.2999877929688677.0999755859375677.3999938964844678.1999816894531679.6999816894531680.1999816894531680.5999755859375680.8999938964844681.2999877929688682.1999816894531682.5999755859375683684.0999755859375684.6999816894531685685684.8999938964844685.7999877929688686.5999755859375687.7999877929688688.2999877929688688.2999877929688688.2999877929688688.2999877929688688.8999938964844690.8999938964844692.1999816894531693693.6999816894531694.1999816894531694.3999938964844693.6999816894531693692.5692.0999755859375691.5690.7999877929688688.7999877929688688.1999816894531687.5686.8999938964844686.0999755859375685.2999877929688685684.5683.6999816894531683.1999816894531681.7999877929688680.8999938964844679.8999938964844679.1999816894531678.8999938964844678.8999938964844679679.1999816894531679.2999877929688679.3999938964844679.5679.5999755859375679.6999816894531679.5679.6999816894531679.8999938964844680.1999816894531680.5680.5680.2999877929688679.5679.0999755859375678.8999938964844678.7999877929688678.8999938964844679.0999755859375679.0999755859375679.0999755859375679.2999877929688679.5679.6999816894531679.8999938964844680.3999938964844680.2999877929688680.7999877929688680.7999877929688681.1999816894531682.5999755859375682.7999877929688682.1999816894531681.2999877929688681.8999938964844682.0999755859375682.1999816894531682682681.7999877929688681.6999816894531682.8999938964844683.3999938964844684685687.3999938964844688688.7999877929688689.2999877929688689.6999816894531691.0999755859375692.5695.1999816894531696699.6999816894531700.3999938964844700.5700.0999755859375700.2999877929688699.5699.1999816894531699699699699698.8999938964844698.3999938964844696.8999938964844696.5697696.7999877929688696.3999938964844695.6999816894531695.0999755859375694.8999938964844694.5999755859375694.2999877929688693.8999938964844693.5693.2999877929688693.0999755859375692.5691.0999755859375690.7999877929688690.5999755859375690.2999877929688690.1999816894531689.1999816894531689.7999877929688689.6999816894531690.3999938964844691.2999877929688692.3999938964844692.2999877929688691.7999877929688688.5999755859375687.8999938964844687.2999877929688686.5686.5686.5999755859375686.8999938964844687.3999938964844687.1999816894531687.0999755859375687.0999755859375687.3999938964844687.3999938964844687.0999755859375687.0999755859375686.8999938964844687.1999816894531687.0999755859375687.2999877929688686.8999938964844686.8999938964844686.6999816894531686.3999938964844686.2999877929688686.6999816894531686.5686.6999816894531687.1999816894531687.5999755859375689.2999877929688691.5999755859375692692.6999816894531692.8999938964844693.2999877929688693.5999755859375695.0999755859375695.5695.6999816894531693.8999938964844693.6999816894531693.5692.2999877929688692.2999877929688692.0999755859375692.5693.2999877929688693.6999816894531693.5999755859375693.5999755859375692.7999877929688692.7999877929688693.0999755859375693.0999755859375691.6999816894531690.1999816894531690.5690.0999755859375690689.7999877929688689.2999877929688689.1999816894531689.0999755859375689.0999755859375689.2999877929688689.5689.6999816894531689.5999755859375689.6999816894531689.7999877929688690690.0999755859375690.3999938964844690.7999877929688690.7999877929688690.8999938964844690.6999816894531690.7999877929688690.8999938964844690.5999755859375690.5999755859375690.6999816894531690.7999877929688690.8999938964844691691.2999877929688691.6999816894531691.8999938964844691.5691.5691.6999816894531691.8999938964844692.0999755859375692.0999755859375691.8999938964844692691.8999938964844691.5999755859375691.2999877929688691690.8999938964844690.7999877929688690.7999877929688689.2999877929688689.8999938964844690690.0999755859375690.0999755859375690689.8999938964844689.7999877929688689.7999877929688690690.2999877929688690690689.8999938964844690.1999816894531690.8999938964844690.6999816894531690.0999755859375690690.5999755859375690.8999938964844691691.3999938964844691.7999877929688692.2999877929688692.5692.5692.0999755859375692.3999938964844692.2999877929688692.2999877929688692.3999938964844693693.3999938964844693.3999938964844693.2999877929688692.7999877929688692.1999816894531692.1999816894531692.6999816894531693.2999877929688694.0999755859375694.5999755859375694.5694.1999816894531694.8999938964844695.5999755859375695.1999816894531695.5695.0999755859375695.1999816894531695.3999938964844695.6999816894531696.0999755859375695.6999816894531695.5999755859375695.7999877929688696696.0999755859375696.1999816894531695.8999938964844696695.6999816894531696.0999755859375696.0999755859375695.8999938964844696696.6999816894531697.6999816894531698.0999755859375698.8999938964844699.1999816894531699.2999877929688699698.5696.5999755859375696.6999816894531696.5999755859375696.1999816894531696.2999877929688696.5999755859375696.5696.5999755859375697697697.2999877929688697.5697.7999877929688698.5698.6999816894531699.3999938964844700.2999877929688700.5700.7999877929688701.2999877929688701.2999877929688702702.2999877929688702.3999938964844702.5702.6999816894531704.0999755859375704.8999938964844705.2999877929688704.6999816894531704.8999938964844705.3999938964844705.5999755859375705.6999816894531705.8999938964844706.2999877929688706.5999755859375706.6999816894531706.7999877929688706.7999877929688706.8999938964844706.8999938964844707707706.8999938964844706.7999877929688706.8999938964844707707.1999816894531707.3999938964844707.5707.5999755859375707.6999816894531707.7999877929688708708.5708.6999816894531709709.1999816894531709.1999816894531709.1999816894531709.1999816894531709.3999938964844709.8999938964844710.0999755859375710.2999877929688710.6999816894531711.2999877929688711.2999877929688710.8999938964844711.5999755859375712.1999816894531712.7999877929688713.3999938964844713.8999938964844714.1999816894531714.5714.8999938964844715.2999877929688715.8999938964844716.2999877929688716.6999816894531717.0999755859375718.2999877929688719.2999877929688719.6999816894531719.7999877929688720.0999755859375720.3999938964844720.7999877929688722.8999938964844724.1999816894531725.0999755859375725.2999877929688725.2999877929688725.2999877929688725.2999877929688725.2999877929688724.6999816894531724.5724.3999938964844724.5999755859375725.5999755859375725.7999877929688727.2999877929688728.8999938964844729.7999877929688730.3999938964844731.1999816894531733.1999816894531734734.8999938964844735.5737.0999755859375739.1999816894531741.5999755859375743.5999755859375745.7999877929688748.3999938964844751754757.1999816894531759.1999816894531762.5763.7999877929688764.6999816894531765.3999938964844766.5767.1999816894531767.1999816894531768768.5770.0999755859375771.3999938964844773.5775.2999877929688778.7999877929688779.6999816894531780.0999755859375779.8999938964844780780.0999755859375780.0999755859375780.0999755859375780.0999755859375780.2999877929688780.5999755859375781.0999755859375781.3999938964844781.6999816894531782.1999816894531782.7999877929688783.2999877929688784784.5999755859375785.1999816894531785.8999938964844786.6999816894531787.6999816894531788.7999877929688792.7999877929688794795.0999755859375796.1999816894531797.2999877929688798.0999755859375798.3999938964844798.6999816894531799.3999938964844799.6999816894531800800.5801.0999755859375801.2999877929688801.5801.6999816894531801.5999755859375801.2999877929688800.7999877929688801800.8999938964844800.7999877929688800.6999816894531800.5999755859375800.5800.3999938964844800.3999938964844800.5800.8999938964844801.3999938964844801.5801.3999938964844801.5999755859375802801.7999877929688801.7999877929688801.7999877929688801.8999938964844802801.8999938964844799.5999755859375799.2999877929688799.3999938964844799.5999755859375799.5999755859375800800.8999938964844801.0999755859375801.5802.1999816894531803.0999755859375803.7999877929688805806806.0999755859375806805.2999877929688804.6999816894531803.7999877929688803.5803.5803.5803.1999816894531802.7999877929688802801.0999755859375800.3999938964844800.2999877929688800801.1999816894531802.3999938964844803.3999938964844803.8999938964844804.5806.0999755859375806.0999755859375806.2999877929688806.0999755859375806.0999755859375806.0999755859375806.3999938964844806.3999938964844806.3999938964844806.3999938964844806.3999938964844806.3999938964844806.2999877929688806.2999877929688806.2999877929688806.2999877929688806.2999877929688806.2999877929688806.2999877929688806.3999938964844806.2999877929688806.2999877929688806.2999877929688
\ No newline at end of file
diff --git a/go.mod b/go.mod
index 1936ddf..15fe52e 100644
--- a/go.mod
+++ b/go.mod
@@ -3,8 +3,25 @@ module git.readonly.ch/bouzoure/gpx-downloader
go 1.25.7
require (
- github.com/golang-io/requests v0.0.0-20260112012319-11ff3d588020 // indirect
- github.com/tkrajina/gpxgo v1.4.0 // indirect
+ github.com/gofiber/fiber/v2 v2.52.11
+ github.com/gofiber/helmet/v2 v2.2.26
+ github.com/golang-io/requests v0.0.0-20260112012319-11ff3d588020
+ github.com/tkrajina/gpxgo v1.4.0
+)
+
+require (
+ github.com/andybalholm/brotli v1.2.0 // indirect
+ github.com/clipperhouse/uax29/v2 v2.6.0 // indirect
+ github.com/google/uuid v1.6.0 // indirect
+ github.com/klauspost/compress v1.18.4 // indirect
+ github.com/mattn/go-colorable v0.1.14 // indirect
+ github.com/mattn/go-isatty v0.0.20 // indirect
+ github.com/mattn/go-runewidth v0.0.19 // indirect
+ github.com/rivo/uniseg v0.4.7 // indirect
+ github.com/valyala/bytebufferpool v1.0.0 // indirect
+ github.com/valyala/fasthttp v1.69.0 // indirect
+ github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/net v0.50.0 // indirect
+ golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
)
diff --git a/go.sum b/go.sum
index f6609f2..4870de2 100644
--- a/go.sum
+++ b/go.sum
@@ -1,16 +1,45 @@
+github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
+github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
+github.com/clipperhouse/uax29/v2 v2.6.0 h1:z0cDbUV+aPASdFb2/ndFnS9ts/WNXgTNNGFoKXuhpos=
+github.com/clipperhouse/uax29/v2 v2.6.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/gofiber/fiber/v2 v2.52.11 h1:5f4yzKLcBcF8ha1GQTWB+mpblWz3Vz6nSAbTL31HkWs=
+github.com/gofiber/fiber/v2 v2.52.11/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
+github.com/gofiber/helmet/v2 v2.2.26 h1:KreQVUpCIGppPQ6Yt8qQMaIR4fVXMnvBdsda0dJSsO8=
+github.com/gofiber/helmet/v2 v2.2.26/go.mod h1:XE0DF4cgf0M5xIt7qyAK5zOi8jJblhxfSDv9DAmEEQo=
github.com/golang-io/requests v0.0.0-20260112012319-11ff3d588020 h1:NsY7l0CzD6sL4YDmi2ug1XJ2syK6HYtE4Vu38+S59Kc=
github.com/golang-io/requests v0.0.0-20260112012319-11ff3d588020/go.mod h1:axo3gO6bWOpJNUipkqkmAH7WwdeLg5phLVI3N1dFBnM=
+github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
+github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c=
+github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
+github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
+github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
+github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
+github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tkrajina/gpxgo v1.4.0 h1:cSD5uSwy3VZuNFieTEZLyRnuIwhonQEkGPkPGW4XNag=
github.com/tkrajina/gpxgo v1.4.0/go.mod h1:BXSMfUAvKiEhMEXAFM2NvNsbjsSvp394mOvdcNjettg=
+github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
+github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
+github.com/valyala/fasthttp v1.69.0 h1:fNLLESD2SooWeh2cidsuFtOcrEi4uB4m1mPrkJMZyVI=
+github.com/valyala/fasthttp v1.69.0/go.mod h1:4wA4PfAraPlAsJ5jMSqCE2ug5tqUPwKXxVj8oNECGcw=
+github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
+github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60=
golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
+golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
diff --git a/main.go b/main.go
index de2a116..57cadec 100644
--- a/main.go
+++ b/main.go
@@ -1,75 +1,29 @@
package main
import (
- "context"
- "encoding/json"
- "fmt"
- "os"
+ "log"
- "github.com/golang-io/requests"
- "github.com/tkrajina/gpxgo/gpx"
+ "git.readonly.ch/bouzoure/gpx-downloader/routes"
+ "github.com/gofiber/fiber/v2"
+ "github.com/gofiber/helmet/v2"
)
-type SuisseMobileGeometry struct {
- Segments [][][]float64 `json:"coordinates"`
-}
-
-type SuisseMobileProperties struct {
- Name string `json:"name"`
-}
-
-type SuisseMobileResponse struct {
- Properties SuisseMobileProperties `json:"properties"`
- Geometry SuisseMobileGeometry `json:"geometry"`
-}
-
func main() {
- sess := requests.New(requests.URL("https://schweizmobil.ch"))
- resp, _ := sess.DoRequest(context.Background(),
- requests.Path("/api/6/tracks/1856337628"),
- )
+ // Create fiber config
+ appConfig := fiber.Config{}
- var response SuisseMobileResponse
- err := json.Unmarshal(resp.Content.Bytes(), &response)
+ // Init fiber webapp with config
+ app := fiber.New(appConfig)
+
+ // Apply middlewares
+ app.Use(helmet.New())
+
+ // Routes
+ app.Get("/", routes.Index)
+ app.Post("/fetch", routes.Fetch)
+
+ err := app.Listen("127.0.0.1:3000")
if err != nil {
- panic(err)
- }
-
- var gpxFile gpx.GPX
- var gpxTrack gpx.GPXTrack
-
- gpxFile.Name = response.Properties.Name
-
- for _, segments := range response.Geometry.Segments {
- var gpxTrackSegment gpx.GPXTrackSegment
-
- for _, point := range segments {
- fmt.Println(point)
- var gpxPoint gpx.GPXPoint
-
- gpxPoint.Longitude = point[0]
- gpxPoint.Latitude = point[1]
- gpxPoint.Elevation = *gpx.NewNullableFloat64(point[2])
-
- gpxTrackSegment.AppendPoint(&gpxPoint)
- }
-
- gpxTrack.AppendSegment(&gpxTrackSegment)
- }
-
- gpxFile.AppendTrack(&gpxTrack)
- xml, err := gpxFile.ToXml(gpx.ToXmlParams{})
- if err != nil {
- panic(err)
- }
-
- file, err := os.Create("1856337628.gpx")
- if err != nil {
- panic(err)
- }
-
- _, err = file.Write(xml)
- if err != nil {
- panic(err)
+ log.Fatal(err)
}
}
diff --git a/providers/suisse_mobile.go b/providers/suisse_mobile.go
new file mode 100644
index 0000000..493f0bf
--- /dev/null
+++ b/providers/suisse_mobile.go
@@ -0,0 +1,84 @@
+package providers
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "regexp"
+ "strconv"
+
+ "github.com/golang-io/requests"
+ "github.com/tkrajina/gpxgo/gpx"
+)
+
+func SuisseMobileCheckURL(url string) int {
+ var id int
+
+ re := regexp.MustCompile(`https?://(?:www\.)?schweizmobil\.ch/[^/]+/tour/(\d+)`)
+ matches := re.FindStringSubmatch(url)
+
+ if len(matches) > 1 {
+ id, _ = strconv.Atoi(matches[1])
+ }
+
+ return id
+}
+
+type SuisseMobileGeometry struct {
+ Segments [][][]float64 `json:"coordinates"`
+}
+
+type SuisseMobileProperties struct {
+ Name string `json:"name"`
+}
+
+type SuisseMobileResponse struct {
+ Properties SuisseMobileProperties `json:"properties"`
+ Geometry SuisseMobileGeometry `json:"geometry"`
+}
+
+func SuisseMobileFetch(id int) (gpx.GPX, error) {
+ var gpxFile gpx.GPX
+ var gpxTrack gpx.GPXTrack
+
+ sess := requests.New(
+ requests.URL("https://schweizmobil.ch"),
+ )
+ resp, err := sess.DoRequest(
+ context.Background(),
+ requests.Path(fmt.Sprintf(
+ "/api/6/tracks/%d", id,
+ )),
+ )
+ if err != nil {
+ return gpxFile, err
+ }
+
+ var response SuisseMobileResponse
+ err = json.Unmarshal(resp.Content.Bytes(), &response)
+ if err != nil {
+ return gpxFile, err
+ }
+
+ gpxFile.Name = response.Properties.Name
+
+ for _, segments := range response.Geometry.Segments {
+ var gpxTrackSegment gpx.GPXTrackSegment
+
+ for _, point := range segments {
+ var gpxPoint gpx.GPXPoint
+
+ gpxPoint.Longitude = point[0]
+ gpxPoint.Latitude = point[1]
+ gpxPoint.Elevation = *gpx.NewNullableFloat64(point[2])
+
+ gpxTrackSegment.AppendPoint(&gpxPoint)
+ }
+
+ gpxTrack.AppendSegment(&gpxTrackSegment)
+ }
+
+ gpxFile.AppendTrack(&gpxTrack)
+
+ return gpxFile, nil
+}
diff --git a/routes/fetch.go b/routes/fetch.go
new file mode 100644
index 0000000..f9a1259
--- /dev/null
+++ b/routes/fetch.go
@@ -0,0 +1,53 @@
+package routes
+
+import (
+ "fmt"
+
+ "git.readonly.ch/bouzoure/gpx-downloader/providers"
+ "github.com/gofiber/fiber/v2"
+ "github.com/tkrajina/gpxgo/gpx"
+)
+
+func Fetch(c *fiber.Ctx) error {
+ sourceUrl := c.FormValue("url")
+ if len(sourceUrl) <= 0 {
+ c.SendStatus(422)
+ return c.SendString("Error: URL is empty")
+ }
+
+ var gpxFile gpx.GPX
+ var err error
+ var filename string
+
+ // Check if link is Suisse Mobile
+ suisseMobileId := providers.SuisseMobileCheckURL(sourceUrl)
+ if suisseMobileId > 0 {
+ filename = fmt.Sprintf(
+ "suisse_mobile_%d",
+ suisseMobileId,
+ )
+
+ gpxFile, err = providers.SuisseMobileFetch(suisseMobileId)
+ if err != nil {
+ return err
+ }
+ }
+
+ if len(filename) <= 0 {
+ c.SendStatus(422)
+ return c.SendString("Error: URL is not supported")
+ }
+
+ xml, err := gpxFile.ToXml(gpx.ToXmlParams{})
+ if err != nil {
+ return err
+ }
+
+ c.Set("Content-Type", "octet-stream")
+ c.Set("Content-Disposition", fmt.Sprintf(
+ "attechment,filename=%s.gpx",
+ filename,
+ ))
+
+ return c.Send(xml)
+}
diff --git a/routes/index.go b/routes/index.go
new file mode 100644
index 0000000..d53c726
--- /dev/null
+++ b/routes/index.go
@@ -0,0 +1,13 @@
+package routes
+
+import "github.com/gofiber/fiber/v2"
+
+func Index(c *fiber.Ctx) error {
+ c.Set("Content-Type", "text/html")
+ return c.SendString(`
+
+ `)
+}