Compare commits

...

No commits in common. "master" and "dev" have entirely different histories.
master ... dev

77 changed files with 11465 additions and 13892 deletions

3
.browserslistrc Normal file
View File

@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

17
.drone.yml Normal file
View File

@ -0,0 +1,17 @@
kind: pipeline
name: default
steps:
- name: version
image: alpine
commands:
- sed -i 's/module\.exports.*//' version.js
- echo "module.exports = '$(date)';" >> version.js
- name: docker build
image: plugins/docker
settings:
repo: registry:5000/appreports
registry: registry:5000
dockerfile: dockerfile
insecure: true

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
/dist/
*.d.ts

10
.eslintrc.js Normal file
View File

@ -0,0 +1,10 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, July 2020
*/
'use strict';
module.exports = { extends: [ '@sapphirecode' ] };

28
.gitignore vendored
View File

@ -1,3 +1,25 @@
/node_modules/ .DS_Store
/config.json node_modules
/html/ /dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.sqlite
!/data/test.sqlite

8
.liconfig.json Normal file
View File

@ -0,0 +1,8 @@
{
"has_license": true,
"license": "GPL-3.0-or-later",
"author": "Timo Hocker",
"company": "Sapphirecode",
"email": "timo@scode.ovh",
"software": "appreports"
}

643
LICENSE
View File

@ -1,674 +1,251 @@
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Version 3, 29 June 2007
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble Copyright © 2007 <author>
The GNU General Public License is a free, copyleft license for Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
software and other kinds of works.
The licenses for most software and other practical works are designed Preamble
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is 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. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not The GNU General Public License is a free, copyleft license for software and other kinds of works.
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.
To protect your rights, we need to prevent others from denying you The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is 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. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether 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.
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps: To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
modification follow.
TERMS AND CONDITIONS Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions. 0. Definitions.
"This License" refers to version 3 of the GNU General Public License. "This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this "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.
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 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.
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 A "covered work" means either the unmodified Program or a work based on the Program.
on the Program.
To "propagate" a work means to do anything with it that, without 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.
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 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.
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" 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.
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. 1. Source Code.
The "source code" for a work means the preferred form of the work 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.
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 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.
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 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.
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 "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 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 The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that The Corresponding Source for a work in source code form is that same work.
same work.
2. Basic Permissions. 2. Basic Permissions.
All rights granted under this License are granted for the term of 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.
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 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.
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 Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological 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.
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 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.
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. 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you 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.
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, 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.
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions. 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to 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:
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 a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is 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".
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 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.
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 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.
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 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.
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. 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms 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:
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 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.
(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 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.
(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 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.
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 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.
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 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.
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 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.
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 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.
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, "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.
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 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).
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 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.
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, 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.
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. 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this "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.
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 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.
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 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:
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 a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices 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
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 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
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 d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
authors of the material; or
e) Declining to grant rights under trademark law for use of some e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that 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.
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 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.
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 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.
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 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.
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination. 8. Termination.
You may not propagate or modify a covered work except as expressly 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).
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 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.
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 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.
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 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.
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. 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or 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.
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. 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically 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.
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 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.
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 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.
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. 11. Patents.
A "contributor" is a copyright holder who authorizes use under this 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".
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 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.
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 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.
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 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.
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, 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.
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 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.
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 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.
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 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.
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. 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or 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.
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. Use with the GNU Affero General Public License. 13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have 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 Affero 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 special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero 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 special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License. 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of The Free Software Foundation may publish revised and/or new versions of the GNU 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.
the GNU 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 Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU 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 General Public License, you may choose any version ever published by the Free Software Foundation.
Program specifies that a certain numbered version of the GNU 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 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 If the Program specifies that a proxy can decide which future versions of the GNU 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.
versions of the GNU 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 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.
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. 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 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.
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. 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 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.
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. 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided 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
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 How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
If you develop a new program, and you want it to be of the greatest To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest <one line to give the program's name and a brief idea of what it does.>
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author> <program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school, This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box".
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/ licenses /why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -1,80 +0,0 @@
# AppReports
Collects error reports from http capable apps over http-post requests. Reports
are stored in a postgresql database and can be viewed by accessing the server
using a browser.
## Installation
### Setting up the server
```bash
git clone https://git.scode.ovh/timo/appreports
cd appreports
npm i
```
### Setting up the database
run the following sql script:
```sql
-- create user and database
create database appreports;
create user appreports with encrypted password '12345';
grant all privileges on database appreports to appreports;
```
### Configuration
- make a copy of the template:
`cp config.template.json config.json`
- edit the config.json to your preferences
## Usage
### Starting the server
run the following command in the server folder
```bash
nodejs index.js
```
### Sending an error report
Example in js:
```js
const appClientId = 'abcdefg';
window.onerror = async function(msg, source, lineno, colno, error) {
let data;
if (error) {
data = {
app: 'app1',
type: 'error',
client: appClientId,
message: msg,
stack: error.stack,
misc: `v: ${appVersion} src: ${source} ln: ${lineno} col: ${colno}`
};
} else {
data = { app: 'app1', type: 'error', client: appClientId, message: msg };
}
fetch('http://localhost:8080', {
method: 'POST',
body: JSON.stringify(data),
mode: 'no-cors'
});
};
```
to view the reports open http://localhost:8080 with a browser (in case of the
default config)
## License
[GNU General Public License v3.0 or later © Timo Hocker](./LICENSE)

10
babel.config.js Normal file
View File

@ -0,0 +1,10 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, July 2020
*/
'use strict';
module.exports = { presets: [ '@vue/cli-plugin-babel/preset' ] };

View File

@ -1,5 +0,0 @@
cd web
call npm run build
mkdir ../html
robocopy ./dist ../html /MIR
cd ..

View File

@ -1,4 +0,0 @@
cd web
npm run build
cp -R ./dist ../html
cd ..

View File

@ -1,16 +0,0 @@
{
"database": {
"host": "127.0.0.1",
"port": "5432",
"user": "appreports",
"password": "12345",
"database": "appreports"
},
"port": "8080",
"restrictClients": false,
"allowedClients": [
"127.0.0.1",
"::1"
],
"clearLogAfterDays": -1
}

BIN
data/test.sqlite Normal file

Binary file not shown.

12
dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM node:lts-alpine
RUN mkdir /appreports
WORKDIR /appreports
COPY . .
RUN yarn; \
yarn compile;
EXPOSE 3000
ENTRYPOINT ["node", "index.js"]

105
index.js
View File

@ -1,80 +1,41 @@
const fs = require('fs'); /*
const express = require('express'); * Copyright (C) Sapphirecode - All Rights Reserved
const bodyParser = require('body-parser'); * This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
const config = JSON.parse(fs.readFileSync('config.json', 'utf-8')); /* eslint-disable no-console */
// @ts-nocheck
'use strict';
const pg = require('postgresupdater')( const express = require ('express');
config.database.host, const body_parser = require ('body-parser');
config.database.port, const db = require ('./lib/db');
config.database.user, const api = require ('./lib/api');
config.database.password, const http_proxy = require ('express-http-proxy');
config.database.database const history_fallback = require ('connect-history-api-fallback');
); const { argv } = require ('yargs');
const version = require ('./version');
const app = express(); const is_dev = argv.dev;
const tryParseJSON = function(text) { console.log (`starting appreports build ${version}`);
try {
return JSON.parse(text);
} catch {
console.log('invalid json');
}
};
app.use(bodyParser.text({ type: '*/*' })); (async () => {
await db.init (is_dev);
app.post('/', (req, res, next) => { const app = express ();
const json = tryParseJSON(req.body); app.use (body_parser.json ());
if (typeof req.query.json != 'undefined') {
//json mod requests
} else {
pg.query(
`INSERT INTO "Log" ("App", "Type", "Client", "Message", "Misc", "Stack") Values($1, $2, $3, $4, $5, $6)`,
[json.app, json.type, json.client, json.message, json.misc, json.stack]
);
}
res.status(201).end();
next();
});
app.get('/', async (req, res, next) => { app.use (api);
if (typeof req.query.json != 'undefined') { app.use (history_fallback ());
if ( if (is_dev)
config.restrictClients && app.use (http_proxy ('localhost:8080'));
!config.allowedClients.includes(req.connection.remoteAddress) else
) { app.use (express.static ('dist'));
console.log('blocked request from ' + req.connection.remoteAddress);
res.status(403).end();
return;
}
const data = await pg.query( app.listen (3000, () => {
`SELECT "ID", "Timestamp", "Type", "App", "Client", "Message", "Misc", "Stack" FROM "Log" ORDER BY "Timestamp" ASC` console.log ('listening on 3000');
); });
const rows = []; }) ();
const headings = data.rows.length > 0 ? Object.keys(data.rows[0]) : [];
const hiddenData = [0];
for (let row of data.rows) {
rows.push(Object.values(row));
}
res
.status(200)
.type('application/json')
.end(
JSON.stringify({ headings: headings, data: rows, hidden: hiddenData })
);
try {
const clearLogInterval = Number.parseInt(config.clearLogAfterDays);
if (clearLogInterval > 0)
await pg.query(`DELETE FROM "Log" WHERE "Timestamp" < now() - interval '${clearLogInterval} days'`);
} catch (e) {}
} else {
next();
}
});
app.use(express.static('html'));
app.listen(config.port);
console.log('server listening on', config.port);

17
lib/api/dump.js Normal file
View File

@ -0,0 +1,17 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
/* eslint-disable no-console */
'use strict';
module.exports = (req, res, next) => {
console.log (req.method, req.originalUrl);
console.log (JSON.stringify (req.headers));
console.log ('');
console.log (JSON.stringify (req.body, null, 2));
next ();
};

17
lib/api/get-app.js Normal file
View File

@ -0,0 +1,17 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
const db = require ('../db');
const { http } = require ('@sapphirecode/consts');
module.exports = async (req, res) => {
const apps = await db.app.get_all ();
res.status (http.status_ok)
.json (apps);
};

30
lib/api/get-log.js Normal file
View File

@ -0,0 +1,30 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
const db = require ('../db');
const { http } = require ('@sapphirecode/consts');
module.exports = async (req, res) => {
const limit = parseInt (req.headers.limit);
const offset = parseInt (req.headers.offset);
const app_id = parseInt (req.headers.app_id);
if (isNaN (app_id)) {
res.status (http.status_bad_request)
.end ('app id not specified');
return;
}
res.status (http.status_ok)
.json (await db.log.get_all (
parseInt (req.headers.app_id),
isNaN (limit) ? 100 : limit,
isNaN (offset) ? 0 : offset
));
};

19
lib/api/index.js Normal file
View File

@ -0,0 +1,19 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
const router = require ('express')
.Router ();
router.use (require ('./dump'));
router.get ('/log', require ('./get-log'));
router.get ('/app', require ('./get-app'));
router.post ('/log', require ('./post-log'));
module.exports = router;

36
lib/api/post-log.js Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
const db = require ('../db');
const { http } = require ('@sapphirecode/consts');
module.exports = async (req, res) => {
const { app_id } = req.headers;
if (
app_id === 'undefined'
|| isNaN (parseInt (app_id))
) {
res.status (http.status_bad_request)
.end ('app id not specified');
return;
}
const log = req.body;
if (typeof log !== 'object') {
res.status (http.status_bad_request)
.end ('invalid data format');
return;
}
const { message, data, timestamp } = log;
await db.log.insert (app_id, message, JSON.stringify (data), timestamp);
res.status (http.status_created)
.end ();
};

16
lib/db/app.js Normal file
View File

@ -0,0 +1,16 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
module.exports = (get_db) => ({
get_all () {
const knex = get_db ();
return knex ('app')
.select ();
}
});

53
lib/db/index.js Normal file
View File

@ -0,0 +1,53 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
/* eslint-disable no-sync */
'use strict';
const knex = require ('knex');
const fs = require ('fs');
const job = require ('./job');
let db = null;
async function init (use_fake_seed) {
if (!fs.existsSync ('data'))
fs.mkdirSync ('data');
if (use_fake_seed && fs.existsSync ('data/db.sqlite')) {
fs.unlinkSync ('data/db.sqlite');
fs.copyFileSync ('data/test.sqlite', 'data/db.sqlite');
}
db = knex ({
client: 'sqlite',
connection: { filename: 'data/db.sqlite' },
migrations: { directory: 'migrations' },
seeds: { directory: 'seeds' },
useNullAsDefault: true
});
await db.migrate.latest ();
await db.seed.run ({ specific: 'prod.js' });
// await db.seed.run ({ specific: 'fake.js' });
await job (db);
setInterval (() => {
job (db);
}, 3600e3);
}
function get_db () {
return db;
}
const log = require ('./log') (get_db);
const app = require ('./app') (get_db);
module.exports = { init, log, app };

87
lib/db/job.js Normal file
View File

@ -0,0 +1,87 @@
/* eslint-disable no-console */
/* eslint-disable no-await-in-loop */
'use strict';
const chunk = require ('lodash.chunk');
function get_targets (knex, app_id, duration, reduction = null) {
return knex.from ('log')
.where ({ app_id })
.andWhere ('timestamp', '<', Number (new Date) - (duration * 1000))
.andWhere ((builder) => {
if (reduction === null) {
builder.whereNotNull ('id');
}
else {
builder.where ('reduction', '<', reduction)
.orWhere ('reduction', null);
}
});
}
async function batch_delete (knex, ids) {
for (const c of chunk (ids, 100)) {
await knex ('log')
.whereIn ('id', c)
.del ();
}
return ids.length;
}
async function batch_update (knex, ids, data) {
for (const c of chunk (ids, 100)) {
await knex ('log')
.whereIn ('id', c)
.update (data);
}
return ids.length;
}
module.exports = async (knex) => {
console.log ('-- running database cleanup --');
const apps = await knex ('app')
.select ('id', 'name', 'reduction');
for (const app of apps) {
const reduction = JSON.parse (app.reduction);
const duplicates = reduction.shift ();
const end = reduction.pop ();
// delete anything older than now - end
const deleted_old = await get_targets (knex, app.id, end)
.del ();
console.log (`deleted ${deleted_old} old datasets`);
for (const r of reduction) {
const targets = (await get_targets (knex, app.id, r, r)
.orderBy ('timestamp')
.select ('id'))
.map ((v) => v.id);
const even = targets.filter ((v, i) => (i % 2 === 0));
const odd = targets.filter ((v, i) => (i % 2 !== 0));
const deleted_reduction = await batch_delete (knex, even);
console.log (`reduction ${r} deleted ${deleted_reduction}`);
await batch_update (knex, odd, { reduction: r });
}
const deleted_duplicates = await get_targets (knex, app.id, duplicates)
.andWhere ((builder) => {
builder.whereNotIn ('id', (inBuilder) => {
get_targets (inBuilder, app.id, duplicates)
.groupBy ('message', 'data')
.min ({ id: 'id' });
});
})
.del ();
console.log (`deleted ${deleted_duplicates} duplicates`);
}
};

30
lib/db/log.js Normal file
View File

@ -0,0 +1,30 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
module.exports = (get_db) => ({
get_all (app_id, limit = 100, offset = 0) {
const knex = get_db ();
return knex.select (
'id',
'message',
'data',
'timestamp'
)
.from ('log')
.where ({ app_id })
.orderBy ('timestamp', 'desc')
.limit (Math.min (limit, 10000))
.offset (offset);
},
insert (app_id, message, data = '{}', timestamp = (new Date)) {
const knex = get_db ();
return knex ('log')
.insert ({ message, data, timestamp, app_id });
}
});

23
lib/defaults.js Normal file
View File

@ -0,0 +1,23 @@
'use strict';
module.exports = {
app: {
/**
* reduce data after given time durations
* 1. delete duplicates (1 day)
* 2. divide by 2 (1 week)
* ...
* 7. delete all (6 weeks)
*/
reduction: JSON.stringify ([
86400,
604800,
1209600,
1814400,
2419200,
3024000,
3628800
])
}
};

38
migrations/00000-init.js Normal file
View File

@ -0,0 +1,38 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
async function create_app (knex) {
await knex.schema.createTable ('app', (table) => {
table.increments ('id');
table.string ('name');
});
}
async function create_log (knex) {
await knex.schema.createTable ('log', (table) => {
table.increments ('id');
table.integer ('app_id')
.references ('id')
.inTable ('app');
table.string ('message');
table.json ('data');
table.timestamp ('timestamp');
});
}
async function up (knex) {
await create_app (knex);
await create_log (knex);
}
function down () {
// noop
}
module.exports = { up, down };

View File

@ -0,0 +1,22 @@
'use strict';
const defaults = require ('../lib/defaults');
async function up (knex) {
await knex.schema.table ('app', (t) => {
t.string ('reduction');
});
await knex.schema.table ('log', (t) => {
t.integer ('reduction');
});
await knex ('app')
.update ({ reduction: defaults.app.reduction });
}
function down () {
// noop
}
module.exports = { up, down };

493
package-lock.json generated
View File

@ -1,493 +0,0 @@
{
"name": "appreports",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
}
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"body-parser": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
"requires": {
"bytes": "3.1.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"on-finished": "~2.3.0",
"qs": "6.7.0",
"raw-body": "2.4.0",
"type-is": "~1.6.17"
}
},
"buffer-writer": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
"integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw=="
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
},
"content-disposition": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
"requires": {
"safe-buffer": "5.1.2"
}
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"cookie": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"express": {
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
"requires": {
"accepts": "~1.3.7",
"array-flatten": "1.1.1",
"body-parser": "1.19.0",
"content-disposition": "0.5.3",
"content-type": "~1.0.4",
"cookie": "0.4.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.1.2",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.5",
"qs": "6.7.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.1.2",
"send": "0.17.1",
"serve-static": "1.14.1",
"setprototypeof": "1.1.1",
"statuses": "~1.5.0",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
}
},
"finalhandler": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
"requires": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"statuses": "~1.5.0",
"unpipe": "~1.0.0"
}
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ipaddr.js": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
"integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA=="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
},
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
},
"mime-db": {
"version": "1.40.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
},
"mime-types": {
"version": "2.1.24",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
"requires": {
"mime-db": "1.40.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"ee-first": "1.1.1"
}
},
"packet-reader": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz",
"integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ=="
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"pg": {
"version": "7.17.1",
"resolved": "https://registry.npmjs.org/pg/-/pg-7.17.1.tgz",
"integrity": "sha512-SYWEip6eADsgDQIZk0bmB2JDOrC8Xu6z10KlhlXl03NSomwVmHB6ZTVyDCwOfT6bXHI8QndJdk5XxSSRXikaSA==",
"requires": {
"buffer-writer": "2.0.0",
"packet-reader": "1.0.0",
"pg-connection-string": "0.1.3",
"pg-packet-stream": "^1.1.0",
"pg-pool": "^2.0.9",
"pg-types": "^2.1.0",
"pgpass": "1.x",
"semver": "4.3.2"
}
},
"pg-connection-string": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-0.1.3.tgz",
"integrity": "sha1-2hhHsglA5C7hSSvq9l1J2RskXfc="
},
"pg-int8": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="
},
"pg-packet-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pg-packet-stream/-/pg-packet-stream-1.1.0.tgz",
"integrity": "sha512-kRBH0tDIW/8lfnnOyTwKD23ygJ/kexQVXZs7gEyBljw4FYqimZFxnMMx50ndZ8In77QgfGuItS5LLclC2TtjYg=="
},
"pg-pool": {
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.9.tgz",
"integrity": "sha512-gNiuIEKNCT3OnudQM2kvgSnXsLkSpd6mS/fRnqs6ANtrke6j8OY5l9mnAryf1kgwJMWLg0C1N1cYTZG1xmEYHQ=="
},
"pg-types": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
"requires": {
"pg-int8": "1.0.1",
"postgres-array": "~2.0.0",
"postgres-bytea": "~1.0.0",
"postgres-date": "~1.0.4",
"postgres-interval": "^1.1.0"
}
},
"pgpass": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.2.tgz",
"integrity": "sha1-Knu0G2BltnkH6R2hsHwYR8h3swY=",
"requires": {
"split": "^1.0.0"
}
},
"postgres-array": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="
},
"postgres-bytea": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
"integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU="
},
"postgres-date": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.4.tgz",
"integrity": "sha512-bESRvKVuTrjoBluEcpv2346+6kgB7UlnqWZsnbnCccTNq/pqfj1j6oBaN5+b/NrDXepYUT/HKadqv3iS9lJuVA=="
},
"postgres-interval": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
"requires": {
"xtend": "^4.0.0"
}
},
"postgresupdater": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/postgresupdater/-/postgresupdater-1.0.16.tgz",
"integrity": "sha512-6pe6ozTKwSqevDcXC/WIUvb0qBMUlCWtwKb8EOg1c+qf12Hyh+5U/t5Mq79QI8Pa3Z7d86nStGhnVpSevH2HHg==",
"requires": {
"pg": "^7.12.1"
}
},
"proxy-addr": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",
"integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==",
"requires": {
"forwarded": "~0.1.2",
"ipaddr.js": "1.9.0"
}
},
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
},
"range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
},
"raw-body": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
"requires": {
"bytes": "3.1.0",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"semver": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.2.tgz",
"integrity": "sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c="
},
"send": {
"version": "0.17.1",
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
"requires": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.7.2",
"mime": "1.6.0",
"ms": "2.1.1",
"on-finished": "~2.3.0",
"range-parser": "~1.2.1",
"statuses": "~1.5.0"
},
"dependencies": {
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
}
}
},
"serve-static": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
"integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
"requires": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.17.1"
}
},
"setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
},
"split": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
"requires": {
"through": "2"
}
},
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
},
"type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
}
}
}

View File

@ -1,20 +1,53 @@
{ {
"name": "appreports", "name": "appreports",
"version": "1.0.0", "version": "0.1.0",
"description": "Log and view application reports over http requests", "private": true,
"main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs",
"test": "echo \"no test\"",
"compile": "vue-cli-service build",
"serve": "vue-cli-service serve"
}, },
"repository": {
"type": "git",
"url": "https://git.scode.ovh/sapphirecode/appreports.git"
},
"author": "Timo Hocker",
"license": "GPL-3.0-or-later",
"dependencies": { "dependencies": {
"@sapphirecode/consts": "^1.1.28",
"@sapphirecode/crypto-helper": "^1.1.57",
"@sapphirecode/utilities": "^1.8.5",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"chart.js": "^2.9.3",
"connect-history-api-fallback": "^1.6.0",
"core-js": "^3.6.5",
"express": "^4.17.1", "express": "^4.17.1",
"postgresupdater": "^1.0.16" "express-http-proxy": "^1.6.2",
"faker": "^5.1.0",
"knex": "^0.21.2",
"lodash.chunk": "^4.2.0",
"sqlite3": "^5.0.0",
"vue": "^2.6.11",
"vue-chartjs": "^3.5.0",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"yargs": "^16.1.0"
},
"devDependencies": {
"@sapphirecode/eslint-config": "^2.1.16",
"@sapphirecode/eslint-config-vue": "^1.1.16",
"@vue/cli-plugin-babel": "^4.4.0",
"@vue/cli-plugin-eslint": "^4.4.0",
"@vue/cli-plugin-router": "^4.4.0",
"@vue/cli-plugin-vuex": "^4.4.0",
"@vue/cli-service": "^4.4.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.5.0",
"eslint-plugin-vue": "^7.1.0",
"vue-template-compiler": "^2.6.11"
},
"license": "GPL-3.0-or-later",
"main": "index.js",
"author": {
"name": "Timo Hocker",
"email": "timo@scode.ovh"
},
"engines": {
"node": ">=10.0.0"
} }
} }

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

17
public/index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

47
seeds/fake.js Normal file
View File

@ -0,0 +1,47 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
const faker = require ('faker');
let last_t = 0;
let last_h = 0;
function create_log (timestamp) {
last_t = faker.random.number (2) + 22;
last_h = faker.random.number (10) + 38;
const data = {
light: faker.random.number (10),
temperature: last_t,
humidity: last_h
};
return {
app_id: 1,
message: faker.random.words (),
data: JSON.stringify (data),
timestamp
};
}
async function seed (knex) {
await knex ('log')
.del ();
// eslint-disable-next-line no-console
console.log ('creating seeds');
const log = (Array (10000))
.fill (() => null)
.map (() => faker.date.recent (60))
.sort ()
.map ((t) => create_log (t));
await knex.batchInsert ('log', log, 10);
}
module.exports = { seed };

25
seeds/prod.js Normal file
View File

@ -0,0 +1,25 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
async function seed (knex) {
// eslint-disable-next-line no-console
console.log ('creating prod seeds');
const apps = await knex ('app')
.select ();
if (apps.length < 1) {
await knex ('app')
.insert (
{ name: 'test app' }
);
}
}
module.exports = { seed };

28
spec/api.json Normal file
View File

@ -0,0 +1,28 @@
{
"openapi":"3.0.2",
"info": {
"title":"API Title",
"version":"1.0"
},
"servers": [
{"url":"https://appreports.scode.ovh/v1"}
],
"paths": {
"/app": {
"get": {
"description": "list all apps",
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
}
}
}
}
}
}
}
}

11
src/.eslintrc.js Normal file
View File

@ -0,0 +1,11 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, July 2020
*/
/* eslint-disable */
module.exports = {
'extends': ['@sapphirecode/eslint-config-vue']
}

15
src/App.vue Normal file
View File

@ -0,0 +1,15 @@
<template>
<div id="app">
<Style />
<router-view />
</div>
</template>
<script>
import Style from './Style.vue';
export default { components: { Style } };
</script>
<style scoped>
</style>

93
src/Style.vue Normal file
View File

@ -0,0 +1,93 @@
<template>
<div :class="classes" />
</template>
<script>
import Vuex from 'vuex';
export default {
computed: {
classes () {
if (this.theme !== '')
return { [this.theme]: true };
return {};
},
...Vuex.mapState ({ theme: (state) => state.theme })
}
};
</script>
<style>
:root {
/* generated with adobe color (compound) */
--Color-A: #1254B8;
--Color-B: #355585;
--Color-C: #00D8EB;
--Color-D: #F0632F;
--Color-E: #BD311E;
--Color-0: #000;
--Color-1: #222;
--color-background: var(--Color-0);
--color-background-1: var(--Color-1);
--color-foreground: var(--Color-B);
--color-contrast: var(--Color-A);
--color-high-contrast: var(--Color-C);
--color-focus: var(--Color-D);
--color-accent: var(--Color-E);
--background: var(--color-background);
--background-1: var(--color-background-1);
--container-border: 1px solid var(--color-high-contrast);
--sub-container-border: 1px solid var(--color-contrast);
--accent-border: 1px solid var(--color-accent);
--font-family: Avenir, Helvetica, Arial, sans-serif;
}
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: var(--background);
color: var(--color-foreground);
font-family: var(--font-family);
}
button {
border: var(--accent-border);
background: inherit;
color: inherit;
cursor: pointer;
transition:
border-color ease-in-out .1s,
color ease-in-out .1s;
}
button:hover {
border-color: var(--color-focus);
color: var(--color-focus);
}
input {
border: var(--accent-border);
background: inherit;
color: inherit;
}
select {
border: var(--accent-border);
background: inherit;
color: inherit;
}
select > option {
background: var(--background-1);
color: var(--color-foreground);
font-weight: bold;
}
.large_button {
padding: 10px;
}
</style>

107
src/components/AppView.vue Normal file
View File

@ -0,0 +1,107 @@
<template>
<div>
<button
type="button"
class="large_button"
@click="settings_btn_action"
v-text="editing?'Close':'Settings'"
/>
<div
v-if="editing"
class="spacer"
>
<ConfigEditor
v-model="config"
:template="template"
/>
</div>
<div
v-else
class="grid"
>
<ViewComponent
v-for="(item,key) of saved_config.displays"
:key="key"
:config="item"
:data="log(item.source)"
/>
</div>
</div>
</template>
<script>
import Vuex from 'vuex';
import { copy_object } from '@sapphirecode/utilities';
import default_config from '../default';
import default_template from '../template';
import ViewComponent from './ViewComponent.vue';
import ConfigEditor from './ConfigEditor.vue';
export default {
components: { ViewComponent, ConfigEditor },
props: {
app: {
type: Number,
required: true
}
},
data () {
return {
config: copy_object (default_config),
saved_config: copy_object (default_config),
template: default_template,
editing: false
};
},
computed: { ...Vuex.mapGetters ({ log: 'log' }) },
mounted () {
this.fetch_log ();
document.body.addEventListener ('keydown', (ev) => {
if (ev.key === 's' && ev.ctrlKey && this.editing) {
this.save_config ();
ev.preventDefault ();
return false;
}
return true;
});
},
methods: {
save_config () {
fetch ('config', {
method: 'POST',
body: JSON.stringify (this.config)
});
this.saved_config = copy_object (this.config);
this.fetch_log ();
this.editing = false;
},
fetch_log () {
this.get_log ({
app_id: this.app,
sources: this.saved_config.sources
});
},
settings_btn_action () {
if (this.editing)
this.save_config ();
else
this.editing = true;
},
...Vuex.mapActions ({ get_log: 'get_log' })
}
};
</script>
<style scoped>
.grid {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
height: 100%;
}
.spacer {
margin: 10px;
}
</style>

View File

@ -0,0 +1,102 @@
<script>
import { Line, mixins } from 'vue-chartjs';
import { resolve_data } from '../helper';
export default {
extends: Line,
mixins: [ mixins.reactiveData ],
props: {
data: {
type: Array,
required: true
},
xaxis: {
type: String,
required: true
},
yaxis: {
type: Array,
required: true
},
remove_duplicates: {
type: Boolean,
default: false
}
},
computed: {
chart_data () {
const labels = this.data.map ((d) => resolve_data (d, this.xaxis));
const datasets = this.yaxis.map ((y, index) => {
const res = {
label: y.label,
data: [],
yAxisID: index,
borderColor: y.color,
backgroundColor: y.fill,
spanGaps: true,
lineTension: 0
};
let last = null;
for (let i = 0; i < this.data.length; i++) {
const data = this.data[i];
const val = resolve_data (data, y.field);
const next = this.data.length - 1 === i
? val
: resolve_data (this.data[i + 1], y.field);
if (
!this.remove_duplicates
|| last !== val || next !== val
|| this.data.length - 1 === i
)
res.data.push (val);
else
res.data.push (null);
last = val;
}
return res;
});
return { datasets, labels };
},
chart_options () {
return {
animation: { duration: 0 },
responsiveAnimationDuration: 0,
scales: {
yAxes: this.yaxis.map (
(y, index) => {
const range = {};
if (typeof y.min_value === 'number')
range.suggestedMin = y.min_value;
if (typeof y.max_value === 'number')
range.suggestedMax = y.max_value;
return {
id: index,
ticks: range,
scaleLabel: {
labelString: y.label,
display: true,
lineHeight: 1,
padding: 0.1
}
};
}
)
}
};
}
},
watch: {
chart_data () {
// eslint-disable-next-line no-underscore-dangle
this.renderChart (this.chart_data, this.chart_options);
}
},
mounted () {
this.renderChart (this.chart_data, this.chart_options);
}
};
</script>
<style>
</style>

View File

@ -0,0 +1,215 @@
<template>
<div
v-if="enabled"
class="config-editor"
>
<p
class="label"
v-text="template.name"
/>
<button
v-if="removable"
class="array_remove"
type="button"
@click="$emit('remove')"
>
X
</button>
<!-- editor -->
<div
v-if="template.type === 'object'"
class="editor"
>
<ConfigEditor
v-for="(prop,key) of template.properties"
:key="key"
v-model="config[prop.name]"
:template="prop"
:enabled="is_enabled(prop.if)"
/>
</div>
<div
v-else-if="template.type === 'array'"
class="editor"
>
<ConfigEditor
v-for="(child,key) of config"
:key="salt (key)"
v-model="config[key]"
:template="template.child"
:removable="true"
@remove="config.splice(key, 1)"
/>
<button
type="button"
@click="add_item"
>
add
</button>
</div>
<div
v-else-if="template.type === 'string'"
class="editor"
>
<select
v-if="Array.isArray(template.choices)"
v-model="config"
>
<option
v-for="(opt,optkey) in template.choices"
:key="optkey"
v-text="opt"
/>
</select>
<input
v-else
v-model="config"
type="text"
>
</div>
<div
v-else-if="template.type === 'number'"
class="editor"
>
<input
v-model="config"
type="number"
>
</div>
<div
v-else-if="template.type === 'boolean'"
class="editor"
>
<input
v-model="config"
type="checkbox"
>
</div>
<pre v-else>
invalid config
</pre>
</div>
</template>
<script>
import { create_salt } from '@sapphirecode/crypto-helper';
import { resolve_data } from '../helper';
export default {
name: 'ConfigEditor',
props: {
// eslint-disable-next-line vue/require-prop-types
value: { required: true },
template: {
type: Object,
required: true,
enabled: { type: Boolean, default: true }
},
enabled: {
type: Boolean,
default: true
},
removable: {
type: Boolean,
default: false
}
},
data () {
let val = this.value;
if (typeof val === 'undefined')
val = this.create_default (this.template);
return { temp: val };
},
computed: {
config: {
get () {
return this.temp;
},
set (val) {
let mapped = val;
if (this.template.type === 'number') {
mapped = parseFloat (val);
if (isNaN (mapped))
mapped = 0;
}
this.$emit ('input', mapped);
this.temp = mapped;
}
}
},
methods: {
is_enabled (condition) {
if (typeof condition === 'undefined')
return true;
switch (condition.op) {
case '=':
return resolve_data (this.config, condition.prop) === condition.val;
case '<':
return resolve_data (this.config, condition.prop) < condition.val;
case '>':
return resolve_data (this.config, condition.prop) > condition.val;
default:
return false;
}
},
add_item () {
if (
typeof this.config === 'undefined'
|| !Array.isArray (this.config)
)
this.config = [];
this.config.push (this.create_default (this.template.child));
},
create_default (template) {
if (typeof template.default !== 'undefined')
return template.default;
if (template.type === 'string')
return '';
if (template.type === 'number')
return 0;
if (template.type === 'boolean')
return false;
if (template.type === 'array')
return [];
if (template.type === 'object') {
const res = {};
for (const prop of template.properties)
res[prop.name] = this.create_default (prop);
return res;
}
return null;
},
salt () {
return create_salt ();
}
}
};
</script>
<style scoped>
.config-editor {
display: grid;
grid-template-areas: 'label editor';
grid-template-columns: auto 1fr;
}
.editor {
border: var(--sub-container-border);
margin-left: 10px;
grid-column: editor;
}
.label {
display: inline-block;
grid-column: label;
}
.array_remove {
display: inline-block;
width: 20px;
height: 20px;
padding: 0;
}
</style>

View File

@ -0,0 +1,72 @@
<template>
<div
ref="view"
class="table_view"
>
<table>
<tr v-if="headings.length > 0">
<th
v-for="(heading,key) of headings"
:key="key"
v-text="heading"
/>
</tr>
<tr
v-for="(item,key) of items"
:key="key"
>
<td
v-for="(col,c_key) of columns"
:key="c_key"
v-text="resolve_data(item,col)"
/>
</tr>
</table>
</div>
</template>
<script>
import { resolve_data } from '../helper';
export default {
props: {
items: {
type: Array,
required: true
},
columns: {
type: Array,
required: true
},
headings: {
type: Array,
default: () => []
}
},
methods: { resolve_data }
};
</script>
<style>
.table_view {
overflow-y: scoll;
width: max-content;
max-width: 100%;
max-height: 100vh;
font-size: 12px;
}
table {
border-collapse: collapse;
}
tr:nth-child(odd) {
background-color: var(--color-background-1);
color: var(--color-accent);
}
td, th {
border: var(--sub-container-border);
padding: 3px;
}
</style>

View File

@ -0,0 +1,37 @@
<template>
<ChartView
v-if="config.type === 'chart'"
:data="[...data].reverse()"
:xaxis="config.x"
:yaxis="config.y"
:remove_duplicates="config.remove_duplicates"
/>
<TableView
v-else
:items="data"
:columns="config.columns"
:headings="config.headings"
/>
</template>
<script>
import ChartView from './ChartView.vue';
import TableView from './TableView.vue';
export default {
components: { ChartView, TableView },
props: {
config: {
type: Object,
required: true
},
data: {
type: Array,
required: true
}
}
};
</script>
<style scoped>
</style>

73
src/default.js Normal file
View File

@ -0,0 +1,73 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
export default {
sources: [
{ name: 'default', limit: 140, offset: 0 },
{ name: 'secondary', limit: 10, offset: 0 },
{ name: 'version', limit: 1, offset: 0 }
],
displays: [
{
source: 'default',
type: 'chart',
remove_duplicates: true,
x: 'timestamp',
y: [
{
label: 'temperature',
field: 'data/temperature',
color: '#ff0000',
fill: '#0000',
min_value: 15,
max_value: 30
},
{
label: 'humidity',
field: 'data/humidity',
color: '#0000ff',
fill: '#0000',
min_value: 20,
max_value: 80
},
{
label: 'light',
field: 'data/light',
color: '#999',
fill: '#0000'
}
]
},
{
source: 'secondary',
type: 'table',
headings: [
'timestamp',
'temperature',
'humidity',
'light',
'fan'
],
columns: [
'timestamp',
'data/temperature',
'data/humidity',
'data/light',
'data/latch'
]
},
{
source: 'version',
type: 'table',
headings: [ 'hardware version' ],
columns: [ 'message' ],
x: '',
y: [],
remove_duplicates: false
}
]
};

14
src/helper.js Normal file
View File

@ -0,0 +1,14 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
export function resolve_data (set, index) {
const keys = typeof index === 'string' ? index.split ('/') : index;
const data = set[keys[0]];
if (keys.length === 1)
return data;
return resolve_data (data, keys.slice (1));
}

21
src/main.js Normal file
View File

@ -0,0 +1,21 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, July 2020
*/
// @ts-nocheck
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
Vue.config.productionTip = false;
new Vue ({
router,
store,
render: (h) => h (App)
})
.$mount ('#app');

43
src/router/index.js Normal file
View File

@ -0,0 +1,43 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, July 2020
*/
// @ts-nocheck
import Vue from 'vue';
import VueRouter from 'vue-router';
import NotFound from '../views/NotFound.vue';
import Home from '../views/Home.vue';
Vue.use (VueRouter);
const routes = [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/app/:id',
redirect: '/'
},
{
path: '/404',
name: '404',
component: NotFound
},
{ path: '*', redirect: '404' }
];
const router = new VueRouter ({
mode: 'history',
// eslint-disable-next-line no-process-env
base: process.env.BASE_URL,
routes,
fallback: true
});
export default router;

60
src/store/index.js Normal file
View File

@ -0,0 +1,60 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, July 2020
*/
import Vue from 'vue';
import Vuex from 'vuex';
import version from '../../version';
Vue.use (Vuex);
export default new Vuex.Store ({
state: { log: {}, version, theme: '' },
mutations: {
set_log (state, log) {
state.log = log;
}
},
getters: {
log (state) {
return (source) => {
if (typeof state.log[source] === 'undefined')
return [];
return state.log[source];
};
}
},
actions: {
async get_log ({ commit }, { app_id, sources }) {
const logs = {};
for (const source of sources) {
// eslint-disable-next-line no-await-in-loop
const log = await fetch ('/log', {
headers: {
app_id,
offset: source.offset,
limit: source.limit
}
})
.then ((res) => res.json ())
.then ((json) => json.map ((entry) => {
entry.data = JSON.parse (entry.data);
const time = new Date (entry.timestamp);
time.setMinutes (time.getMinutes () - time.getTimezoneOffset ());
entry.timestamp = time.toISOString ()
.replace ('T', ' ')
.substr (0, 19);
return entry;
}));
logs[source.name] = log;
}
commit ('set_log', logs);
}
},
modules: {}
});

92
src/template.js Normal file
View File

@ -0,0 +1,92 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
export default {
type: 'object',
properties: [
{
type: 'array',
name: 'sources',
child: {
type: 'object',
properties: [
{
type: 'string',
name: 'name'
},
{
type: 'number',
name: 'limit'
},
{
type: 'number',
name: 'offset'
}
]
}
},
{
type: 'array',
name: 'displays',
child: {
type: 'object',
properties: [
{
type: 'string',
name: 'source'
},
{
type: 'string',
name: 'type',
choices: [
'table',
'chart'
]
},
{
name: 'headings',
type: 'array',
child: { type: 'string' },
if: { prop: 'type', op: '=', val: 'table' }
},
{
name: 'columns',
type: 'array',
child: { type: 'string' },
if: { prop: 'type', op: '=', val: 'table' }
},
{
name: 'x',
type: 'string',
if: { prop: 'type', op: '=', val: 'chart' }
},
{
name: 'y',
type: 'array',
if: { prop: 'type', op: '=', val: 'chart' },
child: {
type: 'object',
properties: [
{ type: 'string', name: 'label' },
{ type: 'string', name: 'field' },
{ type: 'string', name: 'color' },
{ type: 'string', name: 'fill' },
{ type: 'number', name: 'min_value' },
{ type: 'number', name: 'max_value' }
]
}
},
{
name: 'remove_duplicates',
type: 'boolean',
if: { prop: 'type', op: '=', val: 'chart' }
}
]
}
}
]
};

105
src/views/Home.vue Normal file
View File

@ -0,0 +1,105 @@
<template>
<div class="main_view">
<div class="app_list">
<div
v-for="(app,key) in apps"
:key="key"
class="app_list_item"
@click="active = app.id"
v-text="app.name"
/>
</div>
<div class="data_view">
<AppView
v-if="active !== null"
class="data_view_display"
:app="active"
/>
<p
v-else
class="info"
>
Select an app to view its reports
</p>
</div>
<div class="footer">
<p
class="build_info"
v-text="version"
/>
</div>
</div>
</template>
<script>
import Vuex from 'vuex';
import AppView from '../components/AppView.vue';
export default {
components: { AppView },
data () {
return { apps: [], active: null };
},
computed: {
...Vuex.mapState (
{ version: ({ version }) => `appreports build: ${version}` }
)
},
async mounted () {
this.apps = await fetch ('/app')
.then ((res) => res.json ());
}
};
</script>
<style>
.main_view {
display: grid;
grid-template-areas:
'sidebar main'
'footer footer';
grid-template-columns: minmax(min-content,max-content) 1fr;
grid-template-rows: minmax(80vh, auto) 1fr;
}
.app_list {
grid-area: sidebar;
border: var(--container-border);
}
.app_list_item {
cursor: pointer;
margin: 0;
padding: 5px;
border: var(--sub-container-border);
transition: .1s color ease-in-out;
}
.app_list_item:hover {
color: var(--color-focus);
}
.app_list_item:active {
color: var(--color-accent);
}
.data_view {
grid-area: main;
border: var(--container-border);
padding: 10px;
}
.footer {
grid-area: footer;
}
.info {
color: var(--color-focus);
}
.build_info {
font-size: 10pt;
text-align: left;
}
</style>

11
src/views/NotFound.vue Normal file
View File

@ -0,0 +1,11 @@
<template>
<div>not found</div>
</template>
<script>
export default {};
</script>
<style>
</style>

View File

@ -1,31 +0,0 @@
-- create table
CREATE TABLE IF NOT EXISTS public."Log"
(
"ID" BIGSERIAL,
"App" character(4) NOT NULL,
"Client" character varying(64) NOT NULL,
"Timestamp" timestamp without time zone NOT NULL DEFAULT now(),
"Message" text NOT NULL,
"Misc" text,
"Stack" text
);
-- create view
CREATE OR REPLACE VIEW public."LogView" AS
SELECT 'Timestamp'::text AS "Timestamp",
'App'::bpchar AS "App",
'Client'::character varying AS "Client",
'Message'::text AS "Message",
'Misc'::text AS "Misc",
'Stack'::text AS "Stack",
'0'::bigint AS "ID"
UNION ALL
SELECT COALESCE(to_char("Log"."Timestamp", 'YYYY-MM-DD HH24:MI:SS'::text), ''::text) AS "Timestamp",
"Log"."App",
"Log"."Client",
"Log"."Message",
"Log"."Misc",
"Log"."Stack",
"Log"."ID"
FROM "Log"
ORDER BY 7;

View File

@ -1,32 +0,0 @@
-- drop view to remove dependencies
DROP VIEW public."LogView";
-- add type column
ALTER TABLE public."Log"
ADD COLUMN "Type" character varying(64) NOT NULL DEFAULT 'Error';
-- change app column to varying 64
ALTER TABLE public."Log"
ALTER COLUMN "App" TYPE character varying(64);
-- recreate view
CREATE OR REPLACE VIEW public."LogView" AS
SELECT 'Timestamp'::text AS "Timestamp",
'App'::character varying AS "App",
'Type'::character varying AS "Type",
'Client'::character varying AS "Client",
'Message'::text AS "Message",
'Misc'::text AS "Misc",
'Stack'::text AS "Stack",
'0'::bigint AS "ID"
UNION ALL
SELECT COALESCE(to_char("Log"."Timestamp", 'YYYY-MM-DD HH24:MI:SS'::text), ''::text) AS "Timestamp",
"Log"."App",
"Log"."Type",
"Log"."Client",
"Log"."Message",
"Log"."Misc",
"Log"."Stack",
"Log"."ID"
FROM "Log"
ORDER BY 8;

View File

@ -1,2 +0,0 @@
-- drop view
DROP VIEW public."LogView";

10
version.js Normal file
View File

@ -0,0 +1,10 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
'use strict';
module.exports = 'development';

View File

@ -1,12 +0,0 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}

View File

@ -1,9 +0,0 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

14
web/.gitignore vendored
View File

@ -1,14 +0,0 @@
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln

View File

@ -1,10 +0,0 @@
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}

View File

@ -1,21 +0,0 @@
# web
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

View File

@ -1,41 +0,0 @@
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})

View File

@ -1,54 +0,0 @@
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -1,101 +0,0 @@
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}

View File

@ -1,22 +0,0 @@
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}

View File

@ -1,81 +0,0 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': resolve('src'),
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}

View File

@ -1,95 +0,0 @@
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
resolve(devWebpackConfig)
}
})
})

View File

@ -1,145 +0,0 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig

View File

@ -1,7 +0,0 @@
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})

View File

@ -1,69 +0,0 @@
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: './',
proxyTable: {},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
/**
* Source Maps
*/
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}

View File

@ -1,4 +0,0 @@
'use strict'
module.exports = {
NODE_ENV: '"production"'
}

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>web</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

11639
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,61 +0,0 @@
{
"name": "web",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "Timo Hocker <t-hocker@web.de>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js"
},
"dependencies": {
"vue": "^2.5.2"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

View File

@ -1,62 +0,0 @@
<template>
<div id="app">
<div v-if="json.headings && json.data">
<p>successfully loaded {{json.data.length}} entries</p>
<table>
<tr>
<th
v-for="(value, key) in json.headings.filter((val,ind)=>!json.hidden.includes(ind))"
:key="key"
>{{value}}</th>
</tr>
<tr v-for="(row,rowKey) in json.data" :key=rowKey>
<td
v-for="(value,key) in row.filter((val,ind)=>!json.hidden.includes(ind))"
:key="key"
>{{value}}</td>
</tr>
</table>
</div>
<br />
<br />
<a
style="font-size:10px"
rel="license"
href="https://www.gnu.org/licenses/gpl-3.0.en.html"
>GNU General Public License v3.0 or later &copy; Timo Hocker</a>
</div>
</template>
<script>
export default {
name: "App",
data() {
return {
json: {}
};
},
mounted() {
const self = this;
fetch("?json")
.then(res => res.json())
.then(json => (self.json = json));
}
};
</script>
<style>
@import url("https://cdn.scode.ovh/bootstrapLight.css");
td {
border: 1px solid green;
padding: 5px;
}
th {
padding: 5px;
}
table {
border-collapse: collapse;
}
</style>

View File

@ -1,10 +0,0 @@
import Vue from 'vue'
import App from './App'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
render: h => h(App)
})

View File

9464
yarn.lock Normal file

File diff suppressed because it is too large Load Diff