From 01c9148c54552274a74c32ae868cd62c200c4498 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Mon, 21 Jun 2021 12:13:47 +0200 Subject: [PATCH] =?UTF-8?q?Add=20support=20for=20=C3=B6v.ztn.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bahnplan.web/Pages/Index.cshtml | 4 ++-- bahnplan.web/Pages/OEAPI.cshtml.cs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bahnplan.web/Pages/Index.cshtml b/bahnplan.web/Pages/Index.cshtml index aa58f33..a2f9071 100644 --- a/bahnplan.web/Pages/Index.cshtml +++ b/bahnplan.web/Pages/Index.cshtml @@ -87,10 +87,10 @@
-

Add trip from oeffisear.ch

+

Add trip from oeffisear.ch or öv.ztn.sh


- +

diff --git a/bahnplan.web/Pages/OEAPI.cshtml.cs b/bahnplan.web/Pages/OEAPI.cshtml.cs index b042cb5..b267c4f 100644 --- a/bahnplan.web/Pages/OEAPI.cshtml.cs +++ b/bahnplan.web/Pages/OEAPI.cshtml.cs @@ -21,13 +21,18 @@ namespace bahnplan.web.Pages { var link = Request.Query["link"].ToString(); var shortcode = link; + var oepage = "oeffisear.ch"; if (link.Contains("oeffisear.ch")) shortcode = link.Split("/#/").Last(); + else if (link.Contains("öv.ztn.sh") || link.Contains("xn--v-0ga.ztn.sh")) { + shortcode = link.Split("/#/").Last(); + oepage = "xn--v-0ga.ztn.sh"; + } var jid = shortcode.Split("/").Last(); shortcode = shortcode.Split("/").First(); using var db = new Database.DbConn(); - var response = new WebClient().DownloadString($"https://oeffisear.ch/journeys?{{\"reqId\":\"{shortcode}\"}}"); + var response = new WebClient().DownloadString($"https://{oepage}/journeys?{{\"reqId\":\"{shortcode}\"}}"); var parsed = OeapiResponse.FromJson(response);