first public release

This commit is contained in:
Leah 2020-02-07 14:09:42 +01:00
commit ea6fca6ed7
91 changed files with 4745 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
oeffisearch
cache
data

619
LICENSE Normal file
View file

@ -0,0 +1,619 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS

17
README.md Normal file
View file

@ -0,0 +1,17 @@
## Öffisearch
Öffisearch is a progressive web app for querying public transport information for the DB (and in the future BVG and nah.sh) networks. A hosted version of Öffisearch is available at [oeffisear.ch](https://oeffisear.ch).
This repository consists of multiple modules, which are more or less independent. The HAFAS backend `src/backend/hafas` can be used to query the HAFAS mgate.exe endpoint directly. The cache and webserver modules allow serving an HTTP API. A unique id is generated for each request, so that the data can be requested again at a later time.
### Development
- Install the nim compiler >=1.0.4 and nimble language package manager from your distribution's package repositories.
- Run `nimble run oeffisearch`
Or `nix-shell`, to set up the Öffisearch development server using the Nix package manager.
### Attribution
Thanks a lot to [Jannis Redmann](https://github.com/derhuerst/) for his work on [hafas-client](https://github.com/public-transport/hafas-client/). While Öffisearch does not use any code from hafas-client, it borrows a lot of the concepts and knowledge about the HAFAS APIs.

View file

@ -0,0 +1,84 @@
.product_selector > label {
width: 32px;
height: 32px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.product_selector > input {
display: none;
}
input[id=national] + label[for=national] {
content: url("../img/product_highspeed_grey.svg");
}
input[id=national]:checked + label[for=national] {
content: url("../img/product_highspeed_color.svg");
}
input[id=regional] + label[for=regional] {
content: url("../img/product_train_grey.svg");
}
input[id=regional]:checked + label[for=regional] {
content: url("../img/product_train_color.svg");
}
input[id=suburban] + label[for=suburban] {
content: url("../img/product_suburban_grey.svg");
}
input[id=suburban]:checked + label[for=suburban] {
content: url("../img/product_suburban_color.svg");
}
input[id=subway] + label[for=subway] {
content: url("../img/product_subway_grey.svg");
}
input[id=subway]:checked + label[for=subway] {
content: url("../img/product_subway_color.svg");
}
input[id=tram] + label[for=tram] {
content: url("../img/product_tram_grey.svg");
}
input[id=tram]:checked + label[for=tram] {
content: url("../img/product_tram_color.svg");
}
input[id=bus] + label[for=bus] {
content: url("../img/product_bus_grey.svg");
}
input[id=bus]:checked + label[for=bus] {
content: url("../img/product_bus_color.svg");
}
input[id=ferry] + label[for=ferry] {
content: url("../img/product_ferry_grey.svg");
}
input[id=ferry]:checked + label[for=ferry] {
content: url("../img/product_ferry_color.svg");
}
input[id=taxi] + label[for=taxi] {
content: url("../img/product_call_grey.svg");
}
input[id=taxi]:checked + label[for=taxi] {
content: url("../img/product_call_color.svg");
}

631
client/css/style.css Normal file
View file

@ -0,0 +1,631 @@
html, body {
margin: 0;
font-family: Roboto, Arial, sans-serif;
}
.hidden {
display: none !important;
}
* {
box-sizing: border-box;
border-collapse: collapse;
}
canvas {
flex-grow: 1;
}
table {
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
width: 100%;
}
table, tr {
background-color: #fff;
margin: 0 0 15px 0;
}
#journeysView table {
margin: 15px auto;
}
td, th {
text-align: center;
padding: 5px 3px;
overflow: hidden;
}
tr:nth-child(odd) {
background-color: #f2f2f2;
}
tbody tr {
cursor: pointer;
}
tbody tr:hover {
background-color: #ddd;
}
tbody tr:hover td {
background-color: transparent;
}
input[type="date"],
input[type="time"],
input[type="text"],
#deparr {
box-sizing: border-box;
width: 100%;
padding: .3em .5em;
border-radius: 3px;
font-size: 1.5em;
padding: 7px;
border: none;
outline: none;
box-shadow: 0 .1em .2em rgba(0, 0, 0, .5);
background-color: white;
color: black;
margin-top: 8px;
}
#datetime {
display: flex;
flex-direction: row;
}
#deparr {
padding: 0 !important;
overflow: hidden;
width: 84px;
flex-shrink: 0;
display: inline-block;
}
.switch {
position: relative;
display: inline-block;
width: 84px;
height: 100%;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #bbb;
height: 100%;
}
.slider:before {
position: absolute;
font-size: 13px;
padding-top: calc(25% - 7px);
line-height: 100%;
text-align: center;
content: "DEP";
height: 100%;
width: 42px;
background-color: white;
transition: .2s;
box-shadow: 0 .1em .2em rgba(0, 0, 0, .5);
}
input:checked + .slider:before {
content: "ARR";
transform: translateX(42px);
}
input:active,
input:focus{
box-shadow: 0 .1em .5em rgba(0, 0, 0, .6);
}
#header {
position: relative;
box-shadow: 0 0 15px rgba(0, 0, 0, .6);
background-color: #43a047;
color: white;
padding: 0 0 0 9vw;
}
#departuresView,
#settingsView,
#searchView,
#journeyView,
#journeysView {
display: flex;
flex-direction: column;
}
#journeyView tbody td:nth-child(3) {
text-align: left;
}
#journeyView tbody:not(:last-child) {
border-bottom: 1px solid rgba(0, 0, 0, .2);
}
#journeyView p {
color: white;
width: 100%;
}
#journeyView p::before {
-webkit-filter: drop-shadow( 0 0 5px rgba(0, 0, 0, .6) );
filter: drop-shadow( 0 0 5px rgba(0, 0, 0, .6) );
margin-right: 4px;
vertical-align: sub;
}
#journeyView p.change,
#journeyView p.walk,
#journeyView p.transfer {
text-shadow: 0 0 15px rgba(0, 0, 0, .6);
text-align: center;
}
#journeyView p.change::before {
content: url("../img/baseline-import_export-24px.svg");
}
#journeyView p.walk::before {
content: url("../img/baseline-directions_walk-24px.svg");
}
#journeyView p.transfer::before {
content: url("../img/baseline-directions-24px_white.svg");
}
#searchView {
background-color: rgba(67, 160, 71, 0.6);
color: white;
}
#searchView table {
width: 100%;
color: black;
}
#searchView .button,
#searchView label:not(.switch) {
cursor: pointer;
border-radius: 3px;
background-color: white;
width: 40px;
padding: 3px;
height: 40px;
display: inline-block;
margin-top: 8px;
margin-bottom: 8px;
box-shadow: 0 .1em .2em rgba(0, 0, 0, .5);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
#searchView #date {
flex-grow: 1;
margin-left: 8px;
}
#searchView .product_selector {
margin-right: auto;
}
#searchView .row {
display: flex;
flex-direction: row;
}
#searchView .swap {
margin-left: 5px;
content: url("../img/baseline-swap_vert-24px.svg");
}
#searchView .settings {
margin-left: 5px;
content: url("../img/baseline-settings-20px.svg");
}
#searchView .search {
margin-left: 5px;
content: url("../img/baseline-navigation-24px.svg");
color: blue;
}
#searchView .departures {
content: url("../img/baseline-departure_board-24px.svg");
}
#searchView .directions {
content: url("../img/baseline-directions-24px.svg");
}
#departuresView tbody td {
text-align: right;
}
#departuresView tbody td:first-child {
text-align: left;
}
.suggestionsbox {
border-radius: 3px;
width: 100%;
box-shadow: 0 .4em .8em rgba(0, 0, 0, .5);
}
.suggestions {
position: relative;
display: none;
overflow: visible;
z-index: 999;
height: 0;
}
.suggestions.typing,
.suggestions.mouseover {
display: block;
}
.loadMore {
cursor: pointer;
content: url("../img/baseline-expand_more-24px.svg");
border-radius: 100%;
height: 48px;
width: 48px;
background-color: #eee;
margin: 0 auto;
transition: box-shadow 150ms;
border: 1px solid rgba(0, 0, 0, .1);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.flipped {
transform: rotate(180deg);
}
.loadMore:hover {
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, .3);
}
.loadMore.flipped {
margin-top: 15px;
}
#settings {
background-color: rgba(67, 160, 71, 0.6);
background-color: white;
}
.suggestionsbox p {
font-size: 1.2em;
background-color: white;
color: black;
margin: 0;
border-top: 1px solid rgba(0, 0, 0, .2);
padding: .3em .6em;
cursor: pointer;
}
.back {
cursor: pointer;
position: absolute;
left: 17px;
top: 17px;
width: 32px;
height: 32px;
content: url("../img/back.svg");
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.reload {
cursor: pointer;
position: absolute;
right: 17px;
top: 17px;
width: 32px;
height: 32px;
content: url("../img/baseline-refresh-24px.svg");
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.reload.spinning {
animation: spin 2s linear infinite;
}
.btn {
position: relative;
margin: 30px auto;
padding: 0;
overflow: hidden;
border-width: 0;
outline: none;
border-radius: 2px;
background-color: #2ecc71;
color: #ecf0f1;
}
.btn:hover, .btn:focus {
background-color: #27ae60;
}
.btn > * {
position: relative;
}
.btn span {
display: block;
padding: 12px 24px;
}
.btn.orange {
background-color: #e67e22;
}
.btn.orange:hover, .btn.orange:focus {
background-color: #d35400;
}
.btn.red {
background-color: #e74c3c;
}
.btn.red:hover, .btn.red:focus {
background-color: #c0392b;
}
#spinner {
margin: calc(50vh - 60px) auto;
border: 2px solid rgba(255, 255, 255, .7); /* Light grey */
border-top: 4px solid #3498db; /* Blue */
border-radius: 50%;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#journeysView {
min-height: 100vh;
}
#journeysCanvas {
flex-grow: 1;
flex-direction: column;
display: flex;
}
#modal {
display: flex;
}
#modal-box {
margin: auto;
border-radius: 4px;
background-color: white;
width: fit-content;
width: -moz-fit-content;
padding: 15px;
box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
#dismiss {
content: 'OK';
border-radius: 4px;
background-color: rgba(20, 30, 255, .7);
box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
color: white;
width: fit-content;
width: -moz-fit-content;
padding: 8px 20px;
margin-left: auto;
margin-top: 10px;
transition: background-color 300ms;
}
#dismiss:hover {
background-color: rgba(70, 100, 255, .8);
cursor: pointer;
}
@media (max-width: 799px) {
#searchView {
padding: 10px;
}
div#settings {
padding: 15px 5vw;
}
#header {
padding: 0 0 0 50px;
}
.back {
left: 10px;
}
#datetime {
flex-wrap: wrap;
}
#searchView #date {
width: initial;
}
#searchView #time {
width: 100%;
flex-shrink: 0;
}
#searchView table {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .4);
border-radius: 5px;
overflow: hidden;
border: none;
}
}
@media (min-width: 800px) {
#searchView {
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, .4);
padding: 50px;
margin: auto;
width: 80vw;
max-width: 800px;
color: white;
}
#searchView #date {
margin-right: 8px;
}
#searchView #time {
width: 40%;
}
div#settings {
padding: 30px 30px;
margin: 0 8vw;
}
#header {
padding: 0 10vw;
}
td p {
display: inline;
margin-right: 5px;
}
td, th {
padding: 10px 5px;
}
table {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .4);
border-radius: 5px;
overflow: hidden;
border: none;
margin: 50px auto;
width: 80vw;
}
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
overflow: hidden;
-webkit-overflow-scrolling: touch;
outline: 0;
}
.modal-header {
background-color: #eee;
border-radius: 6px 6px 0px 0px;
min-height: 16.4;
padding: 15px;
border-bottom: 1px solid #e5e5e5;
}
.modal-header .close {
margin-top: -2px;
}
.modal-header .modal-close {
width:53px;
float:right;
margin:-15px;
margin-left:0px;
height:53px;
border-left: 1px solid #e5e5e5;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3goLFTUY0uFzJAAAAOpJREFUeNrtmjEWgzAMQ3Ev7TPk1HRlJMQSTvv/xoIlvZDYwHEAAAAAAAAATJOZZ2aeu9aNVRHX6zFGuMxX1Y0qEa4Qqut+XAK73jtUgqpXgqpWdBXmqtFeoDrg6LxEHaur7XPq2l/Kj6wK4c7NVXJmrxhwmpcF8NSI27w0gFlDb5iXB3DX2FvmLQGstLCO4coSwJMQXJOlLYCZEFzm7QHcCcFpXjIO7waPAJsgxyCNEK0wwxDjMC9E2ph3h8BL0a7mXSHwYaS7eXWt2MG8smb5OKzs2tr1Ab/wg0SJmJ1/kQEAAAAAAIB/5AvwavdGuXFGpAAAAABJRU5ErkJggg==') center no-repeat;
background-size:30px;
cursor:pointer;
}
.modal-header .modal-close:hover {
background-color: #e5e5e5;
border-radius: 0px 6px 0px 0px;
}
.modal-title {
margin: 0;
line-height: 1.4;
}
.modal-open {
overflow: hidden;
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto;
}
.modal-dialog {
position: relative;
width: auto;
margin: 10px;
}
.modal-content {
position: relative;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, .2);
border-radius: 6px;
outline: 0;
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
}
.modal-body {
position: relative;
padding: 15px;
}
@media (min-width: 768px) {
.modal-dialog {
width: 600px;
margin: 30px auto;
}
.modal-content {
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
}
}
.cancelled {
text-decoration-line: line-through;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

1
client/img/back.svg Normal file
View file

@ -0,0 +1 @@
<svg height="100%" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g color="white"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" fill="currentColor"></path></g></svg>

After

Width:  |  Height:  |  Size: 200 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 1H5c-1.1 0-1.99.9-1.99 2L3 15.93c0 .69.35 1.3.88 1.66L12 23l8.11-5.41c.53-.36.88-.97.88-1.66L21 3c0-1.1-.9-2-2-2zm-9 15l-5-5 1.41-1.41L10 13.17l7.59-7.59L19 7l-9 9z"/></svg>

After

Width:  |  Height:  |  Size: 306 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M16 1c-2.4 0-4.52 1.21-5.78 3.05.01-.01.01-.02.02-.03C9.84 4 9.42 4 9 4c-4.42 0-8 .5-8 4v10c0 .88.39 1.67 1 2.22V22c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h8v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1.78c.61-.55 1-1.34 1-2.22v-3.08c3.39-.49 6-3.39 6-6.92 0-3.87-3.13-7-7-7zM4.5 19c-.83 0-1.5-.67-1.5-1.5S3.67 16 4.5 16s1.5.67 1.5 1.5S5.33 19 4.5 19zM3 13V8h6c0 1.96.81 3.73 2.11 5H3zm10.5 6c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm2.5-6c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm.5-9H15v5l3.62 2.16.75-1.23-2.87-1.68z"/></svg>

After

Width:  |  Height:  |  Size: 690 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M21.71 11.29l-9-9c-.39-.39-1.02-.39-1.41 0l-9 9c-.39.39-.39 1.02 0 1.41l9 9c.39.39 1.02.39 1.41 0l9-9c.39-.38.39-1.01 0-1.41zM14 14.5V12h-4v3H8v-4c0-.55.45-1 1-1h5V7.5l3.5 3.5-3.5 3.5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 322 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path style="fill: white;" d="M21.71 11.29l-9-9c-.39-.39-1.02-.39-1.41 0l-9 9c-.39.39-.39 1.02 0 1.41l9 9c.39.39 1.02.39 1.41 0l9-9c.39-.38.39-1.01 0-1.41zM14 14.5V12h-4v3H8v-4c0-.55.45-1 1-1h5V7.5l3.5 3.5-3.5 3.5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 343 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path style="fill: white;" d="M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"/></svg>

After

Width:  |  Height:  |  Size: 370 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 182 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path style="fill: white;" d="M9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 229 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2L4.5 20.29l.71.71L12 18l6.79 3 .71-.71z"/></svg>

After

Width:  |  Height:  |  Size: 182 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 292 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path style="fill: white;" d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 361 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path fill="none" d="M0 0h20v20H0V0z"/><path d="M15.95 10.78c.03-.25.05-.51.05-.78s-.02-.53-.06-.78l1.69-1.32c.15-.12.19-.34.1-.51l-1.6-2.77c-.1-.18-.31-.24-.49-.18l-1.99.8c-.42-.32-.86-.58-1.35-.78L12 2.34c-.03-.2-.2-.34-.4-.34H8.4c-.2 0-.36.14-.39.34l-.3 2.12c-.49.2-.94.47-1.35.78l-1.99-.8c-.18-.07-.39 0-.49.18l-1.6 2.77c-.1.18-.06.39.1.51l1.69 1.32c-.04.25-.07.52-.07.78s.02.53.06.78L2.37 12.1c-.15.12-.19.34-.1.51l1.6 2.77c.1.18.31.24.49.18l1.99-.8c.42.32.86.58 1.35.78l.3 2.12c.04.2.2.34.4.34h3.2c.2 0 .37-.14.39-.34l.3-2.12c.49-.2.94-.47 1.35-.78l1.99.8c.18.07.39 0 .49-.18l1.6-2.77c.1-.18.06-.39-.1-.51l-1.67-1.32zM10 13c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"/></svg>

After

Width:  |  Height:  |  Size: 774 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 208 B

BIN
client/img/bg.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="500" width="500" xmlns="http://www.w3.org/2000/svg">
<path d="M 249.5 -0.5 C 387.571187458 -0.5 499.5 111.428812542 499.5 249.5 C 499.5 387.571187458 387.571187458 499.5 249.5 499.5 C 111.428812542 499.5 -0.5 387.571187458 -0.5 249.5 C -0.5 111.428812542 111.428812542 -0.5 249.5 -0.5 Z" fill="#a3007c"/>
<g transform="scale(0.93, 0.93)">
<path d="M178.20792 263.87558C178.20776 271.38825 176.67741 278.10092 173.61686 284.0136C170.62558 289.92634 166.48668 294.83041 161.20016 298.72583C155.07863 303.31689 148.33118 306.58627 140.9578 308.53399C133.65374 310.48171 124.36731 311.45557 113.09846 311.45557L45.276115 311.45557L45.276115 156.09022L105.58583 156.09022C118.10679 156.09037 127.2541 156.50774 133.0278 157.34232C138.87084 158.17721 144.64443 160.02059 150.34858 162.87245C156.26117 165.86374 160.64353 169.8983 163.49568 174.97613C166.41712 179.98469 167.87791 185.72349 167.87805 192.19258C167.87791 199.70532 165.89541 206.34842 161.93055 212.12191C157.96542 217.82604 152.36574 222.27796 145.13148 225.4777L145.13148 226.31243C155.28731 228.3298 163.32164 232.50348 169.2345 238.83348C175.21663 245.16364 178.20776 253.51099 178.20792 263.87558M126.87162 200.01823C126.87151 197.44458 126.21068 194.87081 124.88912 192.29692C123.63691 189.72327 121.37617 187.81033 118.10688 186.5581C115.18521 185.44525 111.53325 184.85398 107.15096 184.78429C102.83808 184.64529 96.751466 184.57573 88.891101 184.57561L85.134787 184.57561L85.134787 217.44336L91.395311 217.44336C97.725325 217.44345 103.11633 217.33911 107.56833 217.13033C112.02017 216.92174 115.53302 216.22613 118.10688 215.04349C121.72398 213.44368 124.08906 211.39162 125.20214 208.88731C126.31502 206.31364 126.87151 203.35729 126.87162 200.01823M136.67977 263.24953C136.67966 258.31072 135.7058 254.51963 133.75819 251.87624C131.87993 249.16341 128.64533 247.14613 124.05438 245.8244C120.92402 244.92017 116.61122 244.43324 111.11596 244.36361C105.62053 244.29412 99.881725 244.25934 93.899521 244.25927L85.134787 244.25927L85.134787 282.97018L88.056365 282.97018C99.325235 282.97021 107.39435 282.93543 112.26373 282.86584C117.13293 282.79631 121.61964 281.89201 125.72385 280.15294C129.89743 278.41394 132.74945 276.11842 134.2799 273.26637C135.8797 270.34483 136.67966 267.00589 136.67977 263.24953M344.11181 255.21519C344.11166 274.41417 338.26851 289.12639 326.58235 299.35189C314.89591 309.57741 297.67948 314.69017 274.93302 314.69017C252.18638 314.69017 234.96996 309.57741 223.28369 299.35189C211.66692 289.12639 205.85855 274.44895 205.85857 255.31953L205.85857 156.09022L246.13461 156.09022L246.13461 253.02401C246.13455 263.80607 248.39529 271.8404 252.91684 277.12702C257.43826 282.41372 264.77698 285.05705 274.93302 285.05702C284.94976 285.05705 292.2537 282.51806 296.84486 277.44005C301.50535 272.36211 303.83566 264.22344 303.83577 253.02401L303.83577 156.09022L344.11181 156.09022L344.11181 255.21519M506.05073 262.62348C506.05059 277.92701 499.5466 290.37849 486.53876 299.97794C473.60023 309.50785 456.00122 314.2728 433.74167 314.2728C420.87276 314.2728 409.63861 313.15982 400.03918 310.93386C390.50925 308.63833 381.57062 305.75154 373.22327 302.27346L373.22327 265.02334L377.60564 265.02334C385.88342 271.63171 395.13507 276.70969 405.36063 280.25729C415.65566 283.80494 425.53337 285.57876 434.99378 285.57873C437.42835 285.57876 440.62817 285.37007 444.59325 284.95268C448.55816 284.53534 451.79276 283.83973 454.29706 282.86584C457.35767 281.61376 459.86188 280.04863 461.80969 278.17045C463.82687 276.29232 464.83551 273.50987 464.83561 269.82308C464.83551 266.41462 463.37472 263.49304 460.45324 261.05835C457.60113 258.55419 453.39267 256.64125 447.82785 255.31953C441.98462 253.92836 435.79366 252.64148 429.25497 251.45887C422.7857 250.20683 416.69908 248.6417 410.9951 246.76348C397.91753 242.52031 388.49197 236.7815 382.7184 229.54704C377.01435 222.24318 374.16234 213.20021 374.16235 202.4181C374.16234 187.94946 380.63154 176.15881 393.56998 167.04614C406.57791 157.86419 423.27262 153.27314 443.65417 153.27298C453.8796 153.27314 463.96599 154.28178 473.91337 156.2989C483.93009 158.24678 492.59047 160.7162 499.89455 163.70719L499.89455 199.49652L495.61652 199.49652C489.35587 194.48822 481.66935 190.31454 472.55693 186.97547C463.51384 183.56709 454.26219 181.86284 444.80193 181.86271C441.46291 181.86284 438.12396 182.10631 434.78509 182.59311C431.51564 183.0106 428.3506 183.84534 425.28997 185.09732C422.57701 186.14086 420.24671 187.74077 418.29905 189.89705C416.35127 191.98401 415.37742 194.38388 415.37747 197.09665C415.37742 201.20089 416.94255 204.36593 420.07286 206.59178C423.20306 208.74829 429.11577 210.73079 437.81102 212.53928C443.51497 213.72192 448.97553 214.86968 454.19272 215.98257C459.47929 217.09565 465.14853 218.62599 471.20048 220.57362C483.09535 224.46915 491.86008 229.79059 497.49468 236.53796C503.19857 243.21592 506.05059 251.91108 506.05073 262.62348" fill="#ffffff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="500" width="500" xmlns="http://www.w3.org/2000/svg">
<path d="M 249.5 -0.5 C 387.571187458 -0.5 499.5 111.428812542 499.5 249.5 C 499.5 387.571187458 387.571187458 499.5 249.5 499.5 C 111.428812542 499.5 -0.5 387.571187458 -0.5 249.5 C -0.5 111.428812542 111.428812542 -0.5 249.5 -0.5 Z" fill="#a9a9a9"/>
<g transform="scale(0.93, 0.93)">
<path d="M178.20792 263.87558C178.20776 271.38825 176.67741 278.10092 173.61686 284.0136C170.62558 289.92634 166.48668 294.83041 161.20016 298.72583C155.07863 303.31689 148.33118 306.58627 140.9578 308.53399C133.65374 310.48171 124.36731 311.45557 113.09846 311.45557L45.276115 311.45557L45.276115 156.09022L105.58583 156.09022C118.10679 156.09037 127.2541 156.50774 133.0278 157.34232C138.87084 158.17721 144.64443 160.02059 150.34858 162.87245C156.26117 165.86374 160.64353 169.8983 163.49568 174.97613C166.41712 179.98469 167.87791 185.72349 167.87805 192.19258C167.87791 199.70532 165.89541 206.34842 161.93055 212.12191C157.96542 217.82604 152.36574 222.27796 145.13148 225.4777L145.13148 226.31243C155.28731 228.3298 163.32164 232.50348 169.2345 238.83348C175.21663 245.16364 178.20776 253.51099 178.20792 263.87558M126.87162 200.01823C126.87151 197.44458 126.21068 194.87081 124.88912 192.29692C123.63691 189.72327 121.37617 187.81033 118.10688 186.5581C115.18521 185.44525 111.53325 184.85398 107.15096 184.78429C102.83808 184.64529 96.751466 184.57573 88.891101 184.57561L85.134787 184.57561L85.134787 217.44336L91.395311 217.44336C97.725325 217.44345 103.11633 217.33911 107.56833 217.13033C112.02017 216.92174 115.53302 216.22613 118.10688 215.04349C121.72398 213.44368 124.08906 211.39162 125.20214 208.88731C126.31502 206.31364 126.87151 203.35729 126.87162 200.01823M136.67977 263.24953C136.67966 258.31072 135.7058 254.51963 133.75819 251.87624C131.87993 249.16341 128.64533 247.14613 124.05438 245.8244C120.92402 244.92017 116.61122 244.43324 111.11596 244.36361C105.62053 244.29412 99.881725 244.25934 93.899521 244.25927L85.134787 244.25927L85.134787 282.97018L88.056365 282.97018C99.325235 282.97021 107.39435 282.93543 112.26373 282.86584C117.13293 282.79631 121.61964 281.89201 125.72385 280.15294C129.89743 278.41394 132.74945 276.11842 134.2799 273.26637C135.8797 270.34483 136.67966 267.00589 136.67977 263.24953M344.11181 255.21519C344.11166 274.41417 338.26851 289.12639 326.58235 299.35189C314.89591 309.57741 297.67948 314.69017 274.93302 314.69017C252.18638 314.69017 234.96996 309.57741 223.28369 299.35189C211.66692 289.12639 205.85855 274.44895 205.85857 255.31953L205.85857 156.09022L246.13461 156.09022L246.13461 253.02401C246.13455 263.80607 248.39529 271.8404 252.91684 277.12702C257.43826 282.41372 264.77698 285.05705 274.93302 285.05702C284.94976 285.05705 292.2537 282.51806 296.84486 277.44005C301.50535 272.36211 303.83566 264.22344 303.83577 253.02401L303.83577 156.09022L344.11181 156.09022L344.11181 255.21519M506.05073 262.62348C506.05059 277.92701 499.5466 290.37849 486.53876 299.97794C473.60023 309.50785 456.00122 314.2728 433.74167 314.2728C420.87276 314.2728 409.63861 313.15982 400.03918 310.93386C390.50925 308.63833 381.57062 305.75154 373.22327 302.27346L373.22327 265.02334L377.60564 265.02334C385.88342 271.63171 395.13507 276.70969 405.36063 280.25729C415.65566 283.80494 425.53337 285.57876 434.99378 285.57873C437.42835 285.57876 440.62817 285.37007 444.59325 284.95268C448.55816 284.53534 451.79276 283.83973 454.29706 282.86584C457.35767 281.61376 459.86188 280.04863 461.80969 278.17045C463.82687 276.29232 464.83551 273.50987 464.83561 269.82308C464.83551 266.41462 463.37472 263.49304 460.45324 261.05835C457.60113 258.55419 453.39267 256.64125 447.82785 255.31953C441.98462 253.92836 435.79366 252.64148 429.25497 251.45887C422.7857 250.20683 416.69908 248.6417 410.9951 246.76348C397.91753 242.52031 388.49197 236.7815 382.7184 229.54704C377.01435 222.24318 374.16234 213.20021 374.16235 202.4181C374.16234 187.94946 380.63154 176.15881 393.56998 167.04614C406.57791 157.86419 423.27262 153.27314 443.65417 153.27298C453.8796 153.27314 463.96599 154.28178 473.91337 156.2989C483.93009 158.24678 492.59047 160.7162 499.89455 163.70719L499.89455 199.49652L495.61652 199.49652C489.35587 194.48822 481.66935 190.31454 472.55693 186.97547C463.51384 183.56709 454.26219 181.86284 444.80193 181.86271C441.46291 181.86284 438.12396 182.10631 434.78509 182.59311C431.51564 183.0106 428.3506 183.84534 425.28997 185.09732C422.57701 186.14086 420.24671 187.74077 418.29905 189.89705C416.35127 191.98401 415.37742 194.38388 415.37747 197.09665C415.37742 201.20089 416.94255 204.36593 420.07286 206.59178C423.20306 208.74829 429.11577 210.73079 437.81102 212.53928C443.51497 213.72192 448.97553 214.86968 454.19272 215.98257C459.47929 217.09565 465.14853 218.62599 471.20048 220.57362C483.09535 224.46915 491.86008 229.79059 497.49468 236.53796C503.19857 243.21592 506.05059 251.91108 506.05073 262.62348" fill="#ffffff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="500" width="500" xmlns="http://www.w3.org/2000/svg">
<path d="M 249.5 -0.5 C 387.571187458 -0.5 499.5 111.428812542 499.5 249.5 C 499.5 387.571187458 387.571187458 499.5 249.5 499.5 C 111.428812542 499.5 -0.5 387.571187458 -0.5 249.5 C -0.5 111.428812542 111.428812542 -0.5 249.5 -0.5 Z" fill="#a3007c"/>
<g transform="translate(45, 45) scale(17, 17)">
<path d="M 20 15.5 c -1.25 0 -2.45 -.2 -3.57 -.57 -.35 -.11 -.74 -.03 -1.02 .24 l -2.2 2.2 c -2.83 -1.44 -5.15 -3.75 -6.59 -6.58 l 2.2 -2.21 c .28 -.27 .36 -.66 .25 -1.01 C 8.7 6.45 8.5 5.25 8.5 4 c 0 -.55 -.45 -1 -1 -1 H 4 c -.55 0 -1 .45 -1 1 0 9.39 7.61 17 17 17 .55 0 1 -.45 1 -1 v -3.5 c 0 -.55 -.45 -1 -1 -1 z" fill="#ffffff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 847 B

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="500" width="500" xmlns="http://www.w3.org/2000/svg">
<path d="M 249.5 -0.5 C 387.571187458 -0.5 499.5 111.428812542 499.5 249.5 C 499.5 387.571187458 387.571187458 499.5 249.5 499.5 C 111.428812542 499.5 -0.5 387.571187458 -0.5 249.5 C -0.5 111.428812542 111.428812542 -0.5 249.5 -0.5 Z" fill="#a9a9a9"/>
<g transform="translate(45, 45) scale(17, 17)">
<path d="M 20 15.5 c -1.25 0 -2.45 -.2 -3.57 -.57 -.35 -.11 -.74 -.03 -1.02 .24 l -2.2 2.2 c -2.83 -1.44 -5.15 -3.75 -6.59 -6.58 l 2.2 -2.21 c .28 -.27 .36 -.66 .25 -1.01 C 8.7 6.45 8.5 5.25 8.5 4 c 0 -.55 -.45 -1 -1 -1 H 4 c -.55 0 -1 .45 -1 1 0 9.39 7.61 17 17 17 .55 0 1 -.45 1 -1 v -3.5 c 0 -.55 -.45 -1 -1 -1 z" fill="#ffffff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 847 B

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="500" width="500" xmlns="http://www.w3.org/2000/svg">
<path d="M 249.5 -0.5 C 387.571187458 -0.5 499.5 111.428812542 499.5 249.5 C 499.5 387.571187458 387.571187458 499.5 249.5 499.5 C 111.428812542 499.5 -0.5 387.571187458 -0.5 249.5 C -0.5 111.428812542 111.428812542 -0.5 249.5 -0.5 Z" fill="#ffffff"/>
<g transform="translate(-124, -282.36217)">
<path d="M 530.96544,727.09056 C 518.61233,731.51828 424.32729,729.55598 371.47722,713.67181 C 242.6438,674.95072 188.03985,698.09969 188.71925,698.44999 C 234.50268,749.59823 301.00643,781.86217 375.00001,781.86217 C 433.98426,781.86217 488.2424,761.35276 530.96544,727.09056 z M 553.7215,706.36522 C 506.77439,716.60935 450.5039,712.13823 401.70643,703.18706 C 354.10678,691.99951 300.55231,671.99455 270.35714,674.50504 L 298.92857,540.21932 L 467.14285,540.21932 L 478.92857,480.93318 L 311.07143,480.93318 L 328.21428,397.36218 L 500.71428,397.36218 L 511.42857,339.50504 L 270,339.50504 L 199.28571,673.07647 C 177.5,676.64789 174.84375,681.51396 174.76786,681.49928 C 143.87047,639.76479 125.49999,588.19576 125.49999,532.36218 C 125.49999,394.63817 237.276,282.86218 375.00001,282.86218 C 512.72399,282.86218 624.5,394.63817 624.5,532.36218 C 624.5,600.02229 597.49914,661.40668 553.7215,706.36522 z" fill="#0080c0" stroke-width="1"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="500" width="500" xmlns="http://www.w3.org/2000/svg">
<path d="M 249.5 -0.5 C 387.571187458 -0.5 499.5 111.428812542 499.5 249.5 C 499.5 387.571187458 387.571187458 499.5 249.5 499.5 C 111.428812542 499.5 -0.5 387.571187458 -0.5 249.5 C -0.5 111.428812542 111.428812542 -0.5 249.5 -0.5 Z" fill="#ffffff"/>
<g transform="translate(-124, -282.36217)">
<path d="M 530.96544,727.09056 C 518.61233,731.51828 424.32729,729.55598 371.47722,713.67181 C 242.6438,674.95072 188.03985,698.09969 188.71925,698.44999 C 234.50268,749.59823 301.00643,781.86217 375.00001,781.86217 C 433.98426,781.86217 488.2424,761.35276 530.96544,727.09056 z M 553.7215,706.36522 C 506.77439,716.60935 450.5039,712.13823 401.70643,703.18706 C 354.10678,691.99951 300.55231,671.99455 270.35714,674.50504 L 298.92857,540.21932 L 467.14285,540.21932 L 478.92857,480.93318 L 311.07143,480.93318 L 328.21428,397.36218 L 500.71428,397.36218 L 511.42857,339.50504 L 270,339.50504 L 199.28571,673.07647 C 177.5,676.64789 174.84375,681.51396 174.76786,681.49928 C 143.87047,639.76479 125.49999,588.19576 125.49999,532.36218 C 125.49999,394.63817 237.276,282.86218 375.00001,282.86218 C 512.72399,282.86218 624.5,394.63817 624.5,532.36218 C 624.5,600.02229 597.49914,661.40668 553.7215,706.36522 z" fill="#a9a9a9" stroke-width="1"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="2200" width="2200" xmlns="http://www.w3.org/2000/svg">
<g android:pivotX="1100" android:pivotY="1100" transform="scale(0.93, 0.93)">
<path d="M0,2200L2200,2200L2200,0l-2200,0Z" fill="#ff0000"/>
<path d="M270,1203.2c0,0,-6.8,8.3,-20,24.5c-13.2,16.2,-20,24.5,-20,24.5l-47.6,60.3c0,0,-5.9,9,-17.3,26.4c-11.4,17.4,-17.3,26.3,-17.3,26.3l-58.3,108.2c0,0,-2.6,10.1,-7.6,29.8c-5,19.6,-7.6,29.7,-7.6,29.7l-0.7,87c0,0,2.4,10.2,6.9,30c4.5,19.8,6.8,30,6.8,30l7.5,15.2c0,0,6.5,8.2,19.1,24.3c12.6,16,19.1,24.3,19.1,24.3l31.3,26c0,0,8.5,5.9,24.9,17.3c16.4,11.3,24.9,17.2,24.9,17.2l1.1,0.6c0,0,9.4,3.9,27.8,11.6c18.4,7.6,27.9,11.6,27.9,11.6l49.4,13.6c0,0,10.6,1.9,31.1,5.4c20.4,3.5,31,5.3,31,5.3l36.8,2.6c0,0,10.8,0.4,31.6,1.3c20.9,0.8,31.7,1.3,31.7,1.3l1725.6,19.3l-2,-1640.9l-585.4,0.9c0,0,-10.7,0.5,-31.5,1.6c-20.9,1.1,-31.6,1.6,-31.6,1.6l-196.4,20c0,0,-10.4,2.3,-30.7,6.8c-20.3,4.4,-30.7,6.7,-30.7,6.7l-111.3,38.2c0,0,-9.8,4.4,-28.7,13c-18.9,8.6,-28.7,13,-28.7,13l-62.7,36c0,0,-8.8,6.2,-25.9,18c-17.1,11.9,-25.9,18,-25.9,18L936.1,528.9c0,0,-7.8,7.4,-23,21.6c-15.2,14.3,-23,21.6,-23,21.6L675.9,799c0,0,-7.2,8,-21.1,23.6c-13.9,15.6,-21,23.6,-21,23.6Z" fill="#ffffff"/>
<path d="M528.4,1342.5l-0.9,-1.3l-1.1,-1.2l-1,-1.2l-1.1,-1.1l-1.2,-1.2l-1.2,-1.1l-1.2,-1.2l-1.3,-1.1l-1.3,-1.1l-1.4,-1l-1.4,-1.1l-1.4,-1l-1.5,-1.1l-1.5,-1l-1.6,-0.9l-1.6,-1l-1.6,-0.9l-1.7,-0.9l-1.7,-0.9l-1.8,-0.9l-1.8,-0.9l-1.8,-0.8l-1.9,-0.8l-1.9,-0.8l-1.9,-0.8l-1.9,-0.7l-2,-0.7l-2.1,-0.7l-2,-0.7l-2.1,-0.6l-2.1,-0.6l-2.1,-0.6l-2.2,-0.6l-2.2,-0.5l-2.2,-0.6l-2.3,-0.5l-2.2,-0.4l-2.3,-0.5l-2.4,-0.4l-2.3,-0.4l-2.3,-0.3l-2.4,-0.4l-2.4,-0.3l-2.4,-0.3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5l1.6,4.5l1.8,4.5l1.8,4.4l1.9,4.4l2,4.4l2.1,4.3l2.1,4.2l2.3,4.3l2.3,4.2l2.4,4.1l2.4,4.1l2.6,4.1l2.6,4l2.7,3.9l2.8,3.9l2.8,3.9l2.9,3.8l3,3.7l3.1,3.7l3.1,3.6l3.2,3.6l3.3,3.5l3.3,3.4l3.4,3.4l3.5,3.3l3.5,3.2l3.5,3.2l3.7,3.1l3.7,3.1l3.7,2.9l3.8,2.9l3.9,2.9l3.9,2.7l4,2.7l4,2.6l4.1,2.5l4.1,2.5l4.1,2.3l4.2,2.3l4.3,2.3l4.2,2.1l4.4,2l4.3,2l4.4,1.9l4.5,1.8l4.4,1.7l4.5,1.7l4.5,1.5l4.6,1.5l4.6,1.4l4.6,1.3l4.6,1.2l4.7,1.1l4.6,1l4.7,1l4.7,0.8l4.8,0.8l4.7,0.6l4.8,0.6l4.7,0.5l4.8,0.4l4.8,0.3l4.7,0.3l4.8,0.1l4.8,0.1Z" fill="#ffffff" stroke="#ffffff" stroke-width="44"/>
<path d="M 1142,1168 L 2200,1162.3 l 0,-500.9 L 2013,677.3 c 0,0,-10.6,1.4,-31.2,4.1c-20.7,2.8,-31.3,4.2,-31.3,4.2l-142.2,31.2c0,0,-10.2,3.4,-29.9,9.9c-19.7,6.6,-29.8,9.9,-29.8,9.9L1499.4,849.5c0,0,-9,5.6,-26.6,16.6c-17.6,10.9,-26.6,16.5,-26.6,16.5l-182.9,150.8c0,0,-7.6,7.6,-22.4,22.2c-14.8,14.6,-22.4,22.1,-22.4,22.1Z" fill="#ff0000"/>
<path d="M 933.6,1457.5 L 2200,1469.1 L 2200,1333 l -1293.9,0 Z" fill="#ff0000"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="2200" width="2200" xmlns="http://www.w3.org/2000/svg">
<g android:pivotX="1100" android:pivotY="1100" transform="scale(0.93, 0.93)">
<path d="M0,2200L2200,2200L2200,0l-2200,0Z" fill="#a9a9a9"/>
<path d="M270,1203.2c0,0,-6.8,8.3,-20,24.5c-13.2,16.2,-20,24.5,-20,24.5l-47.6,60.3c0,0,-5.9,9,-17.3,26.4c-11.4,17.4,-17.3,26.3,-17.3,26.3l-58.3,108.2c0,0,-2.6,10.1,-7.6,29.8c-5,19.6,-7.6,29.7,-7.6,29.7l-0.7,87c0,0,2.4,10.2,6.9,30c4.5,19.8,6.8,30,6.8,30l7.5,15.2c0,0,6.5,8.2,19.1,24.3c12.6,16,19.1,24.3,19.1,24.3l31.3,26c0,0,8.5,5.9,24.9,17.3c16.4,11.3,24.9,17.2,24.9,17.2l1.1,0.6c0,0,9.4,3.9,27.8,11.6c18.4,7.6,27.9,11.6,27.9,11.6l49.4,13.6c0,0,10.6,1.9,31.1,5.4c20.4,3.5,31,5.3,31,5.3l36.8,2.6c0,0,10.8,0.4,31.6,1.3c20.9,0.8,31.7,1.3,31.7,1.3l1725.6,19.3l-2,-1640.9l-585.4,0.9c0,0,-10.7,0.5,-31.5,1.6c-20.9,1.1,-31.6,1.6,-31.6,1.6l-196.4,20c0,0,-10.4,2.3,-30.7,6.8c-20.3,4.4,-30.7,6.7,-30.7,6.7l-111.3,38.2c0,0,-9.8,4.4,-28.7,13c-18.9,8.6,-28.7,13,-28.7,13l-62.7,36c0,0,-8.8,6.2,-25.9,18c-17.1,11.9,-25.9,18,-25.9,18L936.1,528.9c0,0,-7.8,7.4,-23,21.6c-15.2,14.3,-23,21.6,-23,21.6L675.9,799c0,0,-7.2,8,-21.1,23.6c-13.9,15.6,-21,23.6,-21,23.6Z" fill="#ffffff"/>
<path d="M528.4,1342.5l-0.9,-1.3l-1.1,-1.2l-1,-1.2l-1.1,-1.1l-1.2,-1.2l-1.2,-1.1l-1.2,-1.2l-1.3,-1.1l-1.3,-1.1l-1.4,-1l-1.4,-1.1l-1.4,-1l-1.5,-1.1l-1.5,-1l-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16.5,-26.6,16.5l-182.9,150.8c0,0,-7.6,7.6,-22.4,22.2c-14.8,14.6,-22.4,22.1,-22.4,22.1Z" fill="#a9a9a9"/>
<path d="M 933.6,1457.5 L 2200,1469.1 L 2200,1333 l -1293.9,0 Z" fill="#a9a9a9"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="353" width="353" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(-12, -12) scale(1.07, 1.07)">
<path d="M175.4,341.586c-91.5,0-165.899-74.399-165.899-165.9c0-91.5,74.399-165.9,165.899-165.9 c91.501,0,165.901,74.4,165.901,165.9C341.303,267.187,266.901,341.586,175.4,341.586z" fill="#006f35"/>
<path d="M133.4,102.186c0-14.4,13.2-26.7,36.301-26.7c40.8,0,75.6,21.9,98.7,46.8v-43.5 c-26.7-20.7-60.301-33-97.801-33c-45,0-95.1,27.601-95.1,78.9c0,97.801,148.5,62.701,148.5,119.4c0,15-19.799,29.101-44.399,29.101 c-40.2,0-80.1-24.3-102-55.8v52.199c23.1,20.7,65.4,37.2,102,37.2c65.7,0,104.701-46.801,104.701-87.001 C284.303,120.186,133.4,162.784,133.4,102.186z" fill="#ffffff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 845 B

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="353" width="353" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(-12, -12) scale(1.07, 1.07)">
<path d="M175.4,341.586c-91.5,0-165.899-74.399-165.899-165.9c0-91.5,74.399-165.9,165.899-165.9 c91.501,0,165.901,74.4,165.901,165.9C341.303,267.187,266.901,341.586,175.4,341.586z" fill="#a9a9a9"/>
<path d="M133.4,102.186c0-14.4,13.2-26.7,36.301-26.7c40.8,0,75.6,21.9,98.7,46.8v-43.5 c-26.7-20.7-60.301-33-97.801-33c-45,0-95.1,27.601-95.1,78.9c0,97.801,148.5,62.701,148.5,119.4c0,15-19.799,29.101-44.399,29.101 c-40.2,0-80.1-24.3-102-55.8v52.199c23.1,20.7,65.4,37.2,102,37.2c65.7,0,104.701-46.801,104.701-87.001 C284.303,120.186,133.4,162.784,133.4,102.186z" fill="#ffffff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 845 B

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="378.32739" width="377.93851" xmlns="http://www.w3.org/2000/svg">
<g android:pivotX="189" android:pivotY="189" transform="scale(0.93, 0.93)">
<g transform="translate(-161.03075, -343.19849)">
<path d="M 161.03075,721.52588 L 538.96925,721.52588 L 538.96925,343.19849 L 161.03075,343.19849 L 161.03075,721.52588 z" fill="#156ab8"/>
<path d="M 477.26972,373.06996 L 477.26972,577.95324 C 477.26972,663.70307 407.03895,695.1301 349.60504,695.1301 C 291.79439,695.1301 222.73028,663.70307 222.73028,577.95324 L 222.73028,373.06996 L 297.22667,373.06996 L 297.22667,570.57652 C 297.22667,606.6702 310.03567,632.27605 349.60504,632.27605 C 388.79767,632.27605 401.60667,606.6702 401.60667,570.57652 L 401.60667,373.06996 L 477.26972,373.06996" fill="#ffffff"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 946 B

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="378.32739" width="377.93851" xmlns="http://www.w3.org/2000/svg">
<g android:pivotX="189" android:pivotY="189" transform="scale(0.93, 0.93)">
<g transform="translate(-161.03075, -343.19849)">
<path d="M 161.03075,721.52588 L 538.96925,721.52588 L 538.96925,343.19849 L 161.03075,343.19849 L 161.03075,721.52588 z" fill="#a9a9a9"/>
<path d="M 477.26972,373.06996 L 477.26972,577.95324 C 477.26972,663.70307 407.03895,695.1301 349.60504,695.1301 C 291.79439,695.1301 222.73028,663.70307 222.73028,577.95324 L 222.73028,373.06996 L 297.22667,373.06996 L 297.22667,570.57652 C 297.22667,606.6702 310.03567,632.27605 349.60504,632.27605 C 388.79767,632.27605 401.60667,606.6702 401.60667,570.57652 L 401.60667,373.06996 L 477.26972,373.06996" fill="#ffffff"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 946 B

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="173.43799" width="173.45215" xmlns="http://www.w3.org/2000/svg">
<path d="M 0,86.71875 C 0,38.82764 38.83301,0 86.71924,0 C 134.61914,0 173.45215,38.82764 173.45215,86.71875 C 173.45215,134.61914 134.61914,173.43799 86.71924,173.43799 C 38.83301,173.43799 0,134.61914 0,86.71875 z" fill="#444444"/>
<path d="M 74.12256,41.30908 C 76.16358,40.76172 80.04053,40.38086 86.14356,40.38086 C 99.24952,40.38086 106.83252,46.66065 106.83252,58.68164 C 106.83252,69.94189 98.5127,77.52002 84.64941,77.52002 L 74.12256,77.52002 L 74.12256,41.30908 z M 48.44385,146.25977 L 74.12256,146.25977 L 74.12256,96.54785 L 82.62354,96.54785 C 94.0835,96.54785 99.24952,101.18164 102.58448,117.0708 C 105.91456,132.22217 108.87354,142.74902 110.70948,146.25976 L 137.31055,146.25976 C 134.92383,141.45996 131.4126,125.93798 127.71143,111.51904 C 124.75245,99.51172 119.7627,91.20166 111.09034,87.68066 L 111.09034,87.31982 C 122.35938,83.07177 132.70167,71.80175 132.70167,56.45996 C 132.70167,45.19092 129.01075,36.68017 121.81251,30.59082 C 113.11183,23.56982 100.55372,20.80078 83.17042,20.80078 C 69.69386,20.80078 57.12062,21.90967 48.44386,23.3789 L 48.44386,146.25977 L 48.44385,146.25977 z" fill="#ffffff"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="173.43799" width="173.45215" xmlns="http://www.w3.org/2000/svg">
<path d="M 0,86.71875 C 0,38.82764 38.83301,0 86.71924,0 C 134.61914,0 173.45215,38.82764 173.45215,86.71875 C 173.45215,134.61914 134.61914,173.43799 86.71924,173.43799 C 38.83301,173.43799 0,134.61914 0,86.71875 z" fill="#a9a9a9"/>
<path d="M 74.12256,41.30908 C 76.16358,40.76172 80.04053,40.38086 86.14356,40.38086 C 99.24952,40.38086 106.83252,46.66065 106.83252,58.68164 C 106.83252,69.94189 98.5127,77.52002 84.64941,77.52002 L 74.12256,77.52002 L 74.12256,41.30908 z M 48.44385,146.25977 L 74.12256,146.25977 L 74.12256,96.54785 L 82.62354,96.54785 C 94.0835,96.54785 99.24952,101.18164 102.58448,117.0708 C 105.91456,132.22217 108.87354,142.74902 110.70948,146.25976 L 137.31055,146.25976 C 134.92383,141.45996 131.4126,125.93798 127.71143,111.51904 C 124.75245,99.51172 119.7627,91.20166 111.09034,87.68066 L 111.09034,87.31982 C 122.35938,83.07177 132.70167,71.80175 132.70167,56.45996 C 132.70167,45.19092 129.01075,36.68017 121.81251,30.59082 C 113.11183,23.56982 100.55372,20.80078 83.17042,20.80078 C 69.69386,20.80078 57.12062,21.90967 48.44386,23.3789 L 48.44386,146.25977 L 48.44385,146.25977 z" fill="#ffffff"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="500" width="500" xmlns="http://www.w3.org/2000/svg">
<g android:pivotX="250" android:pivotY="250" transform="scale(0.93, 0.93)">
<path d="M 0 0 H 500 V 500 H 0 V 0 Z" fill="#cc0000"/>
<path d="M236.84211 309.54433C242.87491 307.23053 246.2628 304.71845 250.26316 299.59283L252.63158 296.55819L252.64317 299.59488C252.64954 301.26506 252.94836 304.40789 253.30721 306.57895L253.95966 310.52632L269.61141 310.52632L285.26316 310.52632L285.26316 269.13842C285.26316 223.28869 284.96553 220.73711 278.65722 212.50687C274.36993 206.91337 266.64305 201.57325 259.63885 199.36309C248.03721 195.70221 220.94597 196.55513 205 201.08328L201.05263 202.20422L201.05263 214.69104L201.05263 227.17787L206.57895 225.59944C209.67357 224.71556 218.58978 223.78563 226.84211 223.48608C241.06839 222.96968 241.70605 223.03788 245.24782 225.45454C249.67142 228.47291 251.54267 231.87779 251.56343 236.94633L251.57895 240.73476L238.15789 241.36913C218.14543 242.31505 206.23052 246.05151 198.21906 253.89371C191.52335 260.44798 189.12683 266.95753 189.18925 278.42105C189.25907 291.24387 191.88315 298.18559 199.12019 304.69232C202.04511 307.32206 204.74225 309.49459 205.11384 309.52014C205.48544 309.54569 208.15789 310.25471 211.05263 311.09573C217.94161 313.0972 229.37134 312.40963 236.84211 309.54433 zM227.74009 288.56112C223.69319 286.01706 221.66013 280.46752 222.393 273.96545C223.45626 264.5322 229.63667 260.15049 243.18928 259.22158L251.57895 258.64654L251.57895 267.52128C251.57895 281.84023 246.49055 289.31224 236.13104 290.20558C232.33376 290.53303 230.21698 290.11819 227.74009 288.56112 zM94.736842 247.36842L94.736842 184.21053L113.15789 184.21053L131.57895 184.21053L131.57895 168.94737L131.57895 153.68421L75.263158 153.68421L18.947368 153.68421L18.947368 168.94737L18.947368 184.21053L35.789474 184.21053L52.631579 184.21053L52.631579 247.36842L52.631579 310.52632L73.684211 310.52632L94.736842 310.52632L94.736842 247.36842 zM156.84211 284.40385C156.84211 256.11702 157.73126 248.16673 161.65084 241.4074C165.60996 234.57986 170.26548 232.29012 181.25655 231.76462L190.52632 231.32143L190.52632 213.93641L190.52632 196.55138L183.82933 197.23751C173.52437 198.29328 168.06611 200.58661 163.14078 205.92997C160.74684 208.52707 157.90967 212.61417 156.83596 215.01241C155.02281 219.0622 154.84484 219.18895 154.33781 216.79167C154.03756 215.37204 153.49313 211.01316 153.12796 207.10526L152.46401 200L135.70569 200L118.94737 200L118.94737 255.26316L118.94737 310.52632L137.89474 310.52632L156.84211 310.52632L156.84211 284.40385 zM344.21053 276.80829C344.21053 241.15109 344.51344 238.59935 349.24671 234.38447C351.70355 232.19671 358.52479 230.98046 362.60065 232.00344C364.10095 232.37999 366.25937 234.21484 367.39714 236.08088C369.34552 239.27638 369.46604 241.53967 369.46975 275L369.47368 310.52632L387.89474 310.52632L406.31579 310.52632L406.33891 277.10526C406.36004 246.55078 406.53352 243.30648 408.36145 239.28034C411.85313 231.58967 422.05512 228.92157 428.0992 234.11836L431.05263 236.65777L431.35465 273.59204L431.65666 310.52632L450.61805 310.52632L469.57943 310.52632L469.26006 266.05263C468.94942 222.7942 468.87746 221.44319 466.62669 216.61084C463.3302 209.53337 456.65885 202.74525 450.239 199.93633C443.09997 196.81274 429.50151 196.52125 421.34712 199.31703C415.5562 201.30247 406.78328 208.35064 404.27935 213.02929L402.81111 215.77274L399.41978 210.73689C389.35103 195.78567 366.63977 192.73674 350.57059 204.179C348.90903 205.36214 346.3246 208.78835 344.82742 211.79281L342.10526 217.25546L342.10526 208.62773L342.10526 200L324.21053 200L306.31579 200L306.31579 255.26316L306.31579 310.52632L325.26316 310.52632L344.21053 310.52632L344.21053 276.80829 z" fill="#ffffff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><svg xmlns:android="http://schemas.android.com/apk/res/android" height="500" width="500" xmlns="http://www.w3.org/2000/svg">
<g android:pivotX="250" android:pivotY="250" transform="scale(0.93, 0.93)">
<path d="M 0 0 H 500 V 500 H 0 V 0 Z" fill="#a9a9a9"/>
<path d="M236.84211 309.54433C242.87491 307.23053 246.2628 304.71845 250.26316 299.59283L252.63158 296.55819L252.64317 299.59488C252.64954 301.26506 252.94836 304.40789 253.30721 306.57895L253.95966 310.52632L269.61141 310.52632L285.26316 310.52632L285.26316 269.13842C285.26316 223.28869 284.96553 220.73711 278.65722 212.50687C274.36993 206.91337 266.64305 201.57325 259.63885 199.36309C248.03721 195.70221 220.94597 196.55513 205 201.08328L201.05263 202.20422L201.05263 214.69104L201.05263 227.17787L206.57895 225.59944C209.67357 224.71556 218.58978 223.78563 226.84211 223.48608C241.06839 222.96968 241.70605 223.03788 245.24782 225.45454C249.67142 228.47291 251.54267 231.87779 251.56343 236.94633L251.57895 240.73476L238.15789 241.36913C218.14543 242.31505 206.23052 246.05151 198.21906 253.89371C191.52335 260.44798 189.12683 266.95753 189.18925 278.42105C189.25907 291.24387 191.88315 298.18559 199.12019 304.69232C202.04511 307.32206 204.74225 309.49459 205.11384 309.52014C205.48544 309.54569 208.15789 310.25471 211.05263 311.09573C217.94161 313.0972 229.37134 312.40963 236.84211 309.54433 zM227.74009 288.56112C223.69319 286.01706 221.66013 280.46752 222.393 273.96545C223.45626 264.5322 229.63667 260.15049 243.18928 259.22158L251.57895 258.64654L251.57895 267.52128C251.57895 281.84023 246.49055 289.31224 236.13104 290.20558C232.33376 290.53303 230.21698 290.11819 227.74009 288.56112 zM94.736842 247.36842L94.736842 184.21053L113.15789 184.21053L131.57895 184.21053L131.57895 168.94737L131.57895 153.68421L75.263158 153.68421L18.947368 153.68421L18.947368 168.94737L18.947368 184.21053L35.789474 184.21053L52.631579 184.21053L52.631579 247.36842L52.631579 310.52632L73.684211 310.52632L94.736842 310.52632L94.736842 247.36842 zM156.84211 284.40385C156.84211 256.11702 157.73126 248.16673 161.65084 241.4074C165.60996 234.57986 170.26548 232.29012 181.25655 231.76462L190.52632 231.32143L190.52632 213.93641L190.52632 196.55138L183.82933 197.23751C173.52437 198.29328 168.06611 200.58661 163.14078 205.92997C160.74684 208.52707 157.90967 212.61417 156.83596 215.01241C155.02281 219.0622 154.84484 219.18895 154.33781 216.79167C154.03756 215.37204 153.49313 211.01316 153.12796 207.10526L152.46401 200L135.70569 200L118.94737 200L118.94737 255.26316L118.94737 310.52632L137.89474 310.52632L156.84211 310.52632L156.84211 284.40385 zM344.21053 276.80829C344.21053 241.15109 344.51344 238.59935 349.24671 234.38447C351.70355 232.19671 358.52479 230.98046 362.60065 232.00344C364.10095 232.37999 366.25937 234.21484 367.39714 236.08088C369.34552 239.27638 369.46604 241.53967 369.46975 275L369.47368 310.52632L387.89474 310.52632L406.31579 310.52632L406.33891 277.10526C406.36004 246.55078 406.53352 243.30648 408.36145 239.28034C411.85313 231.58967 422.05512 228.92157 428.0992 234.11836L431.05263 236.65777L431.35465 273.59204L431.65666 310.52632L450.61805 310.52632L469.57943 310.52632L469.26006 266.05263C468.94942 222.7942 468.87746 221.44319 466.62669 216.61084C463.3302 209.53337 456.65885 202.74525 450.239 199.93633C443.09997 196.81274 429.50151 196.52125 421.34712 199.31703C415.5562 201.30247 406.78328 208.35064 404.27935 213.02929L402.81111 215.77274L399.41978 210.73689C389.35103 195.78567 366.63977 192.73674 350.57059 204.179C348.90903 205.36214 346.3246 208.78835 344.82742 211.79281L342.10526 217.25546L342.10526 208.62773L342.10526 200L324.21053 200L306.31579 200L306.31579 255.26316L306.31579 310.52632L325.26316 310.52632L344.21053 310.52632L344.21053 276.80829 z" fill="#ffffff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

90
client/index.html Normal file
View file

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="de">
<head>
<title>oeffisear.ch BETA</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#ffffff">
<meta name="description" content="Plan your public transport journeys">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Öffisearch">
<meta name="format-detection" content="telephone=no">
<link rel="apple-touch-startup-image" sizes="512x512" href="img/favicon-512x512.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="64x64" href="img/favicon-64x64.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png">
<link rel="mask-icon" href="img/safari-pinned-tab.svg" color="#s">
<link rel="stylesheet" type="text/css" href="css/product_selector.css" defer>
<link rel="stylesheet" type="text/css" href="css/style.css" defer>
<link rel="modulepreload" href="js/api.js">
<link rel="modulepreload" href="js/sprintf.min.js">
<link rel="modulepreload" href="js/languages.js">
<link rel="modulepreload" href="js/app_functions.js">
<link rel="modulepreload" href="js/canvas.js">
<link rel="modulepreload" href="js/helpers.js">
<link rel="modulepreload" href="js/journeysView.js">
<link rel="modulepreload" href="js/journeyView.js">
<link rel="modulepreload" href="js/lit-html.js">
<link rel="modulepreload" href="js/overlays.js">
<link rel="modulepreload" href="js/router.js">
<link rel="modulepreload" href="js/searchView.js">
<link rel="manifest" href="manifest.json">
<style>
body {
background-image: url("img/bg.webp");
background-size: cover;
background-attachment: fixed;
min-height: 100vh;
overflow-x: hidden;
overflow-y: visible;
}
#overlay {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
background-color: rgba(0, 0, 0, .7);
overflow: hidden;
display: flex;
}
#overlay>* {
margin: auto;
}
#logo {
background-color: #7171e5;
border-radius: 15%;
width: 50vmin;
height: 50vmin;
}
#logo>svg {
width: 75%;
height: 75%;
margin: 12.5%;
fill: white;
}
</style>
</head>
<body>
<div id="content"></div>
<div id="overlay">
<noscript>JavaScript is required to use Öffisearch</noscript>
<div id="logo">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2c-4 0-8 .5-8 4v9.5C4 17.43 5.57 19 7.5 19L6 20.5v.5h2.23l2-2H14l2 2h2v-.5L16.5 19c1.93 0 3.5-1.57 3.5-3.5V6c0-3.5-3.58-4-8-4zM7.5 17c-.83 0-1.5-.67-1.5-1.5S6.67 14 7.5 14s1.5.67 1.5 1.5S8.33 17 7.5 17zm3.5-7H6V6h5v4zm2 0V6h5v4h-5zm3.5 7c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/><path fill="none" d="M0 0h24v24H0V0z"/></svg>
</div>
</div>
</body>
<script type="module" src="js/app.js"></script>
</html>

41
client/js/api.js Normal file
View file

@ -0,0 +1,41 @@
'use strict';
import { showDiv, hideDiv } from './helpers.js';
import { ConsoleLog } from './app_functions.js';
import { showAlertModal, showLoader, hideLoader } from './overlays.js';
const api_base = '';
const errorMessages = {
'': 'Unbekannter Fehler',
'REQUEST_NOT_FOUND': 'Ungültige Reise',
'JOURNEY_NOT_FOUND': 'Verbindung nicht verfügbar',
'TRY_AGAIN_LATER': 'Versuche es zu einem späteren Zeitpunkt erneut',
'MISSING_VALUES': 'Benötigte Felder nicht ausgefüllt',
'INVALID_DATE': 'Ungültiges Datum',
'UNKNOWN_FROM': 'Unbekannter Abfahrtspunkt',
'UNKNOWN_TO': 'Unbekannter Ankunftspunkt',
'TOO_CLOSE': 'Abfahrts- und Ankunftspunkt zu nah',
'NO_TRIPS': 'Keine Verbindungen gefunden',
};
export const get = async (endpoint, params, noLoader) => {
if (!noLoader) showLoader();
let data;
try {
data = await fetch(api_base+endpoint+"?"+JSON.stringify(params))
.then(resp => resp.json());
} catch(e) {
data = {
msg: "Failed to fetch. Please check your network connection.",
};
}
if (!noLoader) hideLoader();
if (data.status !== 'success') {
showAlertModal(errorMessages[data.msg] || data.msg);
throw new Error(data.msg);
} else {
return data.data;
}
}

37
client/js/app.js Normal file
View file

@ -0,0 +1,37 @@
'use strict';
import { route, go, start } from './router.js';
import { searchView } from './searchView.js';
import { journeysView } from './journeysView.js';
import { journeyView } from './journeyView.js';
import { restoreDataStorage, ConsoleLog, loadDS100 } from './app_functions.js';
import { showDiv, hideDiv, ElementById } from './helpers.js';
export const devMode = true;
export const dataStorage = restoreDataStorage();
const main = async () => {
window.addEventListener('load', () => hideDiv('overlay'));
if (dataStorage.settings.showRIL100Names) await loadDS100();
route(/^\/$/, searchView);
route(/^\/([a-zA-Z0-9]+)$/, journeysView);
route(/^\/([a-zA-Z0-9]+)\/([-0-9]+)$/, journeyView);
if (!window.location.hash.length) go('/');
start();
}
main();
//const sw = navigator.serviceWorker;
//export let registration;
//if (sw) {
// sw.register('service-worker.js', {
// scope: './'
// }).then(function(reg) {
// ConsoleLog('Registration succeeded.');
// registration = reg;
// });
//}

228
client/js/app_functions.js Normal file
View file

@ -0,0 +1,228 @@
'use strict';
import { devMode, dataStorage } from './app.js';
import { showModal } from './overlays.js';
import { languages } from './languages.js';
import { vsprintf } from './sprintf.min.js';
let ds100 = {};
export const addCache = (mode, data) => {
if (data === undefined) {
return false;
}
switch (mode) {
case 'journeys':
if (dataStorage.journeys[data.reqId] !== undefined) {
ConsoleLog(data);
dataStorage.journeys[data.reqId].lastUpdated = data.lastUpdated;
dataStorage.journeys[data.reqId].journeys = {...dataStorage.journeys[data.reqId].journeys, ...data.journeys};
} else {
dataStorage.journeys[data.reqId] = data;
const lastHistoryEntry = dataStorage.journeysHistory.slice(-1);
if (lastHistoryEntry[0] !== undefined) {
if (JSON.stringify(lastHistoryEntry[0].fromPoint) !== JSON.stringify(data.params.fromPoint) ||
JSON.stringify(lastHistoryEntry[0].toPoint) !== JSON.stringify(data.params.toPoint)) {
dataStorage.journeysHistory.push({
fromPoint: data.params.fromPoint,
toPoint: data.params.toPoint,
reqId: data.reqId,
journeyId: ''
});
} else {
dataStorage.journeysHistory[dataStorage.journeysHistory.length-1].reqId = data.reqId;
dataStorage.journeysHistory[dataStorage.journeysHistory.length-1].journeyId = '';
}
} else {
dataStorage.journeysHistory.push({
fromPoint: data.params.fromPoint,
toPoint: data.params.toPoint,
reqId: data.reqId,
journeyId: ''
});
}
}
break;
case 'journeysHistory':
if (data !== undefined) {
dataStorage.journeysHistory = data;
} else {
return false;
}
break;
default:
return false;
break;
}
return saveDataStorage();
};
export const getCache = (mode, reqId) => {
switch (mode) {
case 'journeys':
if (reqId !== undefined) {
if (dataStorage.journeys[reqId] !== undefined) {
return dataStorage.journeys[reqId];
} else {
return null;
}
} else {
return dataStorage.journeys;
}
break;
case 'journeysHistory':
return dataStorage.journeysHistory;
break;
default:
return null;
break;
}
};
export const t = (key, params) => {
var language = 'en';
if (dataStorage.settings.language !== undefined) {
language = dataStorage.settings.language;
}
if (languages['de'][key] !== undefined) {
return vsprintf(languages[language][key], params);
} else {
return key;
}
}
export const parseName = (point) => {
let nameHTML = '';
if (point.stop) {
nameHTML += point.stop.name+ds100Names(point.stop.id);
} else if (point.location) {
if (point.location.name) {
nameHTML += point.location.name;
} else if (point.location.address) {
nameHTML += point.location.address;
}
} else {
return "";
}
return nameHTML;
};
export const ds100Names = (id) => {
if (dataStorage.settings.showRIL100Names !== false) {
if (ds100[Number(id)] !== undefined) {
return '('+ds100[Number(id)]+')';
} else {
return '';
}
} else {
return '';
}
}
export const ConsoleLog = (data) => {
if (dataStorage.settings.writeDebugLog !== false) {
console.log(data);
}
};
export const clearDataStorage = () => {
localStorage.removeItem('dataStorage');
localStorage.removeItem('dataStorage_dev');
location.reload();
};
export const saveDataStorage = () => {
if (devMode !== true) {
localStorage.setItem('dataStorage', JSON.stringify(dataStorage));
} else {
localStorage.setItem('dataStorage_dev', JSON.stringify(dataStorage));
}
};
export const restoreDataStorage = () => {
let data;
if (devMode !== true) {
data = localStorage.getItem('dataStorage');
} else {
data = localStorage.getItem('dataStorage_dev');
}
if (data !== null) {
let dataStorage = JSON.parse(data);
if (dataStorage.dbVer < 0.5) {
showModal('Lokale Datenbank veraltet - Datenbank wird neu erstellt.');
if (devMode !== true) {
localStorage.removeItem('dataStorage');
} else {
localStorage.removeItem('dataStorage_dev');
}
dataStorage = restoreDataStorage();
}
return dataStorage;
} else {
let userLang = navigator.language || navigator.userLanguage;
let language = 'en';
if (['en', 'de'].includes(userLang)) {
language = userLang;
}
const data = {
dbVer: 0.5,
journeysHistory: [],
journeys: {},
ignored: [],
favorites: [],
settings: {
provider: 'DB',
products: {
"nationalExp": true,
"national": true,
"regionalExp": true,
"regional": true,
"suburban": true,
"bus": true,
"ferry": true,
"subway": true,
"tram": true,
"taxi": true
},
accessibility: 'none',
showRIL100Names: false,
writeDebugLog: false,
enableCanvas: false,
language: language
}
}
if (devMode !== true) {
localStorage.setItem('dataStorage', JSON.stringify(data));
} else {
localStorage.setItem('dataStorage_dev', JSON.stringify(data));
}
return data;
}
};
export const loadDS100 = async () => {
const module = await import('./ds100.js');
ds100 = module.ds100;
};

321
client/js/canvas.js Normal file
View file

@ -0,0 +1,321 @@
'use strict';
import { moreJourneys } from './journeysView.js';
import { dataStorage } from './app.js';
const padZeroes = (str) => ('00' + str).slice(-2);
const formatTime = (date) => {
date = new Date(date * 1000);
return `${padZeroes(date.getHours())}:${padZeroes(date.getMinutes())}`
};
const textFor = (leg) => leg.line && leg.line.name || "";
const colorFor = (leg, type) => {
let product = leg.line && leg.line.product || "walk";
return colors[type][product] || colors[type].default;
};
const flatten = (arr) => [].concat(...arr);
const colors = {
fill: {
'tram': '#cc5555',
'subway': '#5555cc',
'suburban': '#55aa55',
'nationalExp': '#fff',
'national': '#fff',
'regionalExp': '#888',
'regional': '#888',
'bus': '#aa55aa',
default: '#888'
},
text: {
'nationalExp': '#ee3333',
'national': '#ee3333',
default: '#fff'
},
icon: {
'walk': 'directions_walk',
'transfer': 'directions_transfer',
'subway': 'directions_subway',
'bus': 'directions_bus',
'tram': 'tram',
default: 'train'
}
};
let rectWidth, padding, rectWidthWithPadding, canvas, ctx, dpr;
const canvasState = {
journeys: [],
offsetX: 0,
firstJourney: 1,
};
const textCache = {};
let textCacheWidth;
let textCacheDpr;
export const setupCanvas = (data) => {
canvasState.offsetX = (window.innerWidth / dpr) > 600 ? 120 : 60,
canvas = document.getElementById('canvas');
ctx = canvas.getContext('2d');
canvasState.journeys = Object.keys(data.journeys).sort((a, b) => Number(a) - Number(b)).map(k => data.journeys[k]);
canvasState.reqId = data.reqId;
canvasState.firstJourney = Number(Object.keys(data.journeys).sort((a, b) => Number(a) - Number(b))[0]);
canvas.addEventListener('mousedown', mouseDownHandler, {passive: true});
canvas.addEventListener('touchstart', mouseDownHandler, {passive: true});
updateTextCache();
resizeHandler();
};
const addTextToCache = (text, color, fixedHeight) => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
ctx.shadowBlur = dataStorage.settings.fancyCanvas ? 5 : 0;
ctx.shadowColor = '#00000080';
let height, width
if (fixedHeight) {
height = 15;
ctx.font = `${height}px sans-serif`;
width = ctx.measureText(text).width;
} else {
const measureAccuracy = 50;
ctx.font = `${measureAccuracy}px sans-serif`;
width = rectWidth - 10;
height = Math.abs(measureAccuracy * (width / (1 - ctx.measureText(text).width)));
}
canvas.width = width * dpr;
canvas.height = (Math.ceil(height) + 1) * dpr;
ctx.scale(dpr, dpr);
ctx.font = `${height}px sans-serif`;
ctx.fillStyle = color;
if (height > 10) {
ctx.fillText(text, 0, height);
textCache[text] = canvas;
}
};
const updateTextCache = () => {
textCache.length = 0;
textCacheWidth = rectWidth;
textCacheDpr = dpr;
for (let journey of canvasState.journeys) {
for (let leg of journey.legs) {
addTextToCache(textFor(leg), colorFor(leg, "text"));
let times = [];
if (journey.legs.indexOf(leg) == 0) times.push(leg.departure);
if (journey.legs.indexOf(leg) == journey.legs.length - 1) times.push(leg.arrival);
for (let time of times) {
addTextToCache(formatTime(time.prognosedTime || time.plannedTime), "#fff", 15);
}
}
}
};
const renderJourneys = () => {
ctx.clearRect(0, 0, canvas.width / dpr, canvas.height / dpr);
ctx.fillStyle = '#00000080';
ctx.fillRect(0, 0, canvas.width / dpr, canvas.height / dpr);
let x = canvasState.offsetX, y;
let firstVisibleJourney = Math.max(0, Math.floor((-canvasState.offsetX + padding) / rectWidthWithPadding));
let numVisibleJourneys = Math.ceil(canvas.width / dpr / rectWidthWithPadding);
let visibleJourneys = canvasState.journeys.slice(firstVisibleJourney, firstVisibleJourney + numVisibleJourneys);
if (!visibleJourneys.length) return;
let firstDeparture = visibleJourneys[0].legs[0].departure.plannedTime;
let lastArrival = Math.max.apply(Math,
visibleJourneys.map(journey => journey.legs[journey.legs.length-1].arrival.plannedTime)
.concat(visibleJourneys.map(journey => journey.legs[journey.legs.length-1].arrival.prognosedTime))
);
let scaleFactor = 1/(lastArrival - firstDeparture) * (canvas.height - 64 * dpr) / dpr;
let time = canvasState.journeys[0].legs[0].departure.plannedTime;
ctx.font = `${(window.innerWidth / dpr) > 600 ? 20 : 15}px sans-serif`;
ctx.fillStyle = '#aaa';
while (time < lastArrival) {
let y = (time - firstDeparture) * scaleFactor + 32;
ctx.fillText(formatTime(time), (window.innerWidth / dpr) > 600 ? 30 : 10, y);
ctx.fillRect(0, y, canvas.width / dpr, 1);
time += Math.floor(120/scaleFactor);
}
ctx.fillStyle = '#fa5';
y = (Number(new Date()) / 1000 - firstDeparture) * scaleFactor + 32;
ctx.fillRect(0, y-2, canvas.width / dpr, 5);
const p = new Path2D('M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z');
ctx.fillStyle = '#fff';
ctx.shadowBlur = dataStorage.settings.fancyCanvas ? 5 : 0;
ctx.shadowColor = '#00000080';
ctx.save();
ctx.scale(3, 3);
ctx.translate(x / 3 - 15, canvas.height / dpr / 6 - 24);
ctx.rotate(-Math.PI*1.5);
ctx.fill(p);
ctx.restore();
ctx.beginPath();
ctx.arc(x - 80,canvas.height / dpr / 2 - 35,50,0,2*Math.PI);
ctx.fillStyle = '#ffffff40';
ctx.fill();
ctx.strokeStyle = '#00000020';
ctx.stroke();
for (let journey of canvasState.journeys) {
journey.legs.reverse();
for (let leg of journey.legs) {
let depDelayed = leg.departure.prognosedTime && leg.departure.prognosedTime != leg.departure.plannedTime
let arrDelayed = leg.arrival.prognosedTime && leg.arrival.prognosedTime != leg.arrival.plannedTime
if (depDelayed || arrDelayed) {
const start = leg.departure.plannedTime;
const stop = leg.arrival.plannedTime;
const duration = (stop - start) * scaleFactor;
y = (start - firstDeparture) * scaleFactor + 32;
ctx.shadowBlur = 0;
ctx.fillStyle = '#44444480';
ctx.strokeStyle = '#ffffff80';
ctx.fillRect(x-padding, y, rectWidth, duration);
ctx.strokeRect(x-padding, y, rectWidth, duration);
}
}
x += rectWidthWithPadding;
}
x = canvasState.offsetX;
for (let journey of canvasState.journeys) {
for (let leg of journey.legs) {
const start = leg.departure.prognosedTime || leg.departure.plannedTime;
const stop = leg.arrival.prognosedTime || leg.arrival.plannedTime;
const duration = (stop - start) * scaleFactor;
y = (start - firstDeparture) * scaleFactor + 32;
ctx.shadowBlur = dataStorage.settings.fancyCanvas ? 10 : 0;
ctx.shadowColor = '#00000060';
if (leg.isWalking || leg.isTransfer) {
ctx.fillStyle = '#777';
ctx.fillRect(x + rectWidth / 2 - rectWidth / 10, y, rectWidth / 5, duration);
} else {
ctx.fillStyle = colorFor(leg, "fill");
ctx.fillRect(x, y, rectWidth, duration);
}
ctx.shadowBlur = 0;
let preRenderedText = textCache[textFor(leg)];
if ((preRenderedText.height / dpr) < duration - 5) {
ctx.scale(1 / dpr, 1 / dpr);
ctx.drawImage(preRenderedText, dpr * (x + 5), Math.floor(dpr * (y + duration / 2) - preRenderedText.height / 1.5));
ctx.scale(dpr, dpr);
}
/* draw journey start and end time */
let time;
// note: leg order is reversed at this point in time
let times = [];
if (journey.legs.indexOf(leg) == journey.legs.length - 1) times.push([leg.departure, y - 9.5]);
if (journey.legs.indexOf(leg) == 0) times.push([leg.arrival, y + duration + 7.5]);
for (let [time, y] of times) {
preRenderedText = textCache[formatTime(time.prognosedTime || time.plannedTime)];
ctx.scale(1 / dpr, 1 / dpr);
ctx.drawImage(preRenderedText, Math.ceil(dpr * (x + ((rectWidth - preRenderedText.width/dpr)) / 2)), dpr * (y - 7.5)); //Math.floor(dpr * (x + rectWidth / 2) - preRenderedText.width), dpr * (y - 1));
ctx.scale(dpr, dpr);
}
}
journey.legs.reverse();
x += rectWidthWithPadding;
}
ctx.fillStyle = '#fff';
ctx.shadowBlur = dataStorage.settings.fancyCanvas ? 5 : 0;
ctx.shadowColor = '#00000080';
ctx.save();
ctx.scale(3, 3);
ctx.translate(x / 3 + 5, canvas.height / dpr / 6);
ctx.rotate(Math.PI*1.5);
ctx.fill(p);
ctx.restore();
ctx.beginPath();
ctx.arc(x + 50,canvas.height / dpr / 2 - 35,50,0,2*Math.PI);
ctx.fillStyle = '#ffffff40';
ctx.fill();
ctx.strokeStyle = '#00000020';
ctx.stroke();
};
const resizeHandler = () => {
dpr = window.devicePixelRatio || 1;
if (!document.getElementById('canvas')) return;
rectWidth = (window.innerWidth / dpr) > 600 ? 100 : 80;
padding = (window.innerWidth / dpr) > 600 ? 20 : 5;
rectWidthWithPadding = rectWidth + 2 * padding;
if (rectWidth !== textCacheWidth || dpr !== textCacheDpr) updateTextCache();
const rect = document.getElementById('header').getBoundingClientRect();
canvas.width = window.innerWidth * dpr;
canvas.height = (window.innerHeight - rect.height) * dpr;
canvas.style.width = `${window.innerWidth}px`;
canvas.style.height = `${window.innerHeight - rect.height}px`;
ctx.restore();
ctx.save();
ctx.scale(dpr, dpr);
renderJourneys();
};
const mouseUpHandler = (evt) => {
let x = evt.x || evt.changedTouches[0].pageX;
if (canvasState.dragging && Math.abs(canvasState.dragStartMouse - x) < 20) {
let num = Math.floor((x - canvasState.offsetX + 2 * padding) / rectWidthWithPadding);
if (num >= 0) {
if (num < canvasState.journeys.length) {
window.location.hash += '/' + (num+canvasState.firstJourney);
} else {
moreJourneys(canvasState.reqId, "later");
}
} else {
moreJourneys(canvasState.reqId, "earlier");
}
}
canvasState.dragging = false;
};
const mouseDownHandler = (evt) => {
let x = evt.x || evt.changedTouches[0].pageX;
canvasState.dragStartMouse = x;
canvasState.dragStartOffset = canvasState.offsetX;
canvasState.dragging = true;
};
const mouseMoveHandler = (evt) => {
if (canvasState.dragging) {
evt.preventDefault();
let x = evt.x || evt.changedTouches[0].pageX;
canvasState.offsetX = canvasState.dragStartOffset - (canvasState.dragStartMouse - x);
renderJourneys();
return true;
}
};
window.addEventListener('mouseup', mouseUpHandler);
window.addEventListener('touchend', mouseUpHandler);
window.addEventListener('mousemove', mouseMoveHandler);
window.addEventListener('touchmove', mouseMoveHandler);
window.addEventListener('resize', resizeHandler);
window.addEventListener('zoom', resizeHandler);

1
client/js/ds100.js Normal file

File diff suppressed because one or more lines are too long

73
client/js/helpers.js Normal file
View file

@ -0,0 +1,73 @@
'use strict';
export const ElementById = (id) => {
return document.getElementById(id);
};
export const showDiv = (id) => {
const element = document.getElementById(id);
if (element) element.classList.remove('hidden');
};
export const hideDiv = (id) => {
const element = document.getElementById(id);
if (element) element.classList.add('hidden');
};
export const padZeros = (str) => {
return ('00' + str).slice(-2);
};
export const isValidDate = (date) => {
const matches = /^(\d{4})[-\/](\d{2})[-\/](\d{2})$/.exec(date);
if (matches == null) {
return false;
}
const d = matches[3];
const m = matches[2]-1;
const y = matches[1];
const composedDate = new Date(y, m, d);
return composedDate.getDate() == d &&
composedDate.getMonth() == m &&
composedDate.getFullYear() == y;
};
export const parseDateTime = (timestamp, format) => {
const date = new Date(timestamp * 1000);
if (format != null) {
switch (format) {
case 'full':
return padZeros(date.getHours()) + ':' + padZeros(date.getMinutes()) + ', ' + date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear();
break;
case 'date':
return date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear();
break;
default:
return false;
break;
}
}
if (date.toLocaleDateString() !== new Date().toLocaleDateString()) {
return padZeros(date.getHours()) + ':' + padZeros(date.getMinutes()) + ', ' + date.getDate() + '.' + (date.getMonth() + 1) + '.';
} else {
return padZeros(date.getHours()) + ':' + padZeros(date.getMinutes());
}
};
export const convertMinsToHrsMins = (mins) => {
const h = Math.floor(mins / 60);
const m = mins % 60;
if (h > 0) {
return h+'h '+m+'min';
}
return m+'min';
};

168
client/js/journeyView.js Normal file
View file

@ -0,0 +1,168 @@
'use strict';
import { showDiv, hideDiv, ElementById, parseDateTime, convertMinsToHrsMins } from './helpers.js';
import { getCache, addCache, ConsoleLog, parseName, ds100Names, t } from './app_functions.js';
import { get } from './api.js';
import { go } from './router.js';
import { html, render } from './lit-html.js';
const journeyTemplate = (data, requestId, journeyId) => {
let departure = data.legs[0].departure;
let arrival = data.legs[data.legs.length - 1].arrival;
var changes = 0;
let departureTime = departure.prognosedTime ? departure.prognosedTime : departure.plannedTime;
let arrivalTime = arrival.prognosedTime ? arrival.prognosedTime : arrival.plannedTime;
let duration = (arrivalTime - departureTime)/60;
for (let legKey in data.legs) {
let leg = data.legs[legKey];
if (leg.isWalking !== false) continue;
changes = changes+1;
}
return html`
<div id="journeyView">
<div id="header">
<a class="back" href="#/${requestId}"></a>
<p>
<h2>
<span id="fromName2">${parseName(departure.point)}</span>
<span> - </span>
<span id="toName2">${parseName(arrival.point)}</span>
</h2>
</p>
<p>
<b>
<span>${t('duration')}: </span>
<span id="duration">${convertMinsToHrsMins(duration)}</span>
<span> | ${t('changes')}: </span>
<span id="changes">${changes-1}</span>
<span> | ${t('date')}: </span>
<span id="date2">${parseDateTime(departure.plannedTime, 'date')}</span>
</b>
</p>
<div class="reload" id="reload-journey" @click=${() => reloadJourney(requestId, journeyId)}></div>
</div>
<div id="connection">
${data.legs.map(element => html`
${element.isWalking ? html`
<p class="walk">${t('walkinfo', [parseName(element.arrival.point), element.distance])}</p>
` : html`
${element.isTransfer ? html`
<p class="transfer">${t('transferinfo', [parseName(element.arrival.point), element.distance])}</p>
` : html`
<table>
<thead>
<tr>
<td colspan="4">${element.line.name} ${element.line.additionalName ? '('+element.line.additionalName+')' : ''} ${element.direction} ${element.cancelled ? html`<b style="color:red;">${t('cancelled-ride')}</b>` : ''}</td>
</tr>
<tr>
<th>${t('arrival')}</th>
<th>${t('departure')}</th>
<th>${t('station')}</th>
<th>${t('platform')}</th>
</tr>
</thead>
<tbody>
${element.stopovers.map(stop => html`
<tr class="stop ${stop.cancelled ? 'cancelled' : ''}" @click=${() => {location.href = "https://marudor.de/"+stop.stop.id+"?searchType=hafas"}}>
<td>${timeTemplate(stop.arrival)}</td>
<td>${timeTemplate(stop.departure)}</td>
<td>${stop.stop.name} ${ds100Names(stop.stop.id)}</td>
<td>${stopPlatformTemplate(stop)}</td>
</tr>
`)}
${(element.remarks || []).map(element => html`
<tr><td colspan="4"><smal>${element.text}</small></td></tr>
`)}
</tbody>
</table>
`}
`}
`)}
</div>
</div>
`};
const timeTemplate = (data, mode) => {
var delay = 0;
if (data.prognosedTime !== null) {
delay = (data.prognosedTime - data.plannedTime)/60;
}
if (!data.plannedTime && !data.prognosedTime) return '-';
return html`
${delay > 0 ? html`
${parseDateTime(data.prognosedTime)} <b>(+${delay})</b>
` : html`
${parseDateTime(data.plannedTime)}
`}`;
}
const platformTemplate = (data) => html`
${data.prognosedPlatform ? html`
<b>${data.prognosedPlatform}</b>
` : (data.plannedPlatform ? data.plannedPlatform : '-')}
`;
const stopPlatformTemplate = (data) => {
if (data.departure.plannedPlatform | data.departure.prognosedPlatform) {
if (!data.departure.prognosedPlatform) {
return data.departure.plannedPlatform;
} else {
return html`<b>${data.departure.prognosedPlatform}</b>`;
}
} else if (data.arrival.plannedPlatform | data.arrival.prognosedPlatform) {
if (!data.arrival.prognosedPlatform) {
return data.arrival.plannedPlatform;
} else {
return html`<b>${data.arrival.prognosedPlatform}</b>`;
}
} else {
return '-'
}
};
export const journeyView = async (match) => {
const reqId = match[0];
const journeyId = match[1];
let data;
let { journeys } = getCache('journeys', reqId)
if (journeyId in journeys[journeyId]) {
data = journeys[journeyId];
} else {
const request = await get("/journeys", {"reqId": reqId});
addCache('journeys', request);
data = request.journeys[journeyId];
}
ConsoleLog(data);
render(journeyTemplate(data, reqId, journeyId), ElementById('content'));
const journeysHistory = getCache('journeysHistory');
const history_id = journeysHistory.findIndex(obj => obj.reqId === reqId);
if (journeysHistory[history_id] !== undefined) {
journeysHistory[history_id].journeyId = journeyId;
addCache('journeysHistory', journeysHistory);
}
};
const reloadJourney = async (reqId, journeyId) => {
document.querySelector('.reload').classList.add('spinning');
try {
let request = await get("/refreshJourney", {"reqId": reqId, "journeyId": journeyId});
addCache('journeys', request);
journeyView([reqId, journeyId]);
} catch(err) {
ConsoleLog(err);
}
document.querySelector('.reload').classList.remove('spinning');
};

124
client/js/journeysView.js Normal file
View file

@ -0,0 +1,124 @@
'use strict';
import { showDiv, hideDiv, ElementById, parseDateTime, convertMinsToHrsMins } from './helpers.js';
import { getCache, addCache, parseName, ConsoleLog, t } from './app_functions.js';
import { dataStorage } from './app.js';
import { setupCanvas } from './canvas.js';
import { get } from './api.js';
import { go } from './router.js';
import { html, render } from './lit-html.js';
import { showAlertModal } from './overlays.js';
let data;
const journeysTemplate = (data) => html`
<div id="journeysView">
<div id="header">
<a class="back" href="#/"></a>
<p><h3>${t('from')}: <span id="fromName">${parseName(data.params.fromPoint)}</span></h3></p>
<p><h3>${t('to')}: <span id="toName">${parseName(data.params.toPoint)}</span></h3></p>
<div class="reload" id="reload-journeys" @click=${() => reloadJourneys(data.reqId)}></div>
</div>
${dataStorage.settings.enableCanvas ? html`
<div id="journeysCanvas">
<canvas id="canvas"></canvas>
</div>
` : html`
<div id="journeysTable">
<div class="loadMore flipped" @click=${() => moreJourneys(data.reqId, 'earlier')}></div>
<table>
<thead>
<tr><th>${t('departure')}</th><th>${t('arrival')}</th><th>${t('duration')}</th><th>${t('changes')}</th><th>${t('products')}</th></tr>
</thead>
<tbody id="connectionsTable">
${Object.keys(data.journeys).sort((a, b) => a - b).map(key => journeyOverviewTemplate(data, key))}
</tbody>
</table>
<div class="loadMore" @click=${() => moreJourneys(data.reqId, "later")}></div>
</div>
`}
</div>
`;
const journeyOverviewTemplate = (data, key) => {
let departure = data.journeys[key].legs[0].departure;
let arrival = data.journeys[key].legs[data.journeys[key].legs.length - 1].arrival;
var changes = 0;
var products = [];
var changesDuration = 0;
var cancelled = false;
let departureTime = departure.prognosedTime ? departure.prognosedTime : departure.plannedTime;
let arrivalTime = arrival.prognosedTime ? arrival.prognosedTime : arrival.plannedTime;
let duration = (arrivalTime - departureTime)/60;
for (let legKey in data.journeys[key].legs) {
let leg = data.journeys[key].legs[legKey];
if (leg.cancelled !== false) cancelled = true;
if (leg.isWalking || leg.isTransfer) continue;
changes = changes+1;
products.push(leg.line.productName);
}
products = [...new Set(products)];
return html`
<tr class="connection ${cancelled ? 'cancelled' : ''}" @click=${() => go('/'+data.reqId + '/' + key)}">
<td>${timeTemplate(departure, 'departure')}</td>
<td>${timeTemplate(arrival, 'arrival')}</td>
<td title="${changesDuration > 0 ? 'Davon '+convertMinsToHrsMins(changesDuration)+' Umstiegsdauer' : ''}">${convertMinsToHrsMins(duration)}</td>
<td>${changes-1}</td>
<td>${products.join(', ')}</td>
</tr>`;
}
export const journeysView = async (match) => {
const reqId = match[0];
data = getCache('journeys', reqId);
if (!data) {
data = await get("/journeys", {"reqId": reqId});
addCache('journeys', data);
}
render(journeysTemplate(data), ElementById('content'))
if (dataStorage.settings.enableCanvas) {
setupCanvas(data);
}
};
const timeTemplate = (data, mode) => {
var delay = 0;
if (data.prognosedTime !== null) {
delay = (data.prognosedTime - data.plannedTime)/60;
}
return html`
${delay > 0 ? html`
${parseDateTime(data.prognosedTime)} <b>(+${delay})</b>
` : html`
${parseDateTime(data.plannedTime)}
`}`;
}
export const moreJourneys = async (reqId, mode) => {
var data = getCache('journeys', reqId);
const newData = await get('/moreJourneys', {"reqId": reqId, "mode": mode});
data.lastUpdated = newData.lastUpdated;
data.journeys = {...data.journeys, ...newData.journeys};
addCache('journeys', data);
journeysView([reqId]);
};
export const reloadJourneys = async (requestId) => {
showAlertModal("not implemented yet");
};

96
client/js/languages.js Normal file
View file

@ -0,0 +1,96 @@
export const languages = {
'de': {
'arrival': 'Ankunft',
'departure': 'Abfahrt',
'duration': 'Dauer',
'changes': 'Umstiege',
'products': 'Produkte',
'from': 'Von',
'to': 'Nach',
'date': 'Datum',
'time': 'Uhrzeit',
'station': 'Station',
'platform': 'Gleis',
'walkinfo': 'Laufe nach %s. (ca. %s Meter)',
'transferinfo': 'Reise nach %s. (ca. %s Meter)',
'swap': 'Von/Nach tauschen',
'settings': 'Einstellungen',
'search': 'Suchen',
'options': 'Optionen',
'setfromto': 'Als Von/Nach setzen',
'journeyoverview': 'Verbindungsübersicht aufrufen',
'lastjourney': 'Letzte gewälte Verbindung aufrufen',
'longdistancetrain': 'Fernverkehr',
'regionaltrain': 'Regionalverkehr',
'suburbantrain': 'S-Bahn',
'subway': 'U-Bahn',
'tram': 'Tram',
'bus': 'Bus',
'ferry': 'Fähre',
'taxi': 'Taxi',
'save': 'Speichern',
'clearstorage': 'lokale Daten löschen',
'datasource': 'Datenquelle',
'accessibility': 'Barrierefreiheit',
'access_none': 'keine Einschränkungen',
'access_partial': 'Bedingt barrierefrei',
'access_full': 'Barrierefrei',
'etc': 'Sonstiges',
'showds100': 'Zeige RIL100 Kürzel (wenn verfügbar)',
'showdebug': 'Schreibe Debug Nachrichten ins Log',
'graphical': 'Graphische Darstellung in der Verbindungsübersicht',
'fancy': 'Schöne Grafik',
'update': 'Anwendung updaten',
'language': 'Sprache',
'de': 'Deutsch',
'en': 'Englisch',
'cancelled-ride': 'Fahrt entfällt!'
},
'en': {
'arrival': 'Arrival',
'departure': 'Departure',
'duration': 'Duration',
'changes': 'Changes',
'products': 'Products',
'from': 'From',
'to': 'To',
'date': 'Date',
'time': 'Time',
'station': 'Station',
'platform': 'Platform',
'walkinfo': 'Walk to %s. (apprx. %s meters)',
'transferinfo': 'Transfer to %s. (apprx. %s meters)',
'swap': 'Swap from/to',
'settings': 'Settings',
'search': 'Search',
'options': 'Options',
'setfromto': 'Set as from/to',
'journeyoverview': 'Go to journeysoverview',
'lastjourney': 'Go to last selected journey',
'longdistancetrain': 'Log distance trains',
'regionaltrain': 'Regional trains',
'suburbantrain': 'Suburban Trains',
'subway': 'Subway',
'tram': 'Tram',
'bus': 'Bus',
'ferry': 'Ferry',
'taxi': 'Taxi',
'save': 'Save',
'clearstorage': 'remove local data',
'datasource': 'Data source',
'accessibility': 'Accessibillity',
'access_none': 'none',
'access_partial': 'partial',
'access_full': 'full',
'etc': 'Others',
'showds100': 'Show DS100 (if avaliable)',
'showdebug': 'Write debug messages to log',
'graphical': 'Graphical overview for journeys',
'fancy': 'Use fancy graphics',
'update': 'Update application',
'language': 'Language',
'de': 'German',
'en': 'Englisch',
'cancelled-ride': 'Cancelled!'
}
}

1
client/js/lit-html.js Normal file

File diff suppressed because one or more lines are too long

43
client/js/overlays.js Normal file
View file

@ -0,0 +1,43 @@
'use strict';
import { showDiv, hideDiv, ElementById } from './helpers.js';
import { html, render } from './lit-html.js';
export const showAlertModal = (text) => {
showDiv('overlay');
render(html`
<div id="modal">
<div id="modal-box">
<div id="modal-text">${text}</div>
<div id="dismiss" @click=${() => hideDiv('overlay')}>OK</div>
</div>
</div>
`, ElementById('overlay'));
};
export const showModal = (title, content) => {
showDiv('overlay');
render(html`
<div class="modal">
<div class="modal-dialog">
<div id="modal-content" class="modal-content">
<div class="modal-header">
<div class="modal-close" @click=${() => hideDiv('overlay')}></div>
<h4 class="modal-title">${title}</h4>
</div>
<div class="modal-body">${content}</div>
</div>
</div>
</div>`, ElementById('overlay'));
};
export const showLoader = () => {
showDiv('overlay');
render(html`
<div id="loading">
<div id="spinner"></div>
</div>
`, document.getElementById('overlay'));
};
export const hideLoader = () => hideDiv('overlay');

25
client/js/router.js Normal file
View file

@ -0,0 +1,25 @@
'use strict';
const routes = [];
export const route = (pattern, handler) => {
routes.push({
pattern: pattern,
handler: handler
});
};
export const go = (dest) => {
window.location.hash = '#' + dest;
};
export const start = () => {
const dest = window.location.hash.slice(1);
for (let route of routes) {
const match = route.pattern.exec(dest);
if (!match) continue;
return route.handler(match.slice(1));
}
};
window.addEventListener('hashchange', start);

409
client/js/searchView.js Normal file
View file

@ -0,0 +1,409 @@
'use strict';
import { showDiv, hideDiv, ElementById, padZeros, isValidDate } from './helpers.js';
import { getCache, addCache, parseName, saveDataStorage, clearDataStorage, ConsoleLog, t, loadDS100 } from './app_functions.js';
import { dataStorage } from './app.js';
import { get } from './api.js';
import { go } from './router.js';
import { html, render } from './lit-html.js';
import { showAlertModal, showModal, showLoader, hideLoader} from './overlays.js';
let currDate = new Date();
let fromValue = '';
let toValue = '';
let isArrValue = false;
let dateValue = currDate.getFullYear()+'-'+padZeros(currDate.getMonth()+1)+'-'+padZeros(currDate.getDate());;
let timeValue = padZeros(currDate.getHours())+':'+padZeros(currDate.getMinutes());
let suggestionsCache = {
from: {},
to: {},
};
const searchTemplate = (journeysHistory) => html`
<div id="searchView">
<div class="inputs">
<input type="text" id="from" value="${fromValue}" placeholder="${t('from')}" autocomplete="off" @keyup=${loadSuggestions} @focus=${startTyping} @blur=${stopTyping} @keypress=${onKeypress}>
<div class="suggestions" id="fromsuggestions"></div>
<input type="text" id="to" value="${toValue}" placeholder="${t('to')}" autocomplete="off" @keyup=${loadSuggestions} @focus=${startTyping} @blur=${stopTyping} @keypress=${onKeypress}>
<div class="suggestions" id="tosuggestions"></div>
<div id="datetime">
<div id="deparr">
<label class="switch">
<input type="checkbox" id="isarr" ?checked=${isArrValue}>
<span class="slider"></span>
</label>
</div>
<input type="date" id="date" placeholder="${t('date')} (YYYY-MM-DD)" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" value="${dateValue}">
<input type="time" id="time" placeholder="${t('time')} (HH:MM" pattern="[0-9]{2}:[0-9]{2}" value="${timeValue}">
</div>
</div>
<div class="row">
<div class="product_selector">
<input type="checkbox" id="national">
<label for="national" title="${t('longdistancetrain')}">&nbsp;</label>
<input type="checkbox" id="regional">
<label for="regional" title="${t('regionaltrain')}">&nbsp;</label>
<input type="checkbox" id="suburban">
<label for="suburban" title="${t('suburbantrain')}">&nbsp;</label>
<input type="checkbox" id="subway">
<label for="subway" title="${t('subway')}">&nbsp;</label>
<input type="checkbox" id="tram">
<label for="tram" title="${t('tram')}">&nbsp;</label>
<input type="checkbox" id="bus">
<label for="bus" title="${t('bus')}">&nbsp;</label>
<input type="checkbox" id="ferry">
<label for="ferry" title="${t('ferry')}">&nbsp;</label>
<input type="checkbox" id="taxi">
<label for="taxi" title="${t('taxi')}">&nbsp;</label>
</div>
<div class="button swap" id="swap" title="${t('swap')}" @click=${swapFromTo}></div>
<a class="button settings" title="${t('settings')}" @click=${showSettings}></a>
<div class="button search" tabindex="0" id="search" title="${t('search')}" @click=${search}></div>
</div>
${journeysHistory.length ? html`
${journeysHistoryTemplate(journeysHistory)}
` : ''}
</div>
`;
const journeysHistoryTemplate = (journeysHistory) => html`
<div id="journeysHistory">
<table>
<thead>
<tr><th>${t('from')}</th><th>${t('to')}</th><th>${t('options')}</th></tr>
</thead>
<tbody id="journeysHistoryTable">
${journeysHistory.map(element => html`
<tr class="fromHistory" @click=${() => setFromHistory(journeysHistory.length - 1 - journeysHistory.indexOf(element))}" title="${t('setfromto')}">
<td>${parseName(element.fromPoint)}</td>
<td>${parseName(element.toPoint)}</td>
<td>
<a class="departures" href="#/${element.reqId}" title="${t('journeyoverview')}"></a>
${element.journeyId === '' ? '' : html`
<a class="directions" href="#/${element.reqId}/${element.journeyId}" title="${t('lastjourney')}"></a>
`}
</td>
</tr>
`)}
</tbody>
</table>
</div>
`;
export const searchView = () => {
const journeysHistory = getCache('journeysHistory').slice().reverse();
render(searchTemplate(journeysHistory), ElementById('content'));
ElementById('from').focus();
for (let product in dataStorage.settings.products) {
if (ElementById(product) !== null) {
ElementById(product).checked = dataStorage.settings.products[product];
}
};
};
export const search = async (requestId) => {
const provider = dataStorage.settings.provider;
let products = readProductSelection();
const accessibility = dataStorage.settings.accessibility;
let isDep = !ElementById('isarr').checked;
let date = ElementById('date').value;
let time = ElementById('time').value;
let timestamp = '';
let from = '';
let to = '';
currDate = new Date();
fromValue = ElementById('from').value;
toValue = ElementById('to').value;
dateValue = ElementById('date').value;
timeValue = ElementById('time').value;
isArrValue = ElementById('isarr').checked;
if (date !== '') {
if (!isValidDate(date)) {
showAlertModal('Ungültiges Datum!');
return;
}
} else {
date = currDate.getFullYear()+'-'+padZeros(currDate.getMonth()+1)+'-'+padZeros(currDate.getDate());
}
if (time !== '') {
if (!new RegExp('([0-1][0-9]|2[0-3]):([0-5][0-9])').test(time)) {
showAlertModal('Ungültige Zeitangabe!');
return;
}
} else {
time = padZeros(currDate.getHours())+':'+padZeros(currDate.getMinutes());
}
if (ElementById('from').value == "" | ElementById('to').value == "") {
showAlertModal("Abfahrts - und Ankunftsbahnhof müssen ausgefüllt werden.");
return;
}
if (Object.entries(suggestionsCache.from).length !== 0) {
from = suggestionsCache.from;
} else {
let suggestions = await get("/suggestions", {"query": ElementById('from').value, "results": 1}, true);
if (!suggestions[0]) {
showAlertModal("Abfahrtsbahnof ungültig");
return;
}
from = suggestions[0]
}
if (Object.entries(suggestionsCache.to).length !== 0) {
to = suggestionsCache.to;
} else {
let suggestions = await get("/suggestions", {"query": ElementById('to').value, "results": 1}, true);
if (!suggestions[0]) {
showAlertModal("Ankunftsbahnhof ungültig");
return;
}
to = suggestions[0]
}
dataStorage.settings.products = products;
saveDataStorage();
const split_date = date.split('-');
const split_time = time.split(':');
timestamp = Math.round(new Date(split_date[0], split_date[1]-1, split_date[2], split_time[0], split_time[1]).getTime()/1000);
ConsoleLog(timestamp+'///'+date+' '+time+':00');
let params = {
"fromPoint": from,
"toPoint": to,
"accessibility": accessibility,
"products": products
}
if (!isDep) {
params.arrival = timestamp
} else {
params.departure = timestamp
}
const data = await get("/journeys", {"params":params});
addCache('journeys', data);
go('/' + data.reqId);
};
const suggestionsTemplate = (suggestions, inputId) => html`
<div class="suggestionsbox" @mouseover=${mouseOverSuggestions} @mouseout=${stopMouseOverSuggestions}>
${suggestions.map(element => html`
<p class="suggestion" @click=${() => setSuggestion(encodeURI(JSON.stringify(element)), inputId)}>${parseName(element)}</p>
`)}
</div>
`;
const loadSuggestions = async (e, input) => {
const val = e.target.value;
suggestionsCache[e.target.id] = {};
const suggestions = val ? await get("/suggestions", {"query": val}, true) : [];
const suggestionsEl = ElementById(e.target.id+'suggestions');
render(suggestionsTemplate(suggestions, e.target.id), suggestionsEl);
};
export const setSuggestion = (data, inputId) => {
if (typeof data === 'string') {
data = JSON.parse(decodeURI(data));
}
suggestionsCache[inputId] = data;
ElementById(inputId).value = parseName(data);
if (inputId === 'from') {
ElementById('fromsuggestions').classList.remove('mouseover');
ElementById('to').focus();
} else if (inputId === 'to') {
ElementById('tosuggestions').classList.remove('mouseover');
ElementById('to').blur();
}
};
export const swapFromTo = () => {
suggestionsCache.from = [suggestionsCache.to, suggestionsCache.to = suggestionsCache.from][0];
let from = ElementById('from');
let to = ElementById('to');
from.value = [to.value, to.value = from.value][0];
};
export const setFromHistory = (id) => {
const cache = getCache('journeysHistory');
if (cache[id] !== undefined){
setSuggestion(cache[id].fromPoint, 'from');
setSuggestion(cache[id].toPoint, 'to');
}
};
export const readProductSelection = () => {
var products = {
"nationalExp": false,
"national": false,
"regionalExp": false,
"regional": false,
"suburban": false,
"bus": false,
"ferry": false,
"subway": false,
"tram": false,
"taxi": false
}
if (ElementById('national').checked !== false) {
products.nationalExp = true;
products.national = true;
}
if (ElementById('regional').checked !== false) {
products.regionalExp = true;
products.regional = true;
}
if (ElementById('suburban').checked !== false) {
products.suburban = true;
}
if (ElementById('subway').checked !== false) {
products.subway = true;
}
if (ElementById('tram').checked !== false) {
products.tram = true;
}
if (ElementById('bus').checked !== false) {
products.bus = true;
}
if (ElementById('ferry').checked !== false) {
products.ferry = true;
}
if (ElementById('taxi').checked !== false) {
products.taxi = true;
}
return products;
};
const startTyping = (e) => {
ElementById(e.target.id+'suggestions').classList.add('typing');
if (e.target.id == 'from') ElementById('tosuggestions').classList.remove('mouseover');
if (e.target.id == 'to') ElementById('fromsuggestions').classList.remove('mouseover');
};
const stopTyping = (e) => {
ElementById(e.target.id+'suggestions').classList.remove('typing');
};
const mouseOverSuggestions = (e) => {
let el = e.target;
let i = 0;
while (i++ < 10 && el.id !== 'fromsuggestions' && el.id !== 'tosuggestions') el = el.parentElement;
el.classList.add('mouseover');
};
const stopMouseOverSuggestions = (e) => {
let el = e.target;
let i = 0;
while (i++ < 10 && el.id !== 'fromsuggestions' && el.id !== 'tosuggestions') el = el.parentElement;
el.classList.remove('mouseover');
};
const onKeypress = (e) => {
if (e.which == 13 || e.keyCode == 13) { // enter
document.querySelector(`#${e.target.id}suggestions>.suggestionsbox>:first-child`).click();
if (e.target.id === 'to') ElementById('search').click();
return false;
}
return true;
};
const showSettings = () => {
showModal(t('settings'), settingsTemplate())
};
const settingsTemplate = () => html`
<b>${t('datasource')}:</b><br>
<label><input type="radio" name="provider" ?checked=${dataStorage.settings.provider === "DB"} value="DB"> DB</label><br>
<label><input type="radio" disabled="disabled" name="provider" ?checked=${dataStorage.settings.provider === "SH"} value="SH"> NAH.SH</label><br>
<label><input type="radio" disabled="disabled" name="provider" ?checked=${dataStorage.settings.provider === "BVG"} value="BVG"> BVG</label><br>
<br>
<b>${t('accessibility')}:</b><br>
<label><input type="radio" name="accessibility" ?checked=${dataStorage.settings.accessibility === "none"} value="none"> ${t('access_none')}</label><br>
<label><input type="radio" name="accessibility" ?checked=${dataStorage.settings.accessibility === "partial"} value="partial"> ${t('access_partial')}</label><br>
<label><input type="radio" name="accessibility" ?checked=${dataStorage.settings.accessibility === "complete"} value="complete"> ${t('access_full')}</label><br>
<br>
<b>${t('etc')}:</b><br>
<label><input type="checkbox" ?checked=${dataStorage.settings.showRIL100Names} id="ril100"> ${t('showds100')}</label><br>
<label><input type="checkbox" ?checked=${dataStorage.settings.writeDebugLog} id="debug-messages"> ${t('showdebug')}</label><br>
<label><input type="checkbox" ?checked=${dataStorage.settings.enableCanvas} id="enable-canvas"> ${t('graphical')} <b>BETA</b></label><br>
<label><input type="checkbox" ?checked=${dataStorage.settings.fancyCanvas} id="fancy-canvas"> ${t('fancy')}<label><br>
<br>
<b>${t('language')}:</b><br>
<label><input type="radio" name="language" ?checked=${dataStorage.settings.language === "de"} value="de"> ${t('de')}</label><br>
<label><input type="radio" name="language" ?checked=${dataStorage.settings.language === "en"} value="en"> ${t('en')}</label><br>
<button class="btn" id="save" @click=${saveSettings}><span>${t('save')}</span></button>
<button class="btn red" id="clear" @click=${clearDataStorage}><span>${t('clearstorage')}</span></button>
<button class="btn orange" id="rebuild-cache" @click=${rebuildCache}><span>${t('update')}</span></button>
`;
const rebuildCache = () => {
ConsoleLog('sw update');
registration.update();
location.reload();
};
const saveSettings = async () => {
const provider = document.querySelector('input[name="provider"]:checked').value;
const accessibility = document.querySelector('input[name="accessibility"]:checked').value;
const language = document.querySelector('input[name="language"]:checked').value;
const show_ril100 = ElementById('ril100').checked;
const write_debug = ElementById('debug-messages').checked;
const enable_canvas = ElementById('enable-canvas').checked;
const fancy_canvas = ElementById('fancy-canvas').checked;
if (provider !== dataStorage.settings.provider) {
dataStorage.journeysHistory = [];
}
dataStorage.settings.provider = provider;
dataStorage.settings.accessibility = accessibility;
dataStorage.settings.showRIL100Names = show_ril100;
dataStorage.settings.writeDebugLog = write_debug;
dataStorage.settings.enableCanvas = enable_canvas;
dataStorage.settings.fancyCanvas = fancy_canvas;
dataStorage.settings.language = language;
saveDataStorage();
if (show_ril100) await loadDS100();
searchView();
hideDiv('overlay');
};

205
client/js/sprintf.min.js vendored Normal file
View file

@ -0,0 +1,205 @@
'use strict'
var re = {
not_string: /[^s]/,
not_bool: /[^t]/,
not_type: /[^T]/,
not_primitive: /[^v]/,
number: /[diefg]/,
numeric_arg: /[bcdiefguxX]/,
json: /[j]/,
not_json: /[^j]/,
text: /^[^\x25]+/,
modulo: /^\x25{2}/,
placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
key: /^([a-z_][a-z_\d]*)/i,
key_access: /^\.([a-z_][a-z_\d]*)/i,
index_access: /^\[(\d+)\]/,
sign: /^[+-]/
}
function sprintf(key) {
// `arguments` is not an array, but should be fine for this call
return sprintf_format(sprintf_parse(key), arguments)
}
export const vsprintf = (fmt, argv) => {
return sprintf.apply(null, [fmt].concat(argv || []))
}
function sprintf_format(parse_tree, argv) {
var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign
for (i = 0; i < tree_length; i++) {
if (typeof parse_tree[i] === 'string') {
output += parse_tree[i]
}
else if (typeof parse_tree[i] === 'object') {
ph = parse_tree[i] // convenience purposes only
if (ph.keys) { // keyword argument
arg = argv[cursor]
for (k = 0; k < ph.keys.length; k++) {
if (arg == undefined) {
throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1]))
}
arg = arg[ph.keys[k]]
}
}
else if (ph.param_no) { // positional argument (explicit)
arg = argv[ph.param_no]
}
else { // positional argument (implicit)
arg = argv[cursor++]
}
if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
arg = arg()
}
if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) {
throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))
}
if (re.number.test(ph.type)) {
is_positive = arg >= 0
}
switch (ph.type) {
case 'b':
arg = parseInt(arg, 10).toString(2)
break
case 'c':
arg = String.fromCharCode(parseInt(arg, 10))
break
case 'd':
case 'i':
arg = parseInt(arg, 10)
break
case 'j':
arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0)
break
case 'e':
arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential()
break
case 'f':
arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg)
break
case 'g':
arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg)
break
case 'o':
arg = (parseInt(arg, 10) >>> 0).toString(8)
break
case 's':
arg = String(arg)
arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
break
case 't':
arg = String(!!arg)
arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
break
case 'T':
arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase()
arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
break
case 'u':
arg = parseInt(arg, 10) >>> 0
break
case 'v':
arg = arg.valueOf()
arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
break
case 'x':
arg = (parseInt(arg, 10) >>> 0).toString(16)
break
case 'X':
arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase()
break
}
if (re.json.test(ph.type)) {
output += arg
}
else {
if (re.number.test(ph.type) && (!is_positive || ph.sign)) {
sign = is_positive ? '+' : '-'
arg = arg.toString().replace(re.sign, '')
}
else {
sign = ''
}
pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' '
pad_length = ph.width - (sign + arg).length
pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : ''
output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg)
}
}
}
return output
}
var sprintf_cache = Object.create(null)
function sprintf_parse(fmt) {
if (sprintf_cache[fmt]) {
return sprintf_cache[fmt]
}
var _fmt = fmt, match, parse_tree = [], arg_names = 0
while (_fmt) {
if ((match = re.text.exec(_fmt)) !== null) {
parse_tree.push(match[0])
}
else if ((match = re.modulo.exec(_fmt)) !== null) {
parse_tree.push('%')
}
else if ((match = re.placeholder.exec(_fmt)) !== null) {
if (match[2]) {
arg_names |= 1
var field_list = [], replacement_field = match[2], field_match = []
if ((field_match = re.key.exec(replacement_field)) !== null) {
field_list.push(field_match[1])
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
if ((field_match = re.key_access.exec(replacement_field)) !== null) {
field_list.push(field_match[1])
}
else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
field_list.push(field_match[1])
}
else {
throw new SyntaxError('[sprintf] failed to parse named argument key')
}
}
}
else {
throw new SyntaxError('[sprintf] failed to parse named argument key')
}
match[2] = field_list
}
else {
arg_names |= 2
}
if (arg_names === 3) {
throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported')
}
parse_tree.push(
{
placeholder: match[0],
param_no: match[1],
keys: match[2],
sign: match[3],
pad_char: match[4],
align: match[5],
width: match[6],
precision: match[7],
type: match[8]
}
)
}
else {
throw new SyntaxError('[sprintf] unexpected placeholder')
}
_fmt = _fmt.substring(match[0].length)
}
return sprintf_cache[fmt] = parse_tree
}

21
client/manifest.json Normal file
View file

@ -0,0 +1,21 @@
{
"name": "Öffisearch",
"short_name": "Öffisearch",
"start_url": ".",
"icons": [
{
"src": "./img/favicon-64x64.png",
"sizes": "64x64",
"type": "image/png"
},
{
"src": "./img/favicon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

91
client/service-worker.js Normal file
View file

@ -0,0 +1,91 @@
'use strict';
const CACHE = 'cache-v34';
let preCache = [
'./img/product_bus_grey.svg',
'./img/product_cablecar_color.svg',
'./img/product_cablecar_grey.svg',
'./img/product_call_color.svg',
'./img/product_call_grey.svg',
'./img/product_ferry_color.svg',
'./img/product_ferry_grey.svg',
'./img/product_highspeed_color.svg',
'./img/product_highspeed_grey.svg',
'./img/product_suburban_color.svg',
'./img/product_suburban_grey.svg',
'./img/product_subway_color.svg',
'./img/product_subway_grey.svg',
'./img/product_train_color.svg',
'./img/product_train_grey.svg',
'./img/product_bus_color.svg',
'./img/product_tram_grey.svg',
'./img/product_tram_color.svg',
'./img/back.svg',
'./img/baseline-beenhere-24px.svg',
'./img/baseline-departure_board-24px.svg',
'./img/baseline-directions-24px.svg',
'./img/baseline-directions-24px_white.svg',
'./img/baseline-directions_walk-24px.svg',
'./img/baseline-expand_more-24px.svg',
'./img/baseline-import_export-24px.svg',
'./img/baseline-navigation-24px.svg',
'./img/baseline-place-24px.svg',
'./img/baseline-settings-20px.svg',
'./ing/baseline-swap_vert-24px.svg',
'./img/baseline-refresh-24px.svg',
'./img/ba8064fd767ceaa170589aa3dd11e58e.jpg',
'./img/favicon-16x16.png',
'./img/favicon-32x32.png',
'./img/favicon-64x64.png',
'./img/favicon-512x512.png',
'./img/apple-touch-icon.png',
'./js/api.js',
'./js/canvas.js',
'./js/journeysView.js',
'./js/journeyView.js',
'./js/searchView.js',
'./js/settingsView.js',
'./js/app_functions.js',
'./js/helpers.js',
'./js/app.js',
'./js/router.js',
'./js/overlays.js',
'./css/product_selector.css',
'./css/style.css',
'./manifest.json',
'./index.html',
'./'
];
self.addEventListener('install', function (evt) {
self.skipWaiting();
evt.waitUntil(caches.open(CACHE).then(function (cache) {
cache.addAll(preCache);
}));
});
self.addEventListener('fetch', function (evt) {
evt.respondWith(fromCache(evt.request).then(function (match) {
if (match) {
return match;
} else {
return fetch(evt.request);
}
}));
});
self.addEventListener('activate', function (event) {
event.waitUntil(clients.claim());
event.waitUntil(clients.claim().then(function () {
return caches.keys().then(function (cacheNames) {
return Promise.all(cacheNames.filter(c => c !== CACHE).map(c => caches.delete(c)));
});
}));
});
function fromCache (request) {
return caches.open(CACHE).then(function (cache) {
return cache.match(request);
});
}

8
client/todo.txt Normal file
View file

@ -0,0 +1,8 @@
Todo:
journeyview:
- umsteigezeit
- canvas pfeile auf haidpi
- klicken aufs canvas führt zu marudor
- bei refresh das loading overlay ausblenden
- walkspeed
- combine multiple walking legs

21
ds100.js Normal file
View file

@ -0,0 +1,21 @@
const stations = require('db-stations')
const fs = require('fs');
var ds100list = {};
stations.full()
.on('data',function(station){
var stuff = [];
station.ril100Identifiers.forEach(element => {
stuff.push(element.rilIdentifier)
})
if (stuff.length === 0) return;
ds100list[station.id] = stuff.join(', ');
})
.on('end',function(){
fs.writeFile("ds100.json", JSON.stringify(ds100list), () => {})
});

1
nim.cfg Normal file
View file

@ -0,0 +1 @@
d:ssl

14
oeffisearch.nimble Normal file
View file

@ -0,0 +1,14 @@
# Package
version = "0.1.0"
author = "ctucx, petabyteboy"
description = "oeffisearch: public transport in your browser "
license = "AGPL-3.0"
srcDir = "src"
bin = @["oeffisearch"]
# Dependencies
requires "nim >= 1.0.4"

33
shell.nix Normal file
View file

@ -0,0 +1,33 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
nimlibs = stdenv.mkDerivation {
pname = "nimlibs";
version = nim.version;
src = nim;
nativeBuildInputs = [ nim ];
buildPhase = ''
nim c -d:release --nimcache:$PWD -o:libnimrtl.so lib/nimrtl.nim
nim c -d:release --nimcache:$PWD -o:libnimhcr.so lib/nimhcr.nim
'';
installPhase = ''
install -Dm644 libnimrtl.so $out/lib/libnimrtl.so
install -Dm644 libnimhcr.so $out/lib/libnimhcr.so
'';
};
in stdenv.mkDerivation {
pname = "oeffisearch";
version = "0.1.0";
nativeBuildInputs = [ nim ];
LD_LIBRARY_PATH = lib.makeLibraryPath [ openssl nim nimlibs ];
CACHE_PATH = toString ./cache;
NIX_ENFORCE_PURITY = 0;
shellHook = ''
#nimble run --hotcodereloading:on oeffisearch
nimble run oeffisearch
exit
'';
}

7
src/backend/hafas.nim Normal file
View file

@ -0,0 +1,7 @@
import hafas/api/journeys
import hafas/api/suggestions
import hafas/api/refresh_journey
export journeys
export suggestions
export refresh_journey

View file

@ -0,0 +1,79 @@
import ../parse/products
import ../parse/point
import ../parse/accessibility
import ../parse/journeys_response
import ../types
import ../util
import json
import times
import asyncdispatch
import options
proc journeys*(params: JourneysParams): Future[JourneysResponse] {.async.} =
var `when` = now().toTime()
var isDeparture = true
if params.departure.isSome:
`when` = params.departure.get.fromUnix
elif params.arrival.isSome:
`when` = params.arrival.get.fromUnix
isDeparture = false
let req = %* {
"cfg": {
"polyEnc": "GPA"
},
"meth": "TripSearch",
"req": {
"ctxScr": nil,
"getPasslist": params.stopovers.get(false),
"maxChg": params.transfers.get(-1),
"minChgTime": params.transferTime.get(0),
"numF": params.results.get(5),
"depLocL": [ params.fromPoint.formatPoint() ],
"viaLocL": [],
"arrLocL": [ params.toPoint.formatPoint() ],
"jnyFltrL": [
{
"type": "PROD",
"mode": "INC",
"value": $formatProducts(params.products.get(parseProducts(1023))),
},
{
"type": "META",
"mode": "INC",
"meta": formatAccessibility(params.accessibility.get(Accessibility.none)),
}
],
"gisFltrL": [],
"getTariff": params.tickets.get(true),
"ushrp": params.startWithWalking.get(true),
"getPT": true,
"getIV": false,
"getPolyline": params.polylines.get(false),
"outFrwd": isDeparture,
"outDate": `when`.format("yyyyMMdd"),
"outTime": `when`.format("HHmmss"),
"trfReq": {
"jnyCl": 2,
"tvlrProf": [
{
"type": "E",
"redtnCard": nil
}
],
"cType": "PK"
}
}
}
if params.laterRef.isSome:
req["req"]["ctxScr"] = %* params.laterRef.get
elif params.earlierRef.isSome:
req["req"]["ctxScr"] = %* params.earlierRef.get
if params.viaPoint.isSome:
let viaPoint = params.viaPoint.get
req["req"]["viaLocL"] = %* [{ "loc": viaPoint.formatPoint() }]
let data = await request(req)
return parseJourneysResponse(data)

View file

@ -0,0 +1,34 @@
import ../types
import ../parse/remark
import ../parse/point
import ../parse/operator
import ../parse/journey
import ../parse/line
import ../util
import json
import asyncdispatch
import options
import sequtils
proc refreshJourney*(params: RefreshJourneyParams): Future[Journey] {.async.} =
let req = %* {
"cfg": {
},
"meth": "Reconstruction",
"req": {
"ctxRecon": params.refreshToken,
"getIST": true,
"getPasslist": params.stopovers.get(false),
"getPolyline": params.polylines.get(false),
"getTariff": params.tickets.get(false),
}
}
let data = await request(req)
let points = map(data["res"]["common"]["locL"].getElems(), parsePoint)
let operators = map(data["res"]["common"]["opL"].getElems(), parseOperator)
let remarks = map(data["res"]["common"]["remL"].getElems(), parseRemark)
let lines = map(data["res"]["common"]["prodL"].getElems(), mkParseLine(operators))
let common = CommonData(points: points, operators: operators, remarks: remarks, lines: lines)
return common.mkParseJourney()(data["res"]["outConL"][0])

View file

@ -0,0 +1,29 @@
import ../../../types
import ../parse/point
import ../util
import json
import asyncdispatch
import sequtils
import options
proc suggestions*(params: SuggestionsParams): Future[seq[Point]] {.async.} =
let req = %* {
"cfg": {
"polyEnc": "GPA"
},
"meth": "LocMatch",
"req": {
"input": {
"loc": {
"type": "ALL",
"name": params.query & "?"
},
"maxLoc": params.results.get(10),
"field": "S"
}
}
}
let data = await request(req)
let locs = data["res"]["match"]["locL"].getElems()
return locs.map(parsePoint)

View file

@ -0,0 +1,6 @@
import ../types
proc formatAccessibility*(a: Accessibility): string =
if a == none: result = "notBarrierfree"
elif a == partial: result = "limitedBarrierfree"
elif a == complete: result = "completeBarrierfree"

View file

@ -0,0 +1,31 @@
import ../types
import options
import strutils
import times
proc parseDate*(common: CommonData, time: Option[string], tzoffset: Option[int]): Option[int64] =
if time.isNone:
return none(int64)
let tzoffset = tzoffset.get(60) # FIXME: sometimes no time zone is given. how to deal with that?
let date = common.dateStr
var time = time.get
var dayoffset = 0
if time.len == 8:
dayoffset = parseInt(time[0..1])
time = time[2..7]
var tzoffhours = align($(int(tzoffset / 60)), 2, '0')
var tzoffmins = align($(tzoffset mod 60), 2, '0')
var tzoff = tzoffhours & ":" & tzoffmins
if tzoffset >= 0:
tzoff = "+" & tzoff
let datestr = date & time & tzoff
let dateformat = "yyyyMMddHHmmsszzz"
var dt = datestr.parse(dateformat)
dt = dt + initTimeInterval(days = dayoffset)
return some(dt.toTime().toUnix())

View file

@ -0,0 +1,14 @@
import ../types
import json
import leg
proc mkParseJourney*(common: CommonData): proc =
proc parseJourney(j: JsonNode): Journey =
var common = common
common.dateStr = j{"date"}.getStr()
result.refreshToken = j{"ctxRecon"}.getStr()
result.legs = j{"secL"}.getElems().map(mkParseLeg(common))
result.lastUpdated = common.timeStamp
return parseJourney

View file

@ -0,0 +1,21 @@
import ../types
import ./remark
import ./point
import ./operator
import ./journey
import ./line
import json
import sequtils
import strutils
proc parseJourneysResponse*(data: JsonNode): JourneysResponse =
let points = map(data["res"]["common"]["locL"].getElems(), parsePoint)
let operators = map(data["res"]["common"]["opL"].getElems(), parseOperator)
let remarks = map(data["res"]["common"]["remL"].getElems(), parseRemark)
let lines = map(data["res"]["common"]["prodL"].getElems(), mkParseLine(operators))
let timestamp = parseInt(data["res"]["planrtTS"].getStr())
let common = CommonData(points: points, operators: operators, remarks: remarks, lines: lines, timestamp: timestamp)
result.journeys = data["res"]["outConL"].getElems().map(mkParseJourney(common))
result.earlierRef = data["res"]["outCtxScrB"].getStr()
result.laterRef = data["res"]["outCtxScrF"].getStr()

View file

@ -0,0 +1,60 @@
import ../types
import ./stopover
import ./msg
import ./date
import json
import options
proc parseLegPart(common: CommonData, lp: JsonNode): LegPart =
let h = lp.to(HafasStopParams)
let plannedDepartureTime = parseDate(common, h.dTimeS, h.dTZOffset)
let plannedArrivalTime = parseDate(common, h.aTimeS, h.aTZOffset)
if h.dPlatfS.isSome: result.plannedPlatform = h.dPlatfS
elif h.aPlatfS.isSome: result.plannedPlatform = h.aPlatfS
if h.dPlatfR.isSome: result.prognosedPlatform = h.dPlatfR
elif h.aPlatfR.isSome: result.prognosedPlatform = h.aPlatfR
if h.dTimeR.isSome: result.prognosedTime = parseDate(common, h.dTimeR, h.dTZOffset)
elif h.aTimeR.isSome: result.prognosedTime = parseDate(common, h.aTimeR, h.aTZOffset)
if plannedDepartureTime.isSome: result.plannedTime = plannedDepartureTime.get
elif plannedArrivalTime.isSome: result.plannedTime = plannedArrivalTime.get
else: raise newException(CatchableError, "missing departure and arrival time for leg")
result.point = common.points[h.locX.get]
proc mkParseLeg*(common: CommonData): proc =
proc parseLeg(l: JsonNode): Leg =
let typeStr = l{"type"}.getStr()
if typeStr == "JNY":
result.direction = some(l{"jny"}{"dirTxt"}.getStr())
result.tripId = some(l{"jny"}{"jid"}.getStr())
result.line = common.lines[l{"jny"}{"prodX"}.getInt()]
let stopovers = l{"jny"}{"stopL"}.getElems()
if stopovers.len > 0:
result.stopovers = some(stopovers.map(mkParseStopover(common)))
let remarks = l{"jny"}{"msgL"}.getElems()
if remarks.len > 0:
result.remarks = some(remarks.map(mkParseMsg(common)))
elif typeStr == "WALK" or typeStr == "TRSF":
result.isWalking = true
result.distance = some(l{"gis"}{"dist"}.getInt())
elif typeStr == "DEVI":
result.isTransfer = true
result.distance = some(l{"gis"}{"dist"}.getInt())
else:
raise newException(CatchableError, "Unimplemented hafas leg type: " & typeStr)
result.departure = common.parseLegPart(l{"dep"})
result.arrival = common.parseLegPart(l{"arr"})
result.cancelled = l{"dep"}{"dCncl"}.getBool(false) or l{"arr"}{"aCncl"}.getBool(false)
return parseLeg

View file

@ -0,0 +1,41 @@
import ../types
import ../util
import ./products
import json
import options
proc mkParseLine*(commonOperators: seq[Operator]): proc =
proc parseLine(l: JsonNode): Option[Line] =
# unparsable
if l{"cls"}.getInt == 0:
return options.none(Line)
let line = l.to(HafasProd)
var res = Line()
res.name = line.name
res.product = parseProduct(line.cls)
res.tripNum = line.prodCtx.num
res.productName = line.prodCtx.catOut
res.fullProductName = line.prodCtx.catOutL
res.id = slug(line.prodCtx.lineId.get(line.name))
if line.opX.isSome:
res.operator = some(commonOperators[line.opX.get])
# DB
if line.nameS.isSome and (res.product == bus or res.product == tram or res.product == ferry):
res.name = line.nameS.get
if line.addName.isSome:
# swap name and addName
res.additionalName = some(res.name)
res.name = line.addName.get
# End DB
res.mode = MODES[int(res.product)]
return some(res)
return parseLine

View file

@ -0,0 +1,12 @@
import ../types
import json
proc mkParseMsg*(common: CommonData): proc =
proc parseMsg(m: JsonNode): Remark =
let typeStr = m{"type"}.getStr()
if typeStr != "REM":
raise newException(CatchableError, "Unimplemented hafas msg type: " & typeStr)
return common.remarks[m{"remX"}.getInt()]
return parseMsg

View file

@ -0,0 +1,9 @@
import ../../../types
import ../util
import json
proc parseOperator*(op: JsonNode): Operator =
return (%* {
"name": op{"name"},
"id": %* slug(op{"name"}.getStr()),
}).to(Operator)

View file

@ -0,0 +1,78 @@
import ../types
import ./products
import json
import options
import tables
proc parsePoint*(loc: JsonNode): Point =
let typeStr = loc{"type"}.getStr()
if typeStr == "S":
result.stop = some(Stop(
id: loc{"extId"}.getStr(),
name: loc{"name"}.getStr(),
location: Location(
latitude: loc{"crd"}{"y"}.getInt() / 1000000,
longitude: loc{"crd"}{"x"}.getInt() / 1000000,
),
products: parseProducts(loc{"pCls"}.getInt()),
))
elif typeStr == "P":
result.location = some(Location(
id: some(loc{"extId"}.getStr()),
name: some(loc{"name"}.getStr()),
latitude: loc{"crd"}{"y"}.getInt() / 1000000,
longitude: loc{"crd"}{"x"}.getInt() / 1000000,
))
elif typeStr == "A":
result.location = some(Location(
address: some(loc{"name"}.getStr()),
latitude: loc{"crd"}{"y"}.getInt() / 1000000,
longitude: loc{"crd"}{"x"}.getInt() / 1000000,
))
else:
raise newException(CatchableError, "Unimplemented hafas loc type: " & typeStr)
proc formatLocationIdentifier(d: Table[string, string]): string =
for key, val in d:
result &= key
result &= "="
result &= val
result &= "@"
proc formatCoord(c: float): string =
return $int(c * 1000000)
proc formatPoint*(point: Point): JsonNode =
if point.stop.isSome:
let stop = point.stop.get
return %* {
"type": "S",
"lid": formatLocationIdentifier({
"A": "1",
"L": $stop.id,
}.toTable),
}
elif point.location.isSome:
let loc = point.location.get
if loc.address.isSome:
return %* {
"type": "A",
"lid": formatLocationIdentifier({
"A": "2",
"O": loc.address.get,
"X": formatCoord(loc.longitude),
"Y": formatCoord(loc.latitude),
}.toTable),
}
elif loc.name.isSome and loc.id.isSome:
return %* {
"type": "P",
"lid": formatLocationIdentifier({
"A": "4",
"O": loc.address.get,
"L": loc.id.get,
"X": formatCoord(loc.longitude),
"Y": formatCoord(loc.latitude),
}.toTable),
}
raise newException(CatchableError, "Cannot format HAFAS location")

View file

@ -0,0 +1,37 @@
import ../../../types
import bitops
proc parseProduct*(cls: int): Product =
var tmp = cls
var res = 0
while tmp > 1:
tmp = tmp shr 1
res += 1
return Product(res)
proc parseProducts*(pCls: int): Products =
return Products(
nationalExp: pCls.testBit(0),
national: pCls.testBit(1),
regionalExp: pCls.testBit(2),
regional: pCls.testBit(3),
suburban: pCls.testBit(4),
bus: pCls.testBit(5),
ferry: pCls.testBit(6),
subway: pCls.testBit(7),
tram: pCls.testBit(8),
taxi: pCls.testBit(9),
)
proc formatProducts*(p: Products): int =
if p.nationalExp: result.setBit(0)
if p.national: result.setBit(1)
if p.regionalExp: result.setBit(2)
if p.regional: result.setBit(3)
if p.suburban: result.setBit(4)
if p.bus: result.setBit(5)
if p.ferry: result.setBit(6)
if p.subway: result.setBit(7)
if p.tram: result.setBit(8)
if p.taxi: result.setBit(9)

View file

@ -0,0 +1,32 @@
import ../../../types
import json
proc parseRemark*(rem: JsonNode): Remark =
let typeStr = rem{"type"}.getStr()
if typeStr == "M" or typeStr == "P":
return (%* {
"type": %* "status",
"summary": rem{"txtS"},
"code": rem{"code"},
"text": rem{"txtN"},
}).to(Remark)
elif typeStr == "L":
return (%* {
"type": %* "status",
"code": %* "alternative-trip",
"text": rem{"txtN"},
"tripId": rem{"jid"},
}).to(Remark)
elif typeStr == "A" or typeStr == "I" or typeStr == "H":
return (%* {
"type": %* "hint",
"code": rem{"code"},
"text": rem{"txtN"},
}).to(Remark)
else:
# TODO: parse more accurately
return (%* {
"type": %* "status",
"code": rem{"code"},
"text": rem{"txtN"},
}).to(Remark)

View file

@ -0,0 +1,33 @@
import ../types
import ./date
import options
import json
proc parseStopoverPart(common: CommonData, mode: string, h: HafasStopParams): StopoverPart =
if (mode != "arrival"):
result.plannedPlatform = h.dPlatfS
result.prognosedPlatform = h.dPlatfR
result.plannedTime = parseDate(common, h.dTimeS, h.dTZOffset)
result.prognosedTime = parseDate(common, h.dTimeR, h.dTZOffset)
else:
result.plannedPlatform = h.aPlatfS
result.prognosedPlatform = h.aPlatfR
result.plannedTime = parseDate(common, h.aTimeS, h.aTZOffset)
result.prognosedTime = parseDate(common, h.aTimeR, h.aTZOffset)
proc mkParseStopover*(common: CommonData): proc =
proc parseStopover(s: JsonNode): Stopover =
let typeStr = s{"type"}.getStr()
if typeStr != "N":
echo pretty(s)
raise newException(CatchableError, "Unimplemented hafas stopover type: " & typeStr)
let h = s.to(HafasStopParams)
result.stop = common.points[s{"locX"}.getInt()].stop.get
result.cancelled = h.aCncl.get(false) or h.dCncl.get(false)
result.arrival = common.parseStopoverPart("arrival", h)
result.departure = common.parseStopoverPart("departure", h)
return parseStopover

10
src/backend/hafas/todo Normal file
View file

@ -0,0 +1,10 @@
- implement leg parsing with nim types
- check and pass back hafas errors
- isAdd (is additional stop)
- hafas information manager (him) remarks
- cycle information
- price information
- reachable
- profiles
- mark current alternatives
- stations

View file

@ -0,0 +1,43 @@
import ../../types
import options
export types
type
CommonData* = object
lines*: seq[Option[Line]]
remarks*: seq[Remark]
operators*: seq[Operator]
points*: seq[Point]
dateStr*: string
timestamp*: int64
HafasStopParams* = object
aTimeS*: Option[string]
aPlatfS*: Option[string]
aTZOffset*: Option[int]
aCncl*: Option[bool]
aTimeR*: Option[string]
aPlatfR*: Option[string]
dTimeS*: Option[string]
dPlatfS*: Option[string]
dTZOffset*: Option[int]
dCncl*: Option[bool]
dTimeR*: Option[string]
dPlatfR*: Option[string]
locX*: Option[int]
HafasProdCtx* = object
name*: string
num*: string
catOut*: string
catOutL*: string
lineId*: Option[string]
HafasProd* = object
name*: string
cls*: int
icoX*: int
nameS*: Option[string]
addName*: Option[string]
opX*: Option[int]
prodCtx*: HafasProdCtx

View file

@ -0,0 +1,50 @@
import httpclient
import asyncdispatch
import md5
import json
import strutils
proc slug*(s: string): string =
for c in s:
if c.isAlphaNumeric():
result &= c.toLowerAscii()
else:
result &= '-'
proc request*(req: JsonNode): Future[JsonNode] {.async.} =
let client = newAsyncHttpClient()
let body = %*{
"lang": "de",
"svcReqL": [req]
}
# TODO: move to profile
body["svcReqL"][0]["cfg"]["rtMode"] = %* "HYBRID"
body["client"] = %* {
"id": "DB",
"v": "16040000",
"type": "IPH",
"name": "DB Navigator"
}
body["ext"] = %* "DB.R19.04.a"
body["ver"] = %* "1.16"
body["auth"] = %* {
"type": "AID",
"aid": "n91dB8Z77MLdoR0K"
}
let salt = "bdI8UVj40K5fvxwf"
let bodytext = $body
let checksum = $toMD5(bodytext & salt)
let url = "https://reiseauskunft.bahn.de/bin/mgate.exe?checksum=" & checksum
client.headers = newHttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json",
"user-agent": "my-awesome-e5f276d8fe6cprogram",
})
#echo pretty body
let req = await client.request(url, httpMethod = HttpPost, body = $body)
let resp = await req.body
return parseJson(resp){"svcResL"}{0}

82
src/cache.nim Normal file
View file

@ -0,0 +1,82 @@
import tables, random, os, times, json, asyncfile, asyncdispatch
import types, cache_types, utils
randomize()
proc cacheExists* (id: string ): bool =
return existsFile(getEnv("CACHE_PATH") & "/" & $id & ".json")
proc getFreeId (): string =
result = toAlphaId(int32(rand(high(int32))))
while existsFile(getEnv("CACHE_PATH") & "/" & $result & ".json"):
result = toAlphaId(int32(rand(high(int32))))
proc getCacheObject* (reqId: string): CacheObject =
if not cacheExists(reqId): raise newException(notFoundException, "REQUEST_NOT_FOUND")
return parseFile(getEnv("CACHE_PATH") & "/" & $reqId & ".json").to(CacheObject)
proc saveJourneys* (params: JourneysParams, journeysResponse: JourneysResponse): Future[CacheObject] {.async.} =
let reqId = getFreeId()
let lastUpdated = getTime().toUnix()
var journeys = initTable[string, Journey]()
var maxId = -1
for journey in journeysResponse.journeys:
inc(maxId)
journeys.add($maxId, journey)
var cacheObj = CacheObject(
version: 1,
reqId: reqId,
minId: 0,
maxId: maxId,
earlierRef: journeysResponse.earlierRef,
laterRef: journeysResponse.laterRef,
lastUpdated: lastUpdated,
params: params,
journeys: journeys
)
var file = openAsync(getEnv("CACHE_PATH") & "/" & $reqId & ".json", fmReadWrite)
await file.write($(%* cacheObj))
return cacheObj
proc updateJourneys* (reqId: string, mode: moreJourneysMode, journeysResponse: JourneysResponse): Future[CacheObject] {.async.} =
var cacheObj = getCacheObject(reqId)
if mode == earlier:
cacheObj.minId -= journeysResponse.journeys.len
var cnt = cacheObj.minId
for journey in journeysResponse.journeys:
cacheObj.journeys.add($cnt, journey)
inc(cnt)
else:
for journey in journeysResponse.journeys:
inc(cacheObj.maxId)
cacheObj.journeys.add($cacheObj.maxId, journey)
cacheObj.lastUpdated = getTime().toUnix()
if mode != later:
cacheObj.earlierRef = journeysResponse.earlierRef
else:
cacheObj.laterRef = journeysResponse.laterRef
var file = openAsync(getEnv("CACHE_PATH") & "/" & $reqId & ".json", fmReadWrite)
await file.write($(%* cacheObj))
return cacheObj
proc updateJourney* (reqId: string, journeyId: string, journey: Journey): Future[CacheObject] {.async.} =
var cacheObj = getCacheObject(reqId)
cacheObj.lastUpdated = getTime().toUnix()
cacheObj.journeys.add(journeyId, journey)
var file = openAsync(getEnv("CACHE_PATH") & "/" & $reqId & ".json", fmReadWrite)
await file.write($(%* cacheObj))
return cacheObj

17
src/cache_types.nim Normal file
View file

@ -0,0 +1,17 @@
import tables
import types
type
moreJourneysMode* = enum
later, earlier
CacheObject* = object
version*: int
reqId*: string
minId*: int
maxId*: int
earlierRef*: string
laterRef*: string
lastUpdated*: int64
params*: JourneysParams
journeys*: Table[string, Journey]

View file

@ -0,0 +1,60 @@
import json, tables, options, asyncdispatch, sequtils
import ../types, ../backend/hafas, ../cache
when not defined(release):
import hotcodereloading
proc journeysEndpoint*(requestData: JsonNode): Future[JsonNode] {.async.} =
when not defined(release):
performCodeReload()
echo "foo"
var reqId = requestData{"reqId"}.getStr()
if reqId != "":
if not cacheExists(reqId): raise newException(notFoundException, "REQUEST_NOT_FOUND")
let cacheObj = getCacheObject(reqId)
var response = %* {
"reqId": cacheObj.reqId,
"lastUpdated": cacheObj.lastUpdated,
"params": cacheObj.params,
"journeys": {}
}
for key, journey in pairs(cacheObj.journeys):
response["journeys"].add(key, %* journey)
delete(response["journeys"][key], "refreshToken")
delete(response["journeys"][key], "cycle")
for legKey, leg in pairs(journey.legs):
delete(response["journeys"][key]["legs"][legKey], "cycle")
delete(response["journeys"][key]["legs"][legKey], "tripId")
return response
else:
var params = requestData["params"].to(JourneysParams)
params.stopovers = some(true)
params.polylines = some(true)
params.remarks = some(true)
params.tickets = some(true)
let cacheObj = (await saveJourneys(params, await journeys(params)))
var response = %* {
"reqId": cacheObj.reqId,
"lastUpdated": cacheObj.lastUpdated,
"params": cacheObj.params,
"journeys": {}
}
for key, journey in pairs(cacheObj.journeys):
response["journeys"].add(key, %* journey)
delete(response["journeys"][key], "refreshToken")
delete(response["journeys"][key], "cycle")
for legKey, leg in pairs(journey.legs):
delete(response["journeys"][key]["legs"][legKey], "cycle")
delete(response["journeys"][key]["legs"][legKey], "tripId")
return response

View file

@ -0,0 +1,42 @@
import json, tables, options, asyncdispatch, strutils
import ../types, ../cache_types, ../backend/hafas, ../cache
proc moreJourneysEndpoint*(requestData: JsonNode): Future[JsonNode] {.async.} =
var reqId = requestData{"reqId"}.getStr()
var mode = later
if reqId != "":
if not cacheExists(reqId): raise newException(notFoundException, "REQUEST_NOT_FOUND")
if requestData{"mode"}.getStr() != "":
mode = parseEnum[moreJourneysMode](requestData{"mode"}.getStr())
var cacheObj = getCacheObject(reqId)
var params = cacheObj.params
if mode != later:
params.earlierRef = some(cacheObj.earlierRef)
else:
params.laterRef = some(cacheObj.laterRef)
let journeys = await journeys(params)
cacheObj = (await updateJourneys(reqId, mode, journeys))
var response = %* {
"reqId": cacheObj.reqId,
"lastUpdated": cacheObj.lastUpdated,
"params": cacheObj.params,
"journeys": {}
}
for key, journey in pairs(cacheObj.journeys):
response["journeys"].add(key, %* journey)
delete(response["journeys"][key], "refreshToken")
delete(response["journeys"][key], "cycle")
for legKey, leg in pairs(journey.legs):
delete(response["journeys"][key]["legs"][legKey], "cycle")
delete(response["journeys"][key]["legs"][legKey], "tripId")
return response
else:
raise newException(errorException, "MISSING_VALUES")

View file

@ -0,0 +1,37 @@
import json, tables, options, asyncdispatch, strutils
import ../types, ../cache_types, ../backend/hafas, ../cache
proc refreshJourneyEndpoint*(requestData: JsonNode): Future[JsonNode] {.async.} =
let reqId = requestData{"reqId"}.getStr()
let journeyId = requestData{"journeyId"}.getStr()
if reqId == "": raise newException(errorException, "MISSING_VALUES")
if journeyId == "": raise newException(errorException, "MISSING_VALUES")
if not cacheExists(reqId): raise newException(notFoundException, "REQUEST_NOT_FOUND")
var cacheObj = getCacheObject(reqId)
if not cacheObj.journeys.hasKey(journeyId): raise newException(notFoundException, "JOURNEY_NOT_FOUND")
let journey = await refreshJourney(RefreshJourneyParams(
refreshToken: cacheObj.journeys[journeyId].refreshToken,
stopovers: some(true),
polylines: some(true),
tickets: some(true),
))
cacheObj = await updateJourney(reqId, journeyId, journey)
var response = %* {
"reqId": cacheObj.reqId,
"lastUpdated": cacheObj.lastUpdated,
"journeys": {}
}
response["journeys"].add(journeyId, %* journey)
delete(response["journeys"][journeyId], "refreshToken")
delete(response["journeys"][journeyId], "cycle")
for legKey, leg in pairs(journey.legs):
delete(response["journeys"][journeyId]["legs"][legKey], "cycle")
delete(response["journeys"][journeyId]["legs"][legKey], "tripId")
return response

View file

@ -0,0 +1,5 @@
import json, options, asyncdispatch
import ../types, ../backend/hafas
proc suggestionsEndpoint* (data: JsonNode): Future[JsonNode] {.async.} =
return %* (await suggestions(data.to(SuggestionsParams)))

38
src/fileserver.nim Normal file
View file

@ -0,0 +1,38 @@
# inspired by https://github.com/h3rald/nimhttpd
import asynchttpserver
import types
import mimetypes
import uri
import os
import strutils
var mimes {.threadvar.}: MimeDB
proc initFileserver*() =
mimes = newMimeTypes()
proc sendStaticFile(path: string): NimHttpResponse =
var ext = path.splitFile.ext
if ext == "":
ext = ".txt"
ext = ext[1 .. ^1]
let mimetype = mimes.getMimetype(ext.toLowerAscii)
var file = path.readFile
return NimHttpResponse(
code: Http200,
msg: file,
headers: {"Content-Type": mimetype}.newHttpHeaders
)
proc servePath*(req: Request): NimHttpResponse =
let path = "client" & req.url.path.decodeUrl()
#if path.existsDir:
# return sendDirContents(path)
if path.existsFile:
return sendStaticFile(path)
if existsFile(path & "index.html"):
return sendStaticFile(path & "index.html")
else:
raise newException(notFoundException, "NOT_FOUND")

65
src/oeffisearch.nim Normal file
View file

@ -0,0 +1,65 @@
import json, tables, os, httpcore, asynchttpserver, asyncdispatch, uri, strutils
import types, endpoints/[suggestions, journeys, moreJourneys, refreshJourney]
when not defined(release):
echo "running in development mode, for production compile with -d:release"
import fileserver
var endpoints {.threadvar.}: Table[string, proc(data: JsonNode): Future[JsonNode] {.gcsafe.}]
proc handleRequest(req: Request) {.async,gcsafe.} =
var resp = NimHttpResponse(
code: Http404,
msg: $(%* {"status": "error", "msg": "ENDPOINT_NOT_FOUND", "data": {}}),
headers: {"Content-Type": "application/json", "Access-Control-Allow-Origin": "*"}.newHttpHeaders,
)
try:
if endpoints.hasKey($req.reqMethod & req.url.path):
resp.code = Http200
resp.msg = $(%* {
"status": "success",
"msg": "",
"data": (await endpoints[$req.reqMethod & req.url.path](parseJson(decodeUrl(req.url.query))))
})
else:
when not defined(release):
# development server
resp = servePath(req)
except notFoundException:
resp.code = Http404
resp.msg = $(%* {"status": "error", "msg": getCurrentExceptionMsg().split("\n")[0], "data": {}})
except:
resp.code = Http500
resp.msg = $(%* {"status": "error", "msg": getCurrentExceptionMsg().split("\n")[0], "data": {}})
echo repr(getCurrentException())
await req.respond(resp.code, resp.msg, resp.headers)
proc main() =
endpoints = initTable[string, proc(data: JsonNode): Future[JsonNode] {.gcsafe.}]()
endpoints.add($HttpGet & "/suggestions", suggestionsEndpoint)
endpoints.add($HttpGet & "/journeys", journeysEndpoint)
endpoints.add($HttpGet & "/moreJourneys", moreJourneysEndpoint)
endpoints.add($HttpGet & "/refreshJourney", refreshJourneyEndpoint)
if getEnv("CACHE_PATH") == "":
echo "CACHE_PATH not set! Bye...."
quit()
else:
discard existsOrCreateDir(getEnv("CACHE_PATH"))
var port = 8081
if getEnv("PORT") != "":
port = parseInt(getEnv("PORT"))
let server = newAsyncHttpServer()
initFileserver()
echo "starting webserver on port " & $port
waitFor server.serve(Port(port), handleRequest)
main()

180
src/types.nim Normal file
View file

@ -0,0 +1,180 @@
import options
import asynchttpserver
type
NimHttpResponse* = object
code*: HttpCode
msg*: string
headers*: HttpHeaders
Stop* = object
id*: string
name*: string
location*: Location
products*: Products
station*: Option[Station]
Station* = object
id*: int
name*: string
location*: Location
products*: Products
Location* = object
latitude*: float
longitude*: float
name*: Option[string]
address*: Option[string]
id*: Option[string]
Product* = enum
nationalExp, national, regionalExp, regional, suburban, bus, ferry, subway, tram, taxi
Mode* = enum
Train, Bus, Watercraft, Taxi, Walking
Products* = object
nationalExp*: bool
national*: bool
regionalExp*: bool
regional*: bool
suburban*: bool
bus*: bool
ferry*: bool
subway*: bool
tram*: bool
taxi*: bool
Point* = object
stop*: Option[Stop]
location*: Option[Location]
Journey* = object
refreshToken*: string
lastUpdated*: int64
legs*: seq[Leg]
cycle*: Option[Cycle]
price*: Option[Price]
LegPart* = object
point*: Point
plannedTime*: int64
prognosedTime*: Option[int64]
plannedPlatform*: Option[string]
prognosedPlatform*: Option[string]
Leg* = object
isWalking*: bool
isTransfer*: bool
cancelled*: bool
departure*: LegPart
arrival*: LegPart
distance*: Option[int] # required for isWalking or isTransfer
tripId*: Option[string] # required for not isWalking and not isTranfer
line*: Option[Line] # required for not isWalking and not isTranfer
direction*: Option[string] # required for not isWalking and not isTranfer
cycle*: Option[Cycle]
stopovers*: Option[seq[Stopover]]
remarks*: Option[seq[Remark]]
Line* = object
id*: string
name*: string
mode*: Mode
product*: Product
tripNum*: string
productName*: string
fullProductName*: string
operator*: Option[Operator]
additionalName*: Option[string]
Operator* = object
id*: string
name*: string
Cycle* = object
min*: Option[int]
max*: Option[int]
nr*: Option[int]
Price* = object
amount*: Option[float]
currency*: Option[string]
hint*: Option[string]
StopoverPart* = object
plannedTime*: Option[int64]
prognosedTime*: Option[int64]
plannedPlatform*: Option[string]
prognosedPlatform*: Option[string]
Stopover* = object
stop*: Stop
cancelled*: bool
departure*: StopoverPart
arrival*: StopoverPart
Remark* = object
`type`*: Option[string]
code*: Option[string]
summary*: Option[string]
text*: Option[string]
tripId*: Option[string]
JourneysResponse* = object
earlierRef*: string
laterRef*: string
journeys*: seq[Journey]
Accessibility* = enum
none, partial, complete
SuggestionsParams* = object
query*: string
results*: Option[int] #default value: 10
stations*: Option[bool] #default value: true
poi*: Option[bool] #default value: true
addresses*: Option[bool] #default value: true
JourneysParams* = object
fromPoint*: Point
toPoint*: Point
viaPoint*: Option[Point] #default value: null support in hafas backend: ✅
earlierRef*: Option[string] #default value: null support in hafas backend: ✅
laterRef*: Option[string] #default value: null support in hafas backend: ✅
results*: Option[int] #default value: 5 support in hafas backend: ✅
stopovers*: Option[bool] #default value: false support in hafas backend: ✅
polylines*: Option[bool] #default value: false support in hafas backend: ✅
remarks*: Option[bool] #default value: true support in hafas backend:
bikeFriendly*: Option[bool] #default value: false support in hafas backend:
tickets*: Option[bool] #default value: false support in hafas backend: ✅
startWithWalking*: Option[bool] #default value: true support in hafas backend: ✅
scheduledDays*: Option[bool]
accessibility*: Option[Accessibility] #default value: none support in hafas backend: ✅
transfers*: Option[int] #default value: -1 support in hafas backend: ✅
transferTime*: Option[int] #default value: 00 support in hafas backend: ✅
arrival*: Option[int64] #default value: null support in hafas backend: ✅
departure*: Option[int64] #default value: null support in hafas backend: ✅
products*: Option[Products] #default value: all true support in hafas backend: ✅
RefreshJourneyParams* = object
refreshToken*: string
stopovers*: Option[bool] #default value: false support in hafas backend: ✅
polylines*: Option[bool] #default value: false support in hafas backend: ✅
tickets*: Option[bool] #default value: false support in hafas backend: ✅
notFoundException* = object of Exception
errorException* = object of Exception
const MODES* = [
Train, # nationalExp
Train, # national
Train, # regionalExp
Train, # regional
Train, # suburban
Bus, # bus
Watercraft, # ferry
Train, # subway
Train, # tram
Taxi, # taxi
]

31
src/utils.nim Normal file
View file

@ -0,0 +1,31 @@
import parseutils, times, json
proc toAlphaId* (n: int): string =
let chars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var tmp = n
var digitValue: int = 1
var digit: int = 0
while tmp > 0:
digitValue *= chars.len
digit = tmp mod digitValue
let char = int(digit * chars.len / digitValue)
result = $(chars[char]) & result
tmp -= digit
proc fromAlphaId* (s: string): int =
let chars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for char in s:
result *= chars.len
result += chars.skipUntil(char)
proc iso8601toUnix* (iso8601string: string): int64 =
let date = parse(iso8601string, "yyyy-MM-dd'T'HH:mm:sszzz")
return toUnix(toTime(date))
proc mergeJObjects* (root: JsonNode, new: JsonNode): JsonNode =
result = root
for key, value in new:
result.add(key, value)