mirror of
https://github.com/derf/travelynx
synced 2024-11-10 06:54:17 +00:00
use bahn.expert as new domain for marudor.de
This commit is contained in:
parent
0e14df21d2
commit
dbe379a34d
7 changed files with 11 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
# This script queries the Travelynx API if you are checked into a train. If
|
# This script queries the Travelynx API if you are checked into a train. If
|
||||||
# yes, marudor.de is additionally queried for the next stop, and a JSON object
|
# yes, bahn.expert is additionally queried for the next stop, and a JSON object
|
||||||
# like this is written to stdout:
|
# like this is written to stdout:
|
||||||
# {"full_text": "RE26824, next: D\u00fcren at <span fgcolor=\"#ff0000\">15:38+5</span>, dest: Aachen Hbf at <span fgcolor=\"#ff0000\">16:07+5</span>", "markup": "pango"},
|
# {"full_text": "RE26824, next: D\u00fcren at <span fgcolor=\"#ff0000\">15:38+5</span>, dest: Aachen Hbf at <span fgcolor=\"#ff0000\">16:07+5</span>", "markup": "pango"},
|
||||||
# The script then exits.
|
# The script then exits.
|
||||||
|
@ -80,7 +80,7 @@ predicted_arrival_timestamp = j["toStation"]["realTime"]
|
||||||
delay = (predicted_arrival_timestamp - scheduled_arrival_timestamp) / 60
|
delay = (predicted_arrival_timestamp - scheduled_arrival_timestamp) / 60
|
||||||
|
|
||||||
try:
|
try:
|
||||||
details_res = requests.get(f"https://marudor.de/api/hafas/v2/details/{train}")
|
details_res = requests.get(f"https://bahn.expert/api/hafas/v2/details/{train}")
|
||||||
details = details_res.json()
|
details = details_res.json()
|
||||||
# print(json.dumps(details, sort_keys=True, indent=4), file=sys.stderr)
|
# print(json.dumps(details, sort_keys=True, indent=4), file=sys.stderr)
|
||||||
next_stop_name = details["currentStop"]["station"]["title"]
|
next_stop_name = details["currentStop"]["station"]["title"]
|
||||||
|
|
|
@ -130,7 +130,7 @@ sub startup {
|
||||||
# security and usability for websites that want to maintain user's logged-in
|
# security and usability for websites that want to maintain user's logged-in
|
||||||
# session after the user arrives from an external link". In practice,
|
# session after the user arrives from an external link". In practice,
|
||||||
# Safari (both iOS and macOS) does not send a SameSite=lax cookie when
|
# Safari (both iOS and macOS) does not send a SameSite=lax cookie when
|
||||||
# following a link from an external site. So, marudor.de providing a
|
# following a link from an external site. So, bahn.expert providing a
|
||||||
# checkin link to travelynx.de/s/whatever does not work because the user
|
# checkin link to travelynx.de/s/whatever does not work because the user
|
||||||
# is not logged in due to Safari not sending the cookie.
|
# is not logged in due to Safari not sending the cookie.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1072,7 +1072,7 @@ my @migrations = (
|
||||||
|
|
||||||
# v24 -> v25
|
# v24 -> v25
|
||||||
# travelynx 1.23 adds optional links to external services, e.g.
|
# travelynx 1.23 adds optional links to external services, e.g.
|
||||||
# DBF or marudor.de departure boards
|
# DBF or bahn.expert departure boards
|
||||||
sub {
|
sub {
|
||||||
my ($db) = @_;
|
my ($db) = @_;
|
||||||
$db->query(
|
$db->query(
|
||||||
|
|
|
@ -13,9 +13,9 @@ use DateTime;
|
||||||
my @sb_templates = (
|
my @sb_templates = (
|
||||||
undef,
|
undef,
|
||||||
[ 'DBF', 'https://dbf.finalrewind.org/{name}?rt=1#{tt}{tn}' ],
|
[ 'DBF', 'https://dbf.finalrewind.org/{name}?rt=1#{tt}{tn}' ],
|
||||||
[ 'marudor.de', 'https://marudor.de/{name}#{id}' ],
|
[ 'marudor.de', 'https://bahn.expert/{name}#{id}' ],
|
||||||
[ 'NVM', 'https://nvm.finalrewind.org/board/{eva}#{tt}{tn}' ],
|
[ 'NVM', 'https://nvm.finalrewind.org/board/{eva}#{tt}{tn}' ],
|
||||||
[ 'marudor.de/regional', 'https://marudor.de/regional/{name}#{id}' ],
|
[ 'marudor.de/regional', 'https://bahn.expert/regional/{name}#{id}' ],
|
||||||
);
|
);
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
% @wagons = reverse @wagons;
|
% @wagons = reverse @wagons;
|
||||||
% }
|
% }
|
||||||
% }
|
% }
|
||||||
<a href="https://marudor.de/details/<%= $journey->{train_type} %>%20<%= $journey->{train_no} %>/<%= DateTime->now(time_zone => 'Europe/Berlin')->iso8601 %>?station=<%= $journey->{dep_eva} %>">
|
<a href="https://bahn.expert/details/<%= $journey->{train_type} %>%20<%= $journey->{train_no} %>/<%= DateTime->now(time_zone => 'Europe/Berlin')->iso8601 %>?station=<%= $journey->{dep_eva} %>">
|
||||||
%= $direction
|
%= $direction
|
||||||
% for my $wagon (@wagons) {
|
% for my $wagon (@wagons) {
|
||||||
% if (not ($wagon->is_locomotive or $wagon->is_powercar)) {
|
% if (not ($wagon->is_locomotive or $wagon->is_powercar)) {
|
||||||
|
@ -297,7 +297,7 @@
|
||||||
% }
|
% }
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
% my $url = 'https://marudor.de/details/' . $journey->{train_type} . ' ' . $journey->{train_no} . '/' . DateTime->now(time_zone => 'Europe/Berlin')->epoch . '000';
|
% my $url = 'https://bahn.expert/details/' . $journey->{train_type} . ' ' . $journey->{train_no} . '/' . DateTime->now(time_zone => 'Europe/Berlin')->epoch . '000';
|
||||||
<a style="margin-right: 0;" href="<%= $url %>" aria-label="Zuglauf"><i class="material-icons left">timeline</i> Zuglauf</a>
|
<a style="margin-right: 0;" href="<%= $url %>" aria-label="Zuglauf"><i class="material-icons left">timeline</i> Zuglauf</a>
|
||||||
% if ($journey->{extra_data}{trip_id}) {
|
% if ($journey->{extra_data}{trip_id}) {
|
||||||
<a class="right" style="margin-right: 0;" href="https://dbf.finalrewind.org/map/<%= $journey->{extra_data}{trip_id} %>/<%= $journey->{train_line} || 0 %>?from=<%= $journey->{dep_name} %>&to=<%= $journey->{arr_name} %>&dark=<%= (session('theme') and session('theme') eq 'dark') ? 1 : 0 %>"><i class="material-icons left" aria-hidden="true">map</i> Karte</a>
|
<a class="right" style="margin-right: 0;" href="https://dbf.finalrewind.org/map/<%= $journey->{extra_data}{trip_id} %>/<%= $journey->{train_line} || 0 %>?from=<%= $journey->{dep_name} %>&to=<%= $journey->{arr_name} %>&dark=<%= (session('theme') and session('theme') eq 'dark') ? 1 : 0 %>"><i class="material-icons left" aria-hidden="true">map</i> Karte</a>
|
||||||
|
|
|
@ -151,7 +151,7 @@
|
||||||
% if ($journey->{traewelling_url}) {
|
% if ($journey->{traewelling_url}) {
|
||||||
<a style="margin-right: 0;" href="<%= $journey->{traewelling_url} %>"><i class="material-icons left">timeline</i> Träwelling</a>
|
<a style="margin-right: 0;" href="<%= $journey->{traewelling_url} %>"><i class="material-icons left">timeline</i> Träwelling</a>
|
||||||
% } else {
|
% } else {
|
||||||
% my $url = 'https://marudor.de/details/' . $journey->{train_type} . ' ' . $journey->{train_no} . '/' . DateTime->now(time_zone => 'Europe/Berlin')->epoch . '000';
|
% my $url = 'https://bahn.expert/details/' . $journey->{train_type} . ' ' . $journey->{train_no} . '/' . DateTime->now(time_zone => 'Europe/Berlin')->epoch . '000';
|
||||||
<a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left">timeline</i> Zuglauf</a>
|
<a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left">timeline</i> Zuglauf</a>
|
||||||
% }
|
% }
|
||||||
% if ($journey->{extra_data}{trip_id}) {
|
% if ($journey->{extra_data}{trip_id}) {
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
%= radio_button stationboard => '2'
|
%= radio_button stationboard => '2'
|
||||||
<span><a href="https://marudor.de/">marudor.de</a> (Schienenverkehr)</span>
|
<span><a href="https://bahn.expert/">bahn.expert</a> (Schienenverkehr)</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
%= radio_button stationboard => '4'
|
%= radio_button stationboard => '4'
|
||||||
<span><a href="https://marudor.de/regional">marudor.de/regional</a> (Nahverkehr)</span>
|
<span><a href="https://bahn.expert/regional">bahn.expert/regional</a> (Nahverkehr)</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue