feat(embedded_ui): fully integrate UI into GoLang binary (#43)
All checks were successful
/ build (push) Successful in 5m30s

Reviewed-on: #43
Co-authored-by: Varakh <varakh@varakh.de>
Co-committed-by: Varakh <varakh@varakh.de>
This commit is contained in:
Varakh 2024-10-25 14:12:35 +00:00 committed by Varakh
parent f066511eff
commit d0312a5853
182 changed files with 39095 additions and 162 deletions

View file

@ -3,9 +3,9 @@ on:
tags:
- '*'
env:
VERSION_MAJOR: 3
VERSION_MAJOR: 4
VERSION_MINOR: 0
VERSION_PATCH: 3
VERSION_PATCH: 0
IMAGE_TAG: varakh/upda
IMAGE_TAG_PRIVATE: git.myservermanager.com/varakh/upda
FORGEJO_URL: https://git.myservermanager.com

View file

@ -2,9 +2,12 @@
Changes adhere to [semantic versioning](https://semver.org).
## [3.0.3] - UNRELEASED
## [4.0.0] - UNRELEASED
* ...
> This is a major version upgrade. Other versions are incompatible with this release.
* Embed frontend into Go binary and only ship _one_ OCI image
* Switch license to GPLv3
## [3.0.2] - 2024/06/15

View file

@ -6,6 +6,7 @@ LABEL maintainer="Varakh <varakh@varakh.de>"
RUN apk --update upgrade && \
apk add go gcc make sqlite && \
apk add nodejs npm && \
# See https://stackoverflow.com/questions/34729748/installed-go-binary-not-found-in-path-on-alpine-linux-docker
mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 && \
rm -rf /var/cache/apk/*

View file

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

View file

@ -1,61 +1,87 @@
BIN_DIR = $(shell pwd)/bin
WEB_DIR = $(shell pwd)/server/web
WEB_BUILD_DIR = $(shell pwd)/server/web/build
WEB_NODE_DIR = $(shell pwd)/server/web/node_modules
WEB_COVERAGE_DIR = $(shell pwd)/server/web/coverage
clean:
# cleanup steps
clean: clean-server clean-web
clean-server:
rm -rf ${BIN_DIR}
clean-web:
rm -rf ${WEB_BUILD_DIR} ${WEB_NODE_DIR} ${WEB_COVERAGE_DIR}
dependencies:
# dependencies steps
dependencies: dependencies-web dependencies-server
dependencies-server:
GO111MODULE=on go mod download
dependencies-web:
cd ${WEB_DIR}; npm install
ci: clean dependencies checkstyle-ci test-ci build-server-ci build-cli-ci
# checkstyle steps
checkstyle: checkstyle-web checkstyle-server
checkstyle-server:
go vet ./...
checkstyle-web:
cd ${WEB_DIR}; npm run checkstyle
build-server-ci: build-server-linux-amd64
# test steps
test: test-web test-server
test-server:
go test -race ./...
test-web:
cd ${WEB_DIR}; npm run test:ci
# build steps
# server requires CGO_ENABLED=1 for go-sqlite
build-server-freebsd-amd64:
CGO_ENABLED=1 GO111MODULE=on GOOS=freebsd GOARCH=amd64 go build -o ${BIN_DIR}/upda-server-freebsd-amd64 cmd/server/main.go
CGO_ENABLED=1 GO111MODULE=on GOOS=freebsd GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-server-freebsd-amd64 cmd/server/main.go
build-server-freebsd-arm64:
CGO_ENABLED=1 GO111MODULE=on GOOS=freebsd GOARCH=arm64 go build -o ${BIN_DIR}/upda-server-freebsd-arm64 cmd/server/main.go
CGO_ENABLED=1 GO111MODULE=on GOOS=freebsd GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-server-freebsd-arm64 cmd/server/main.go
build-server-darwin-amd64:
CGO_ENABLED=1 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -o ${BIN_DIR}/upda-server-darwin-amd64 cmd/server/main.go
CGO_ENABLED=1 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-server-darwin-amd64 cmd/server/main.go
build-server-darwin-arm64:
CGO_ENABLED=1 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -o ${BIN_DIR}/upda-server-darwin-arm64 cmd/server/main.go
CGO_ENABLED=1 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-server-darwin-arm64 cmd/server/main.go
build-server-linux-amd64:
CGO_ENABLED=1 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -o ${BIN_DIR}/upda-server-linux-amd64 cmd/server/main.go
CGO_ENABLED=1 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-server-linux-amd64 cmd/server/main.go
build-server-linux-arm64:
CGO_ENABLED=1 GO111MODULE=on GOOS=linux GOARCH=arm64 go build -o ${BIN_DIR}/upda-server-linux-arm64 cmd/server/main.go
CGO_ENABLED=1 GO111MODULE=on GOOS=linux GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-server-linux-arm64 cmd/server/main.go
build-server-windows-amd64:
CGO_ENABLED=1 GO111MODULE=on GOOS=windows GOARCH=amd64 go build -o ${BIN_DIR}/upda-server-windows-amd64 cmd/server/main.go
CGO_ENABLED=1 GO111MODULE=on GOOS=windows GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-server-windows-amd64 cmd/server/main.go
build-server-windows-arm64:
CGO_ENABLED=1 GO111MODULE=on GOOS=windows GOARCH=arm64 go build -o ${BIN_DIR}/upda-server-windows-arm64 cmd/server/main.go
CGO_ENABLED=1 GO111MODULE=on GOOS=windows GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-server-windows-arm64 cmd/server/main.go
# cli does not require CGO_ENABLED=1, cross-platform build possible
build-cli-ci: build-cli-linux-amd64
build-cli-all: build-cli-freebsd-amd64 build-cli-freebsd-arm64 build-cli-darwin-amd64 build-cli-darwin-arm64 build-cli-linux-amd64 build-cli-linux-arm64 build-cli-windows-amd64 build-cli-windows-arm64
build-cli-freebsd-amd64:
CGO_ENABLED=0 GO111MODULE=on GOOS=freebsd GOARCH=amd64 go build -o ${BIN_DIR}/upda-cli-freebsd-amd64 cmd/cli/main.go
CGO_ENABLED=0 GO111MODULE=on GOOS=freebsd GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-cli-freebsd-amd64 cmd/cli/main.go
build-cli-freebsd-arm64:
CGO_ENABLED=0 GO111MODULE=on GOOS=freebsd GOARCH=arm64 go build -o ${BIN_DIR}/upda-cli-freebsd-arm64 cmd/cli/main.go
CGO_ENABLED=0 GO111MODULE=on GOOS=freebsd GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-cli-freebsd-arm64 cmd/cli/main.go
build-cli-darwin-amd64:
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -o ${BIN_DIR}/upda-cli-darwin-amd64 cmd/cli/main.go
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-cli-darwin-amd64 cmd/cli/main.go
build-cli-darwin-arm64:
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -o ${BIN_DIR}/upda-cli-darwin-arm64 cmd/cli/main.go
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-cli-darwin-arm64 cmd/cli/main.go
build-cli-linux-amd64:
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -o ${BIN_DIR}/upda-cli-linux-amd64 cmd/cli/main.go
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-cli-linux-amd64 cmd/cli/main.go
build-cli-linux-arm64:
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=arm64 go build -o ${BIN_DIR}/upda-cli-linux-arm64 cmd/cli/main.go
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-cli-linux-arm64 cmd/cli/main.go
build-cli-windows-amd64:
CGO_ENABLED=0 GO111MODULE=on GOOS=windows GOARCH=amd64 go build -o ${BIN_DIR}/upda-cli-windows-amd64 cmd/cli/main.go
CGO_ENABLED=0 GO111MODULE=on GOOS=windows GOARCH=amd64 go build -tags prod -o ${BIN_DIR}/upda-cli-windows-amd64 cmd/cli/main.go
build-cli-windows-arm64:
CGO_ENABLED=0 GO111MODULE=on GOOS=windows GOARCH=arm64 go build -o ${BIN_DIR}/upda-cli-windows-arm64 cmd/cli/main.go
CGO_ENABLED=0 GO111MODULE=on GOOS=windows GOARCH=arm64 go build -tags prod -o ${BIN_DIR}/upda-cli-windows-arm64 cmd/cli/main.go
checkstyle:
go vet ./...
# remove built build/conf directory to be served live from the running binary
build-web:
cd ${WEB_DIR}; npm run build; rm -rf build/conf
# ci
clean-ci: clean
dependencies-ci: dependencies
checkstyle-ci: checkstyle
test:
go test -race ./...
test-ci: test
test-ci: test
build-server-ci: build-server-linux-amd64
build-cli-ci: build-cli-linux-amd64
build-web-ci: build-web
ci: clean-ci dependencies-ci checkstyle-ci test-ci build-web-ci build-server-ci build-cli-ci

View file

@ -1,6 +1,6 @@
# README
Backend for upda - **Up**date **Da**shboard in Go.
upda - **Up**date **Da**shboard in Go.
The main git repository is hosted at
_[https://git.myservermanager.com/varakh/upda](https://git.myservermanager.com/varakh/upda)_.
@ -8,10 +8,12 @@ Other repositories are mirrors and pull requests, issues, and planning are manag
Contributions are very welcome!
[Official documentation](https://git.myservermanager.com/varakh/upda-docs) is hosted in a separate git repository.
See [official documentation](./_doc/Home.md).
## Development & contribution
There's also a [embedded frontend](#embedded-frontend).
* Pay attention to `make checkstyle` (uses `go vet ./...`); pipeline fails if issues are detected.
* Each entity has its own repository
* Each entity is only used in repository and service (otherwise, mapping happens)
@ -33,6 +35,18 @@ Contributions are very welcome!
* Consider reading [Effective Go](https://go.dev/doc/effective_go)
* Consider reading [100 Go Mistakes and How to Avoid Them](https://100go.co/)
## Embedded Frontend
_upda_ includes a frontend in a monorepo fashion inside `server/web/`. For production (binary and OCI), it's
embedded into the GoLang binary itself.
For _development_, no other steps are required. Simply follow the [frontend instructions](./server/web/README.md) and
start the frontend separately.
If you like to have a look on the _production_ experience, the frontend needs to be build first and you need to build
the Golang binary with `-tags prod`. How to properly build the frontend, please look into `build-web` of
the `Makefile` (additional `rm -rf` cmd).
### Getting started
Ensure to set the following environment variables for proper debug logs during development

63
_doc/Concepts.md Normal file
View file

@ -0,0 +1,63 @@
# Concepts, a deeper dive
The following section goes into a deeper look into upda's internals.
1. Create a webhook in upda.
2. Use the webhook's URL in a 3rd party application to start tracking an update or use `upda-cli` to report an update.
3. Enjoy visualization and state management of tracked updates in one place.
4. Optionally, define _Actions_ for tracked updates as they arrive
_upda_ retrieves new updates when webhooks of upda are invoked, e.g., [duin](https://crazymax.dev/diun/) invokes it or
any other application which can reach the instance. Tracked updates are unique for the
attributes `(application,provider,host)` which means that subsequent updates for an identical _application_, _provider_
and _host_ simply updates the `version` and `metadata` attributes for that tracked _update_ (regardless if the version
or metadata payload _actually_ changed - reasoning behind this is to get reflected metadata updates independent if
version attribute has changed).
State management of tracked updates:
* On first creation, state is set to _pending_.
* When an _update_ is in _approved_ state, an invocation for it resets its state to _pending_.
* _Ignored_ updates are skipped entirely and no attribute is updated.
##### The `application` attribute
The _application_ attribute is an arbitrary identifier, name or label of a subject you like to track,
e.g., `docker.io/varakh/upda` for an OCI image.
##### The `provider` attribute
The _provider_ attribute is an arbitrary name or label. During webhook invocation the provider attribute is derived in
priority:
For the _generic_ webhook:
1. If the incoming payload contains a non-blank `provider` attribute, it's taken from the request.
2. If the incoming payload contains a blank or missing `provider` attribute, the issuing webhook's label is taken.
For the _diun_ webhook:
1. If the issuing webhook's label is blank, then `oci` is used.
2. In any other case, the webhook's label is used.
Because the first priority is the issuing webhook's label, setting the _same_ label for all webhooks results in a
grouping. Also see the _ignore host_ setting for `host` below.
_Remember that changing a webhook's label won't be reflected in already created/tracked updates!_
##### The `host` attribute
_host_ should be set to the originating host name a webhook has been issued from. The _host_
attribute can also be "ignored" (a setting in each webhook). If set to ignored, _upda_ sets _host_ to _global_, thus
update versions can be grouped independent of the originating host. If set for all webhooks, you'll end up with a host
independent update dashboard.
##### The `version` attribute
The _version_ attribute is an arbitrary name or label and subject to change across invocations of webhooks. This can be
a version number, a number of total updates, anything.
##### The `metadata` attribute
An update can hold any additional metadata information provided by request payload `metadata`. Metadata can be inspected
via web interface or API.

74
_doc/Configuration.md Normal file
View file

@ -0,0 +1,74 @@
# Configuration
The following table describe available configuration values.
| Variable | Purpose | Default/Description |
|:------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------|
| `SECRET` | A 32 character long secure random secret used for encrypting some data inside the database. When data has been created inside the database, the secret cannot be changed anymore, otherwise decryption fails. | Not set by default, you need to explicitly set it, e.g., generate via `openssl rand -hex 16` |
| `TZ` | The time zone (**recommended** to set it properly, background tasks depend on it) | Defaults to `Europe/Berlin`, can be any time zone according to _tz database_ |
| | | |
| `AUTH_MODE` | The auth mode. Possible values are `basic_single` and `basic_credentials` | Defaults to `basic_single` |
| `BASIC_AUTH_USER` | For auth mode `basic_single`: Username for login | Not set by default, you need to explicitly set it to user name |
| `BASIC_AUTH_PASSWORD` | For auth mode `basic_single`: User's password for login | Not set by default, you need to explicitly set it to a secure random |
| `BASIC_AUTH_CREDENTIALS` | For auth mode `basic_credentials`: list of comma separated credentials, e.g. `username1=password1,username2=password2` | Not set by default, you need to explicitly set it |
| | | |
| `DB_TYPE` | The database type (Postgres is **recommended**) | Defaults to `sqlite`, possible values are `sqlite` or `postgres` |
| `DB_SQLITE_FILE` | Path to the SQLITE file | Defaults to `<XDG_DATA_DIR>/upda/upda.db`, e.g. `~/.local/share/upda/upda.db` |
| `DB_POSTGRES_HOST` | The postgres host | Postgres host address, defaults to `localhost` |
| `DB_POSTGRES_PORT` | The postgres port | Postgres port, defaults to `5432` |
| `DB_POSTGRES_NAME` | The postgres database name | Postgres database name, needs to be set |
| `DB_POSTGRES_TZ` | The postgres time zone | Postgres time zone settings, defaults to `Europe/Berlin` |
| `DB_POSTGRES_USER` | The postgres user | Postgres user name, needs to be set |
| `DB_POSTGRES_PASSWORD` | The postgres password | Postgres user password, needs to be set |
| | | |
| `SERVER_PORT` | Port | Defaults to `8080` |
| `SERVER_LISTEN` | Server's listen address | Defaults to empty which equals `0.0.0.0` |
| `SERVER_TLS_ENABLED` | If server uses TLS | Defaults `false` |
| `SERVER_TLS_CERT_PATH` | When TLS enabled, provide the certificate path | |
| `SERVER_TLS_KEY_PATH` | When TLS enabled, provide the key path | |
| `SERVER_TIMEOUT` | Timeout the server waits before shutting down to end any pending tasks | Defaults to `1s` (1 second), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| `CORS_ALLOW_ORIGINS` | CORS configuration | Defaults to `*` |
| `CORS_ALLOW_METHODS` | CORS configuration | Defaults to `GET, POST, PUT, PATCH, DELETE, OPTIONS` |
| `CORS_ALLOW_HEADERS` | CORS configuration | Defaults to `Authorization, Content-Type` |
| `CORS_ALLOW_CREDENTIALS` | CORS configuration | Defaults to `true` |
| `CORS_EXPOSE_HEADERS` | CORS configuration | Defaults to `*` |
| | | |
| `LOGGING_LEVEL` | Logging level. Possible are `debug`, `info`, `warn`, `error`, `dpanic`, `panic`, `fatal`. Setting to `debug` enables high verbosity output. | Defaults to `info` |
| `LOGGING_ENCODING` | Logging encoding. Possible are `console` and `json` | Defaults to `json` |
| `LOGGING_DIRECTORY` | Logging directory. When set, logs will be added to a file called `upda.log` in addition to the standard output. Ensure that upda has access permissions. Use an external program for log rotation if desired. | |
| | | |
| `WEBHOOKS_TOKEN_LENGTH` | The length of the token | Defaults to `16`, positive number |
| | | |
| `TASK_UPDATE_CLEAN_STALE_ENABLED` | If background task should run to do housekeeping of stale (ignored/approved) updates from the database | Defaults to `false` |
| `TASK_UPDATE_CLEAN_STALE_INTERVAL` | Interval at which a background task does housekeeping by deleting stale (ignored/approved) updates from the database | Defaults to `1h` (1 hour), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| `TASK_UPDATE_CLEAN_STALE_MAX_AGE` | Number defining at which age stale (ignored/approved) updates are deleted by the background task (_updatedAt_ attribute decides) | Defaults to `720h` (168 hours = 1 week), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| | | |
| `TASK_EVENT_CLEAN_STALE_ENABLED` | If background task should run to do housekeeping of stale (old) events from the database | Defaults to `false` |
| `TASK_EVENT_CLEAN_STALE_INTERVAL` | Interval at which a background task does housekeeping by deleting stale (old) events from the database | Defaults to `8h` (8 hours), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| `TASK_EVENT_CLEAN_STALE_MAX_AGE` | Number defining at which age stale (old) events are deleted by the background task (_updatedAt_ attribute decides) | Defaults to `2190h` (2190 hours = 3 months), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| | | |
| `TASK_ACTIONS_ENQUEUE_ENABLED` | If background task should run to enqueue matching actions derived from events (actions are invocation separately after being enqueued) | Defaults to `true` |
| `TASK_ACTIONS_ENQUEUE_INTERVAL` | Interval at which a background task does check to enqueue actions | Defaults to `10s` (10 seconds), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| `TASK_ACTIONS_ENQUEUE_BATCH_SIZE` | Number defining how many unhandled events are processed in a batch by the background task | Defaults to `1`, must be positive number |
| | | |
| `TASK_ACTIONS_INVOKE_ENABLED` | If background task should run to invoke enqueued actions derived | Defaults to `true` |
| `TASK_ACTIONS_INVOKE_INTERVAL` | Interval at which a background task does check to invoke enqueued actions | Defaults to `10s` (10 seconds), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| `TASK_ACTIONS_INVOKE_BATCH_SIZE` | Number defining how many enqueued actions are processed in a batch by the background task | Defaults to `1`, must be positive number |
| `TASK_ACTIONS_INVOKE_MAX_RETRIES` | Number defining how often actions are invoked in case of an error, if exceeded, those actions are not retried again | Defaults to `3`, must be positive number |
| | | |
| `TASK_ACTIONS_CLEAN_STALE_ENABLED` | If background task should run to do housekeeping of stale (handled, meaning success or error state) actions from the database | Defaults to `true` |
| `TASK_ACTIONS_CLEAN_STALE_INTERVAL` | Interval at which a background task does housekeeping by deleting stale (handled) actions from the database | Defaults to `12h` (12 hours), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| `TASK_ACTIONS_CLEAN_STALE_MAX_AGE` | Number defining at which age stale (handled) actions are deleted by the background task (_updatedAt_ attribute decides) | Defaults to `720h` (720 hours = 30 days), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| | | |
| `TASK_PROMETHEUS_REFRESH_INTERVAL` | Interval at which a background task updates custom metrics | Defaults to `60s` (60 seconds), qualifier can be `s = second`, `m = minute`, `h = hour` prefixed with a positive number |
| | | |
| `LOCK_REDIS_ENABLED` | If locking via REDIS (multiple instances) is enabled. Requires REDIS. Otherwise uses in-memory locks. | Defaults to `false` |
| `LOCK_REDIS_URL` | If locking via REDIS is enabled, this should point to a resolvable REDIS instance, e.g. `redis://<user>:<pass>@localhost:6379/<db>`. | |
| | | |
| `PROMETHEUS_ENABLED` | If Prometheus metrics are exposed | Defaults to `false` |
| `PROMETHEUS_METRICS_PATH` | Defines the metrics endpoint path | Defaults to `/metrics` |
| `PROMETHEUS_SECURE_TOKEN_ENABLED` | If Prometheus metrics endpoint is protected by a token when enabled (**recommended**) | Defaults to `true` |
| `PROMETHEUS_SECURE_TOKEN` | The token securing the metrics endpoint when enabled (**recommended**) | Not set by default, you need to explicitly set it to a secure random |
| | | |
| `WEB_API_URL` | Base URL of API, e.g. `https://upda.domain.tld` | `http://localhost` |
| `WEB_TITLE` | The title of the frontend page | `upda` |

228
_doc/Deployment.md Normal file
View file

@ -0,0 +1,228 @@
# Deployment
_upda_ is a server application which embeds a webinterface directly in its binary form. This makes it easy to deploy
natively. In addition, a _upda_ docker image is provided to get started quickly.
_upda-cli_ which is an optional commandline helper to quickly invoke webhooks or list tracked updates in
your is also embedded into the docker image, but can also be downloaded for your operating system.
The following sections outline how to deploy _upda_ in a containerized environment and also natively.
## Container
Use one of the provided `docker-compose` examples, edit to your needs. Then issue `docker compose up -d` command and
`docker compose logs -f` to trace the log.
Default image user is `appuser` (`uid=2033`) and group is `appgroup` (`gid=2033`).
The following examples are available
### Postgres
#### docker-compose
```yaml
networks:
internal:
external: false
driver: bridge
driver_opts:
com.docker.network.bridge.name: br-upda
services:
app:
container_name: upda_app
image: git.myservermanager.com/varakh/upda:latest
environment:
- WEB_API_URL=https://upda.domain.tld
- WEB_TITLE=upda
- TZ=Europe/Berlin
- DB_POSTGRES_TZ=Europe/Berlin
- DB_TYPE=postgres
- DB_POSTGRES_HOST=db
- DB_POSTGRES_PORT=5432
- DB_POSTGRES_NAME=upda
- DB_POSTGRES_USER=upda
- DB_POSTGRES_PASSWORD=upda
- BASIC_AUTH_USER=admin
- BASIC_AUTH_PASSWORD=changeit
# generate 32 character long secret, e.g., with "openssl rand -hex 16"
- SECRET=generated-secure-secret-32-chars
restart: unless-stopped
networks:
- internal
ports:
- "127.0.0.1:8080:8080"
depends_on:
- db
db:
container_name: upda_db
image: postgres:16
restart: unless-stopped
environment:
- POSTGRES_USER=upda
- POSTGRES_PASSWORD=upda
- POSTGRES_DB=upda
networks:
- internal
volumes:
- upda-db-vol:/var/lib/postgresql/data
volumes:
upda-db-vol:
external: false
```
### SQLite
#### docker-compose
You can use the following to get it up running quickly via docker compose.
```yaml
networks:
internal:
external: false
driver: bridge
driver_opts:
com.docker.network.bridge.name: br-upda
services:
app:
container_name: upda_app
image: git.myservermanager.com/varakh/upda:latest
environment:
- WEB_API_URL=https://upda.domain.tld
- WEB_TITLE=upda
- TZ=Europe/Berlin
- BASIC_AUTH_USER=admin
- BASIC_AUTH_PASSWORD=changeit
# generate 32 character long secret, e.g., with "openssl rand -hex 16"
- SECRET=generated-secure-secret-32-chars
restart: unless-stopped
networks:
- internal
volumes:
- upda-app-vol:/home/appuser
ports:
- "127.0.0.1:8080:8080"
volumes:
upda-app-vol:
external: false
```
#### Local example
For spinning it up **locally** and without a [reverse proxy](#reverse-proxy), you can use the following simple `docker`
commands.
Make sure to adapt `DOMAIN` and pipe in your device IP address (LAN), e.g., `192.168.1.42`.
```shell
# create volume
docker volume create upda-app-vol
# run locally binding to your LAN IP address
docker run --name upda_app \
-p 8080:8080 \
-e TZ=Europe/Berlin \
-e WEB_API_URL=http://192.168.1.42:8080 \
-e BASIC_AUTH_USER=admin \
-e BASIC_AUTH_PASSWORD=changeit \
-v upda-app-vol:/home/appuser \
varakh/upda:latest
```
## High availability
For high availability, pick the [Postgres setup](#postgres) and add [REDIS](https://redis.io/) to support proper
distributed locking.
Make changes to your docker-compose deployment similar to the following:
```yaml
# the existing app service - add these changes to all instances, so they all use the same redis instance
# make sure that all of them can connect to the redis instance
# ...
app:
environment:
- LOCK_REDIS_ENABLED=true
- LOCK_REDIS_URL=redis://redis:6379/0
# the new redis service
redis:
container_name: upda_redis
image: redis
restart: unless-stopped
networks:
- internal
volumes:
- redis-data-vol:/var/redis/data
# optionally expose port depending on your setup
ports:
- "127.0.0.1:6379:6379"
volumes:
# other already defined volumes
# ...
redis-data-vol:
external: false
```
In addition, you need a proper load balancer which routes incoming traffic to all of your instances.
Furthermore, you can also decide to have the frontend in a high-availability setup.
## Reverse proxy
You may want to use a proxy in front of them on your host, e.g., nginx. Here's a configuration snippet which should do
the work.
The UI and API (backend/server) is reachable through the same domain, e.g., `https://upda.domain.tld`. In addition,
Let's Encrypt is used for transport encryption.
```shell
server {
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/upda.domain.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/upda.domain.tld/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
## Native
Native deployment is also possible.
Download the binary for your operating system. Next, use the binary or execute it locally.
See the provided systemd service example `upda.service` to deploy on a UNIX/Linux machine.
```shell
[Unit]
Description=upda
After=network.target
[Service]
Type=simple
# Using a dynamic user drops privileges and sets some security defaults
# See https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html
DynamicUser=yes
# All environment variables for upda can be put into this file
# upda picks them up (on each restart)
EnvironmentFile=/etc/upda.conf
# Requires upda' binary to be installed at this location, e.g., via package manager or copying it over manually
ExecStart=/usr/local/bin/upda-server
```
For a full set of available configuration, look into the [Configuration](./Configuration.md) section. Furthermore,
it's recommended to set up proper [Monitoring](./Monitoring.md).

47
_doc/Home.md Normal file
View file

@ -0,0 +1,47 @@
# upda
**Up**date **Da**shboard (upda). A simple application to keep track of updates from different hosts and systems.
Managing various application or OCI container image updates can be a tedious task:
* A lot of hosts to operate with a lot of different applications being deployed
* A lot of different OCI containers to watch for updated images
* No convenient dashboard to see and manage all the available updates in one place
_upda_ manages a list of updates with attributes attached to it. For new updates to arrive, _upda_ needs to be called
via a webhook call (created within _upda_) from other applications, such as a bash script, an
application like [duin](https://crazymax.dev/diun/) or simply by using the `upda-cli`.
Please head over to the [Usage](./Usage.md) section for a quick _Getting Started_ once you've [deployed](./Deployment.md)
_upda_.
The code is hosted here: [upda and CLI application including frontend](https://git.myservermanager.com/varakh/upda).
## Features
_upda_ manages a list of updates with attributes attached to it. For new updates to arrive, _upda_ needs to get them
from an external source.
For this, _upda_ allows to manage webhooks, which can be called with a unique URL from any other application or even a
bash script so that upda retrieves these information.
_upda_'s main features include
* Managing [Updates](./Usage.md#manage-updates) by changing their state (pending, ignored, approved)
* Managing [Webhooks](./Usage.md#getting-updates-in-via-webhooks) which allow to get information into _upda_ regarding Updates
and their properties (like version) you like to track
* Managing [Actions](./Usage.md#actions) which allow you to further process changes made to an Update (created, state
changed, version
changed,), basically allowing you to invoke other systems with the help
of [shoutrrr](https://containrrr.dev/shoutrrr/)
* View [past invocation of Actions](./Usage.md#history-of-actions)
* Viewing [events](./Usage.md#see-what-has-changed) which allow you to see what has changed and how Updates
* [Metrics exporter](./Monitoring.md) via prometheus
_upda_ is designed to be simple. Only supported authorization mechanism is basic.
## What it is not
_upda_ is **NOT** a scraper to watch docker registries or GitHub releases, it simply tracks and consolidates updates
from different sources, but you need to feed in these information on your own, e.g., via Webhooks. If you like to watch
GitHub releases, write a scraper and use `upda-cli` to report back to _upda_.

2242
_doc/Monitoring.md Normal file

File diff suppressed because it is too large Load diff

174
_doc/Usage.md Normal file
View file

@ -0,0 +1,174 @@
# Usage
Getting started in _upda_ is easy after it has been [deployed](./Deployment.md) successfully and is reachable through your
browser.
![img](./img/updates.png)
## Login
Head over to the deployed _upda_ instance in your browser and login with your credentials.
![img](./img/login.png)
## Getting updates in via Webhooks
To get your first updates into _upda_, create a new Webhook. Webhooks are the central piece of how _upda_ gets notified
about updates.
![img](./img/webhooks.png)
After you've created a new Webhook, you should see
* a unique _upda_ `URL` which serves as entrypoint of other 3rd party applications,
e.g., `/api/v1/webhooks/<a unique identifier>` and
* a corresponding `token` (write it down somewhere, you won't see it again after initial creation) for the URL which
must be sent as `X-Webhook-Token` header when calling _upda_'s URL.
Next step is to make your 3rd party application use this webhook and bring in new updates into _upda_.
A good example is [duin](https://crazymax.dev/diun/), which is able to watch docker images for changes and updates. It
can be configured with a config file
and [diun's "notif" plugin supports calling external webhooks once a change is observed](https://crazymax.dev/diun/notif/webhook/).
We just need to configure _upda_ as the receiving application in diun's configuration file.
```yaml
notif:
webhook:
endpoint: https://upda.domain.tld/api/v1/webhooks/ee03cd9e-04d0-4c7f-9866-efe219c2501e
method: POST
headers:
content-type: application/json
X-Webhook-Token: <the token from webhook creation in upda>
timeout: 10s
```
Expected payload is derived from the _type_ of the webhook which has been created in _upda_.
In addition, a webhook in _upda_ can be set to ignore the host. Please read more on that in the [Concepts](./Concepts.md)
section.
## Actions
Actions can be used to invoke arbitrary third party tools when an _event_ occurs, e.g., an update has been created or
modified. An action is triggered when its conditions are met, which means that the action's definition (event name,
host, application, provider) fits the change which happend in _upda_.
Actions have types. Different types require different payload to set them up. [shoutrrr](#shoutrrr) is supported as
action type, which can send notifications to a variety of services like Gotify, Ntfy, Teams, OpsGenie and many more.
It in turn also support invoking calls to an external URL. This means you can have a stream of events being triggered
when an update arrives in _upda_.
To create an Action, go to the Actions tab and click on _Create new action_. Enter the necessary information and
consult the Action's type documentation if necessary.
![img](./img/actions.png)
Supported events for Actions are the following:
| Event name | Description |
|:-------------------------|:--------------------------------------------------------------------|
| `update_created` | An update has been created |
| `update_updated` | An update has been updated (not necessarily its version attribute!) |
| `update_updated_state` | An update's state changed |
| `update_updated_version` | An update's version changed |
| `update_deleted` | An update has been removed |
For privacy, an action's configuration supports upda's **secrets** vault, which means that before an action is
triggered, any occurrence of `<SECRET>SECRET_KEY</SECRET>` is properly replaced by the value of the `SECRET_KEY` defined
inside the vault.
Secrets can be used in all payload for an Action, including shoutrrr's URL. To create a new secret, go to the _Secrets_
tab and click on _Create new secret_.
![img](./img/secrets.png)
In addition to secrets, upda provides **variables** which can be used with the `<VAR>VARIABLE_NAME</VAR>` syntax and any
occurrence is replaced before invocation as well.
| Variable name | Description |
|:-------------------------|:--------------------------------------------------|
| `<VAR>APPLICATION</VAR>` | The update's application name invoking the action |
| `<VAR>PROVIDER</VAR>` | The update's provider name invoking the action |
| `<VAR>HOST</VAR>` | The update's host invoking the action |
| `<VAR>VERSION</VAR>` | The update's version (latest) invoking the action |
| `<VAR>STATE</VAR>` | The update's state invoking the action |
#### shoutrrr
[shoutrrr](https://github.com/containrrr/shoutrrr?tab=readme-ov-file#documentation) supports multiple services directly
which can be provided as simple URL, e.g., `gotify://gotify.example.com:443/<token>`, where `<token>`
can also be provided as secret: `gotify://gotify.example.com:443/<SECRET>GOTIFY_TOKEN</SECRET>`.
##### shoutrrr: example for sending mails
Before starting, add the following _Secrets_:
```
MAIL_USER
MAIL_PASS
MAIL_HOST
MAIL_PORT
MAIL_FROM
MAIL_TO
```
For each event, now create a new _Action_ with different payload:
_New updates_
| Field | Content |
|:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| URL 1 | `smtp://<SECRET>MAIL_USER</SECRET>:<SECRET>MAIL_PASS</SECRET>@<SECRET>MAIL_HOST</SECRET>:<SECRET>MAIL_PORT</SECRET>/?from=<SECRET>MAIL_FROM</SECRET>&to=<SECRET>MAIL_TO</SECRET>&Subject=[upda]+New+Update` |
| Body | `New update '<VAR>APPLICATION</VAR>' (<VAR>VERSION</VAR>) arrived on <VAR>HOST</VAR> for provider <VAR>PROVIDER</VAR>.` |
_Update changed_
| Field | Content |
|:------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| URL 1 | `smtp://<SECRET>MAIL_USER</SECRET>:<SECRET>MAIL_PASS</SECRET>@<SECRET>MAIL_HOST</SECRET>:<SECRET>MAIL_PORT</SECRET>/?from=<SECRET>MAIL_FROM</SECRET>&to=<SECRET>MAIL_TO</SECRET>&Subject=[upda]+Update+changed` |
| Body | `Update '<VAR>APPLICATION</VAR>' (<VAR>VERSION</VAR>) changed on <VAR>HOST</VAR> for provider <VAR>PROVIDER</VAR>.` |
_Version changed_
| Field | Content |
|:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| URL 1 | `smtp://<SECRET>MAIL_USER</SECRET>:<SECRET>MAIL_PASS</SECRET>@<SECRET>MAIL_HOST</SECRET>:<SECRET>MAIL_PORT</SECRET>/?from=<SECRET>MAIL_FROM</SECRET>&to=<SECRET>MAIL_TO</SECRET>&Subject=[upda]+Update+version+changed` |
| Body | `Update's version changed to '<VAR>VERSION</VAR>' for '<VAR>APPLICATION</VAR>' on <VAR>HOST</VAR> and provider <VAR>PROVIDER</VAR>.` |
_State changed_
| Field | Content |
|:------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| URL 1 | `smtp://<SECRET>MAIL_USER</SECRET>:<SECRET>MAIL_PASS</SECRET>@<SECRET>MAIL_HOST</SECRET>:<SECRET>MAIL_PORT</SECRET>/?from=<SECRET>MAIL_FROM</SECRET>&to=<SECRET>MAIL_TO</SECRET>&Subject=[upda]+Update+state+changed` |
| Body | `Update's state changed to '<VAR>STATE</VAR>' for '<VAR>APPLICATION</VAR>' (<VAR>VERSION</VAR>) on <VAR>HOST</VAR> and provider <VAR>PROVIDER</VAR>.` |
In addition, you can have multiple URL fields, e.g., for sending a mail and a push notification.
### History of actions
Whenever new updates come in, are changed or an update's state changes, _upda_ enqueues all matching Actions.
If you head over to the Action History tab, you see pending, currently running, successful or error invocations of
actions.
![img](./img/actions_history.png)
## Manage updates
Once Update are in _upda_, you can filter them by state, application or other properties to only see pending Updates for
example.
Furthermore, you can change their state to be ignored (see [Concepts](./Concepts.md)) or delete them.
![img](./img/updates.png)
In addition, you can view an Update's details by clicking on the small info icon for an Update.
![img](./img/updates_detail.png)
## See what has changed
For a full activity view, head over to the Events tab.
![img](./img/events.png)

View file

@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: upda
description: API specification
version: 3.0.3
version: 4.0.0
externalDocs:
description: Find out more about the project
url: https://git.myservermanager.com/varakh/upda

BIN
_doc/img/actions.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
_doc/img/events.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
_doc/img/login.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
_doc/img/secrets.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
_doc/img/updates.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
_doc/img/updates_detail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
_doc/img/webhooks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View file

@ -1,5 +1,5 @@
package commons
const (
Version = "3.0.3"
Version = "4.0.0"
)

1
go.mod
View file

@ -9,6 +9,7 @@ require (
github.com/adrg/xdg v0.5.1
github.com/containrrr/shoutrrr v0.8.0
github.com/gin-contrib/cors v1.7.2
github.com/gin-contrib/static v1.1.2
github.com/gin-contrib/zap v1.1.4
github.com/gin-gonic/gin v1.10.0
github.com/go-co-op/gocron-redis-lock/v2 v2.0.1

73
go.sum
View file

@ -8,8 +8,6 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/Microsoft/hcsshim v0.11.1 h1:hJ3s7GbWlGK4YVV92sO88BQSyF4ZLVy7/awqOlPxFbA=
github.com/Microsoft/hcsshim v0.11.1/go.mod h1:nFJmaO4Zr5Y7eADdFOpYswDDlNVbvcIJJNJLECr5JQg=
github.com/adrg/xdg v0.5.0 h1:dDaZvhMXatArP1NPHhnfaQUqWBLBsmx1h1HXQdMoFCY=
github.com/adrg/xdg v0.5.0/go.mod h1:dDdY4M4DF9Rjy4kHPeNL+ilVF+p2lK8IdM9/rTSGcI4=
github.com/adrg/xdg v0.5.1 h1:Im8iDbEFARltY09yOJlSGu4Asjk2vF85+3Dyru8uJ0U=
github.com/adrg/xdg v0.5.1/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ=
github.com/appleboy/gofight/v2 v2.1.2 h1:VOy3jow4vIK8BRQJoC/I9muxyYlJ2yb9ht2hZoS3rf4=
@ -42,8 +40,6 @@ github.com/containrrr/shoutrrr v0.8.0 h1:mfG2ATzIS7NR2Ec6XL+xyoHzN97H8WPjir8aYzJ
github.com/containrrr/shoutrrr v0.8.0/go.mod h1:ioyQAyu1LJY6sILuNyKaQaw+9Ttik5QePU8atnAdO2o=
github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E=
github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -67,14 +63,14 @@ github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQ
github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-contrib/static v1.1.2 h1:c3kT4bFkUJn2aoRU3s6XnMjJT8J6nNWJkR0NglqmlZ4=
github.com/gin-contrib/static v1.1.2/go.mod h1:Fw90ozjHCmZBWbgrsqrDvO28YbhKEKzKp8GixhR4yLw=
github.com/gin-contrib/zap v1.1.4 h1:xvxTybg6XBdNtcQLH3Tf0lFr4vhDkwzgLLrIGlNTqIo=
github.com/gin-contrib/zap v1.1.4/go.mod h1:7lgEpe91kLbeJkwBTPgtVBy4zMa6oSBEcvj662diqKQ=
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/go-co-op/gocron-redis-lock/v2 v2.0.1 h1:xM+mzO88L+kODvY4vIUVLlZuyWazK5vJfK0DiFachdQ=
github.com/go-co-op/gocron-redis-lock/v2 v2.0.1/go.mod h1:FSHZ13f4bfH37RpJi9l3vl2GTiJRUI6xTDbUvXLoqrY=
github.com/go-co-op/gocron/v2 v2.11.0 h1:IOowNA6SzwdRFnD4/Ol3Kj6G2xKfsoiiGq2Jhhm9bvE=
github.com/go-co-op/gocron/v2 v2.11.0/go.mod h1:xY7bJxGazKam1cz04EebrlP4S9q4iWdiAylMGP3jY9w=
github.com/go-co-op/gocron/v2 v2.12.1 h1:dCIIBFbzhWKdgXeEifBjHPzgQ1hoWhjS4289Hjjy1uw=
github.com/go-co-op/gocron/v2 v2.12.1/go.mod h1:xY7bJxGazKam1cz04EebrlP4S9q4iWdiAylMGP3jY9w=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
@ -87,8 +83,6 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.22.0 h1:k6HsTZ0sTnROkhS//R0O+55JgM8C4Bx7ia+JlgcnOao=
github.com/go-playground/validator/v10 v10.22.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA=
github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
@ -99,8 +93,6 @@ github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-redsync/redsync/v4 v4.13.0 h1:49X6GJfnbLGaIpBBREM/zA4uIMDXKAh1NDkvQ1EkZKA=
github.com/go-redsync/redsync/v4 v4.13.0/go.mod h1:HMW4Q224GZQz6x1Xc7040Yfgacukdzu7ifTDAKiyErQ=
github.com/go-resty/resty/v2 v2.14.0 h1:/rhkzsAqGQkozwfKS5aFAbb6TyKd3zyFRWcdRXLPCAU=
github.com/go-resty/resty/v2 v2.14.0/go.mod h1:IW6mekUOsElt9C7oWr0XRt9BNSD6D5rr9mhk6NjmNHg=
github.com/go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8=
github.com/go-resty/resty/v2 v2.15.3/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
@ -214,8 +206,6 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4=
github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA=
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo=
@ -258,19 +248,14 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8=
github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ=
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
@ -287,45 +272,22 @@ golang.org/x/arch v0.9.0 h1:ub9TgUInamJ8mrZIGlBG6/4TqWeMszd4N8lNorbrr6k=
golang.org/x/arch v0.9.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -333,39 +295,14 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
@ -374,10 +311,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@ -403,8 +336,6 @@ gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkw
gorm.io/driver/sqlite v1.5.6 h1:fO/X46qn5NUEEOZtnjJRWRzZMe8nqJiQ9E+0hi+hKQE=
gorm.io/driver/sqlite v1.5.6/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4=
gorm.io/gorm v1.23.6/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg=
gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8=
gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
moul.io/zapgorm2 v1.3.0 h1:+CzUTMIcnafd0d/BvBce8T4uPn6DQnpIrz64cyixlkk=

View file

@ -16,6 +16,7 @@
"dependencyDashboardOSVVulnerabilitySummary": "all",
// skip next alpine, see https://github.com/mattn/go-sqlite3/issues/1164
"packageRules": [
// oci
{
"matchPackageNames": [
"alpine"
@ -26,25 +27,70 @@
],
"enabled": false
},
// go
{
"matchManagers": [
"gomod"
],
"matchPackagePrefixes": [
"github.com/go-co-op/gocron"
],
"groupName": "gocron"
},
{
"matchManagers": [
"gomod"
],
"matchUpdateTypes": [
"minor"
],
"groupName": "all minor dependencies",
"groupSlug": "all-minor-deps"
"groupName": "GoLang: all minor dependencies",
"groupSlug": "golang-all-minor-deps"
},
{
"matchManagers": [
"gomod"
],
"matchUpdateTypes": [
"patch"
],
"groupName": "all patch dependencies",
"groupSlug": "all-patch-deps"
"groupName": "GoLang: all patch dependencies",
"groupSlug": "golang-all-patch-deps"
},
// node
// GLOBAL: ignore @types/node major and minor (manual upgrade with pipeline required)
{
"matchManagers": [
"npm"
],
"matchPackageNames": [
"@types/node"
],
"matchUpdateTypes": [
"major",
"minor"
],
"enabled": false
},
{
"matchManagers": [
"npm"
],
"matchUpdateTypes": [
"minor"
],
"groupName": "Node: all minor dependencies",
"groupSlug": "node-all-minor-deps"
},
{
"matchManagers": [
"npm"
],
"matchUpdateTypes": [
"patch"
],
"groupName": "Node: all patch dependencies",
"groupSlug": "node-all-patch-deps"
}
]
}

View file

@ -47,13 +47,6 @@ func middlewareAppVersion() gin.HandlerFunc {
}
}
func middlewareAppContentType() gin.HandlerFunc {
return func(c *gin.Context) {
c.Header(api.HeaderContentType, api.HeaderContentTypeApplicationJson)
c.Next()
}
}
// middlewareErrorHandler handles global error handling, does not overwrite any given status (see -1)
func middlewareErrorHandler() gin.HandlerFunc {
return func(c *gin.Context) {

View file

@ -6,6 +6,7 @@ import (
"fmt"
"git.myservermanager.com/varakh/upda/util"
"github.com/gin-contrib/cors"
ginstatic "github.com/gin-contrib/static"
ginzap "github.com/gin-contrib/zap"
"github.com/gin-gonic/gin"
_ "go.uber.org/automaxprocs"
@ -102,12 +103,39 @@ func Start() {
router.Use(middlewareAppName())
router.Use(middlewareAppVersion())
router.Use(middlewareAppContentType())
router.Use(middlewareErrorHandler())
router.Use(middlewareAppErrorRecoveryHandler())
router.NoRoute(middlewareGlobalNotFound())
router.NoMethod(middlewareGlobalMethodNotAllowed())
// in production mode, the frontend is embedded on / during compile time utilizing -tags prod
// if the prod tag is missing, development setup is used and a dummy frontend is shown on /
var targetPath string
if env.appConfig.isDevelopment {
targetPath = "web_dev"
} else {
targetPath = "web/build"
}
router.Use(ginstatic.Serve("/", ginstatic.EmbedFolder(embeddedFiles, targetPath)))
if !env.appConfig.isDevelopment {
embeddedFrontendGroup := router.Group("/")
embeddedFrontendGroup.GET("/conf/runtime-config.js", func(c *gin.Context) {
config := `
const runtime_config = Object.freeze({
VITE_API_URL: '%s/api/v1/',
VITE_APP_TITLE: '%s'
});
Object.defineProperty(window, 'runtime_config', {
value: runtime_config,
writable: false
});
`
c.Data(http.StatusOK, "text/javascript; charset=utf-8", []byte(fmt.Sprintf(config, env.webConfig.apiUrl, env.webConfig.title)))
})
}
router.Use(cors.New(cors.Config{
AllowOrigins: env.serverConfig.corsAllowOrigins,
AllowMethods: env.serverConfig.corsAllowMethods,

View file

@ -0,0 +1,9 @@
//go:build !prod
// +build !prod
package server
import "embed"
//go:embed web_dev
var embeddedFiles embed.FS

View file

@ -0,0 +1,9 @@
//go:build prod
// +build prod
package server
import "embed"
//go:embed web/build/*
var embeddedFiles embed.FS

View file

@ -16,6 +16,12 @@ const (
envTZ = "TZ"
tzDefault = "Europe/Berlin"
envWebApiUrl = "WEB_API_URL"
webApiUrlDefault = "http://localhost"
envWebTitle = "WEB_TITLE"
webTitleDefault = "upda"
envAuthMode = "AUTH_MODE"
authModeDefault = authModeBasicSingle
authModeBasicSingle = "basic_single"

View file

@ -26,6 +26,11 @@ type appConfig struct {
isDebug bool
}
type webConfig struct {
title string
apiUrl string
}
type serverConfig struct {
port int
listen string
@ -85,6 +90,7 @@ type prometheusConfig struct {
type Environment struct {
appConfig *appConfig
webConfig *webConfig
authConfig *authConfig
serverConfig *serverConfig
taskConfig *taskConfig
@ -183,6 +189,13 @@ func bootstrapEnvironment() *Environment {
isDevelopment: isDevelopment,
}
// web config
var webC *webConfig
webC = &webConfig{
title: os.Getenv(envWebTitle),
apiUrl: os.Getenv(envWebApiUrl),
}
// server config
var sc *serverConfig
@ -391,6 +404,7 @@ func bootstrapEnvironment() *Environment {
}
env := &Environment{appConfig: ac,
webConfig: webC,
authConfig: authC,
serverConfig: sc,
taskConfig: tc,
@ -420,6 +434,10 @@ func bootstrapFromEnvironmentAndValidate() {
// app
setEnvKeyDefault(envTZ, tzDefault)
// web
setEnvKeyDefault(envWebTitle, webTitleDefault)
setEnvKeyDefault(envWebApiUrl, webApiUrlDefault)
// webhook
setEnvKeyDefault(envWebhooksTokenLength, webhooksTokenLengthDefault)

2
server/web/.env Normal file
View file

@ -0,0 +1,2 @@
VITE_API_URL=
VITE_APP_TITLE=upda

View file

@ -0,0 +1,2 @@
VITE_API_URL=http://localhost:8080/api/v1/
VITE_APP_TITLE='upda dev'

1
server/web/.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
_doc/*.png filter=lfs diff=lfs merge=lfs -text

32
server/web/.gitignore vendored Normal file
View file

@ -0,0 +1,32 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
/build*
.run/
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
ci/*
!ci/.gitkeep
# production
build/
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.eslintcache
.stylelintcache
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea
/hs_err_pid14224.log

2
server/web/.npmrc Normal file
View file

@ -0,0 +1,2 @@
engine-strict=true
legacy-peer-deps=true

2
server/web/.nvmrc Normal file
View file

@ -0,0 +1,2 @@
lts/iron
v20

View file

@ -0,0 +1,7 @@
node_modules
storybook-static
package-lock.json
dist
ci
build
public

9
server/web/.prettierrc Normal file
View file

@ -0,0 +1,9 @@
{
"printWidth": 120,
"singleQuote": true,
"useTabs": true,
"arrowParens": "always",
"endOfLine": "lf",
"trailingComma": "none",
"bracketSameLine": true
}

41
server/web/.stylelintrc Normal file
View file

@ -0,0 +1,41 @@
{
"extends": ["stylelint-config-standard", "stylelint-prettier/recommended"],
"plugins": ["stylelint-order", "stylelint-declaration-block-no-ignored-properties", "stylelint-prettier"],
"rules": {
"comment-empty-line-before": null,
"selector-class-pattern": null,
"function-name-case": [
"lower",
{
"ignoreFunctions": []
}
],
"no-invalid-double-slash-comments": null,
"no-descending-specificity": null,
"declaration-empty-line-before": null,
"selector-pseudo-element-colon-notation": "single",
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["global"]
}
],
"prettier/prettier": true
},
"overrides": [
{
"files": [
"**/*.less"
],
"customSyntax": "postcss-less"
}
],
"ignoreFiles": [
"**/*.json",
"**/*.svg",
"**/*.ts",
"**/*.tsx",
"**/*.js",
"node_modules/"
]
}

75
server/web/README.md Normal file
View file

@ -0,0 +1,75 @@
# upda-ui
Frontend for upda - **Up**date **Da**shboard in React, TypeScript, Redux.
The main git repository is hosted at
_[https://git.myservermanager.com/varakh/upda-ui](https://git.myservermanager.com/varakh/upda-ui)_. Other repositories
are mirrors and pull requests, issues, and planning are managed there.
Contributions are very welcome!
[Official documentation](https://git.myservermanager.com/varakh/upda-docs) is hosted in a separate git repository.
## Development & contribution
Contributions are very welcome!
### Prerequisites
It's probably worth checking out a node environment manager like [nvm manager](https://github.com/nvm-sh/nvm).
Required node and npm versions are outlined in the `package.json`.
### Setup instructions
Run `npm install` which should install all dependencies.
### Start
Use the `npm run start` command to start the development setup. Backend should be running.
### Configuration magic in docker
What about configuration? How does the pre-compiled set of html, js and css files know about the environment variables?
In contrast to manual build, the docker image allows dynamic override of configuration, but only those outlined in
the `.env` file.
In production, all configuration values are dynamically generated inside the Docker image with a helper script
called `docker-env.sh`:
1. During docker build a template `.env` file and the helper script are copied to the docker image
2. Before the container's nginx is started, the helper script
1. scans the `.env` file for known configuration variables and then
2. adds their values to `conf/runtime-config.js` which is sourced inside the application in the
immutable `window.runtime_config` object
During development, this `runtime-config.js` file is still loaded, but empty and thus the `getConfiguration()` ignores
it and prefers values from the sourced `.env.development`.
This means that new environment variables need to be added to all `.env*` files!
### Release
Releases are handled by the SCM platform and pipeline. Creating a **new git tag**, creates a new release in the SCM
platform, uploads produced artifacts to that release and publishes docker images automatically.
**Before** doing so, please ensure that the **commit on `master`** has the **correct version settings** and has been
built successfully:
* Adapt `package.json` and change `version` to the correct version number
* Invoke `npm install` once which properly sets the version inside the lock file
* Adapt language files, e.g., `en.json` and change `version` to the correct version number
* Adapt `CHANGELOG.md` to reflect changes and ensure a date is properly set in the header, also add a reference link
in footer
* Adapt `env: VERSION_*` in `.forgejo/workflows/release.yaml`
After the release has been created, ensure to change the following settings for the _next development cycle_:
* Adapt `package.json` and change `version` to the _next_ version number (semantic versioning applied, so `patch`
should bump patch level version and prepare branch for `develop` should bump minor or major version)
* Invoke `npm install` for each of those branches which properly sets the version inside the lock file
* Adapt language files, e.g., `en.json` and change `version` to the _next_ version number (semantic versioning
applied, so `patch` should bump patch level version and prepare branch for `develop` should bump minor or major
version)
* Adapt `CHANGELOG.md` and add an _UNRELEASED_ section
* Adapt `env: VERSION_*` in `.forgejo/workflows/release.yaml` to _next_ version number

0
server/web/ci/.gitkeep Normal file
View file

132
server/web/eslint.config.js Normal file
View file

@ -0,0 +1,132 @@
import jsRecommendedLib from '@eslint/js';
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import importPlugin from 'eslint-plugin-import';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
import prettierPlugin from 'eslint-plugin-prettier';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import sonarjsPlugin from 'eslint-plugin-sonarjs';
import testingLibPlugin from 'eslint-plugin-testing-library';
import { fixupPluginRules } from '@eslint/compat';
// eslint.config.js
export default [
{
files: ['**/styles/**', '**/__tests__/**', '**/*.test.tsx', '**/*.test.ts', '*.less', 'src/**/*.tsx'],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
parser: typescriptParser
},
plugins: {
react: reactPlugin,
'react-hooks': fixupPluginRules(reactHooksPlugin),
sonarjs: sonarjsPlugin,
import: fixupPluginRules(importPlugin),
'jsx-a11y': jsxA11yPlugin,
'@typescript-eslint': typescriptPlugin,
prettier: prettierPlugin,
js: jsRecommendedLib,
'testing-library': fixupPluginRules(testingLibPlugin)
},
settings: {
react: {
version: 'detect'
},
'import/resolver': {
typescript: {},
node: {
paths: ['src'],
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}
},
rules: {
...jsRecommendedLib.configs.recommended.rules,
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs['jsx-runtime'].rules,
...reactHooksPlugin.configs.recommended.rules,
...importPlugin.configs.recommended.rules,
...jsxA11yPlugin.flatConfigs.recommended.rules,
semi: 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'no-undef': 'off',
'prefer-const': 'error',
'testing-library/no-debugging-utils': 'warn',
'testing-library/no-dom-import': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-react': 'off',
'no-console': 'warn',
'no-duplicate-imports': 'warn',
'jsx-a11y/no-autofocus': 'off',
'sonarjs/cognitive-complexity': 'off',
'sonarjs/elseif-without-else': 'off',
'sonarjs/max-switch-cases': 'error',
'sonarjs/no-all-duplicated-branches': 'error',
'sonarjs/no-collapsible-if': 'error',
'sonarjs/no-collection-size-mischeck': 'error',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/no-duplicated-branches': 'error',
'sonarjs/no-element-overwrite': 'error',
'sonarjs/no-empty-collection': 'error',
'sonarjs/no-extra-arguments': 'error',
'sonarjs/no-gratuitous-expressions': 'error',
'sonarjs/no-identical-conditions': 'error',
'sonarjs/no-identical-expressions': 'error',
'sonarjs/no-identical-functions': 'error',
'sonarjs/no-ignored-return': 'error',
'sonarjs/no-inverted-boolean-check': 'error',
'sonarjs/no-nested-switch': 'error',
'sonarjs/no-nested-template-literals': 'error',
'sonarjs/no-one-iteration-loop': 'error',
'sonarjs/no-redundant-boolean': 'error',
'sonarjs/no-redundant-jump': 'error',
'sonarjs/no-same-line-conditional': 'error',
'sonarjs/no-small-switch': 'error',
'sonarjs/no-unused-collection': 'error',
'sonarjs/no-use-of-empty-return-value': 'error',
'sonarjs/no-useless-catch': 'error',
'sonarjs/non-existent-operator': 'error',
'sonarjs/prefer-immediate-return': 'error',
'sonarjs/prefer-object-literal': 'error',
'sonarjs/prefer-single-boolean-return': 'error',
'sonarjs/prefer-while': 'error',
'import/order': [
'warn',
{
alphabetize: {
caseInsensitive: true,
order: 'asc'
},
groups: [['builtin', 'external', 'index', 'sibling', 'parent', 'internal']],
'newlines-between': 'always',
pathGroups: [
{
pattern: '*.less',
group: 'index',
patternOptions: {
matchBase: true
},
position: 'before'
},
{
pattern: '*.json',
group: 'index',
patternOptions: {
matchBase: true
},
position: 'after'
}
]
}
]
}
}
];

18
server/web/index.html Normal file
View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="/Favicon16x16.png" sizes="16x16" />
<link rel="icon" type="image/x-icon" href="/Favicon32x32.png" sizes="32x32" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000" />
<script type="module" src="/conf/runtime-config.js"></script>
<link rel="manifest" href="/manifest.json" />
<title>upda</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>

28419
server/web/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

116
server/web/package.json Normal file
View file

@ -0,0 +1,116 @@
{
"name": "upda-ui",
"version": "4.0.0",
"private": true,
"author": "varakh@varakh.de",
"type": "module",
"engines": {
"node": "^20",
"npm": "^10"
},
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"serve": "vite preview",
"test": "vitest watch",
"test:no-watch": "vitest run",
"test:coverage": "vitest run --coverage",
"test:ci": "vitest run --coverage --passWithNoTests",
"format": "prettier --write ./src/**/*.{ts,tsx,less}",
"format:check": "prettier --check ./src/**/*.{ts,tsx,less}",
"lint": "eslint \"./src/**/*.{tsx,ts}\"",
"lintfix": "eslint --fix \"./src/**/*.{tsx,ts}\"",
"lint:style": "stylelint \"./src/**/*.less\"",
"lint-style-fix": "stylelint \"./src/**/*.less\" --fix",
"checkstyle": "npm run checkstyle:ts && npm run checkstyle:less && npm run checkstyle:format",
"checkstyle:format": "npm run format:check",
"checkstyle:ts": "eslint \"./src/**/*.{ts,tsx}\" -f checkstyle > ci/eslint.xml",
"checkstyle:less": "stylelint \"./src/**/*.less\"",
"clean": "npx --quiet rimraf build && npx --quiet rimraf node_modules"
},
"dependencies": {
"@ant-design/icons": "^5.5.1",
"@ant-design/pro-layout": "^7.21.1",
"@reduxjs/toolkit": "^2.3.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@uiw/react-md-editor": "^4.0.4",
"antd": "^5.21.5",
"file-saver": "^2.0.5",
"html-react-parser": "^5.1.18",
"i18next": "^23.16.3",
"i18next-browser-languagedetector": "^8.0.0",
"linkify-html": "^4.1.3",
"linkifyjs": "^4.1.3",
"lodash": "^4.17.21",
"moment-timezone": "^0.5.46",
"react": "^18.3.1",
"react-copy-to-clipboard": "^5.1.0",
"react-dom": "^18.3.1",
"react-i18next": "^15.1.0",
"react-redux": "^9.1.2",
"react-router-dom": "^6.27.0",
"react-virtualized": "^9.22.5",
"typescript": "^5.6.3"
},
"devDependencies": {
"@babel/register": "^7.25.9",
"@eslint/compat": "^1.2.1",
"@eslint/js": "^9.13.0",
"@types/file-saver": "^2.0.7",
"@types/lodash": "^4.17.12",
"@types/node": "^20.16.5",
"@types/react-copy-to-clipboard": "^5.0.7",
"@types/react-virtualized": "^9.21.30",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"@vitejs/plugin-react": "^4.3.3",
"@vitest/coverage-v8": "^2.1.3",
"babel-plugin-import": "^1.13.8",
"c8": "^10.1.2",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-formatter-checkstyle": "^8.40.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-disable": "^2.0.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-sonarjs": "^2.0.4",
"eslint-plugin-testing-library": "^6.4.0",
"jsdom": "^25.0.1",
"less": "^4.2.0",
"less-loader": "^12.2.0",
"postcss-less": "^6.0.0",
"postcss-markdown": "^1.2.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"stylelint": "^16.10.0",
"stylelint-config-standard": "^36.0.1",
"stylelint-declaration-block-no-ignored-properties": "^2.8.0",
"stylelint-order": "^6.0.4",
"stylelint-prettier": "^5.0.2",
"vite": "^5.4.10",
"vite-plugin-eslint2": "^5.0.1",
"vite-plugin-stylelint": "^5.3.1",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.3"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -0,0 +1,7 @@
// Note that Object.freeze is NOT recursive
const runtime_config = Object.freeze({});
Object.defineProperty(window, 'runtime_config', {
value: runtime_config,
writable: false
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,8 @@
{
"short_name": "",
"name": "",
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View file

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

15
server/web/src/App.tsx Normal file
View file

@ -0,0 +1,15 @@
import getConfiguration from './getConfiguration';
import AppRouter from './router/AppRouter';
import { isDevelopment } from './utils/envHelper';
import { useEffect } from 'react';
const App = () => {
useEffect(() => {
if (isDevelopment()) {
document.title = getConfiguration().VITE_APP_TITLE;
}
}, []);
return <AppRouter />;
};
export default App;

View file

@ -0,0 +1,8 @@
const mockConfig = {};
Object.defineProperty(window, 'runtime_config', {
writable: true,
value: mockConfig
});
export { mockConfig };

View file

@ -0,0 +1,4 @@
vi.mock('react-i18next', () => ({
useTranslation: (): [(key: string) => string] => [(key: string): string => key]
}));
export {};

View file

@ -0,0 +1,67 @@
import { injectEndpoints } from './index';
import ActionInvocationFilterQueryParamNames from '../constants/api/actionInvocationFilterQueryParamNames';
import ApiTags from '../constants/apiTags';
import { ActionInvocationsRequestParams, ActionInvocationSingleResponse, ActionInvocationsResponse } from '../types';
import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
const TAG_LIST_ID = 'LIST';
const invalidatesTags = (
results?: ActionInvocationsResponse | ActionInvocationSingleResponse | void,
error?: FetchBaseQueryError
) => {
if (error) {
return [];
}
return [ApiTags.ActionInvocations] as any;
};
export const actionInvocationsApi = injectEndpoints({
endpoints: (build) => {
return {
getActionInvocations: build.query<ActionInvocationsResponse, ActionInvocationsRequestParams>({
query: ({ page, pageSize, order, orderBy }) => {
const params = new URLSearchParams();
if (page) {
params.append(ActionInvocationFilterQueryParamNames.PAGE, `${page}`);
}
if (pageSize) {
params.append(ActionInvocationFilterQueryParamNames.PAGE_SIZE, `${pageSize}`);
}
if (order) {
params.append(ActionInvocationFilterQueryParamNames.ORDER, `${order}`);
}
if (orderBy) {
params.append(ActionInvocationFilterQueryParamNames.ORDER_BY, `${orderBy}`);
}
return { url: `action-invocations?${params.toString()}` };
},
providesTags: (result, error) => {
if (!error && result?.data.content) {
return [
{ type: ApiTags.ActionInvocations, id: TAG_LIST_ID },
...result.data.content.map(({ id }) => ({ type: ApiTags.ActionInvocations, id }))
];
}
return [];
}
}),
getActionInvocationById: build.query<ActionInvocationSingleResponse, { id: string }>({
query: ({ id }) => ({ url: `action-invocations/${id}` }),
providesTags: (result, error) => {
if (!error && result?.data) {
return [{ type: ApiTags.ActionInvocations, id: result.data.id }];
}
return [];
}
}),
deleteActionInvocation: build.mutation<void, { id: string }>({
query: ({ id }) => ({ url: `action-invocations/${id}`, method: 'DELETE' }),
invalidatesTags
})
};
}
});
export const { useGetActionInvocationsQuery, useGetActionInvocationByIdQuery, useDeleteActionInvocationMutation } =
actionInvocationsApi;

View file

@ -0,0 +1,197 @@
import { injectEndpoints } from './index';
import ActionFilterQueryParamNames from '../constants/api/actionFilterQueryParamNames';
import ApiTags from '../constants/apiTags';
import {
ActionSingleResponse,
ActionsRequestParams,
ActionsResponse,
ActionTestSingleResponse,
CreateActionRequest,
ModifyActionEnabledRequest,
ModifyActionLabelRequest,
ModifyActionMatchApplicationRequest,
ModifyActionMatchEventRequest,
ModifyActionMatchHostRequest,
ModifyActionMatchProviderRequest,
ModifyActionPayloadRequest,
TestActionRequest
} from '../types';
import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
const TAG_LIST_ID = 'LIST';
const invalidatesTags = (results?: ActionsResponse | ActionSingleResponse | void, error?: FetchBaseQueryError) => {
if (error) {
return [];
}
return [ApiTags.Actions] as any;
};
export const actionsApi = injectEndpoints({
endpoints: (build) => {
return {
getActions: build.query<ActionsResponse, ActionsRequestParams>({
query: ({ page, pageSize, order, orderBy }) => {
const params = new URLSearchParams();
if (page) {
params.append(ActionFilterQueryParamNames.PAGE, `${page}`);
}
if (pageSize) {
params.append(ActionFilterQueryParamNames.PAGE_SIZE, `${pageSize}`);
}
if (order) {
params.append(ActionFilterQueryParamNames.ORDER, `${order}`);
}
if (orderBy) {
params.append(ActionFilterQueryParamNames.ORDER_BY, `${orderBy}`);
}
return { url: `actions?${params.toString()}` };
},
providesTags: (result, error) => {
if (!error && result?.data.content) {
return [
{ type: ApiTags.Actions, id: TAG_LIST_ID },
...result.data.content.map(({ id }) => ({ type: ApiTags.Actions, id }))
];
}
return [];
}
}),
getActionById: build.query<ActionSingleResponse, { id: string }>({
query: ({ id }) => ({ url: `actions/${id}` }),
providesTags: (result, error) => {
if (!error && result?.data) {
return [{ type: ApiTags.Actions, id: result.data.id }];
}
return [];
}
}),
createAction: build.mutation<ActionSingleResponse, CreateActionRequest>({
query: (body) => ({ url: 'actions', method: 'POST', body }),
invalidatesTags
}),
testAction: build.mutation<ActionTestSingleResponse, { id: string; body: TestActionRequest }>({
query: ({ id, body }) => ({ url: `actions/${id}/test`, method: 'POST', body })
}),
modifyLabelAction: build.mutation<ActionSingleResponse, { id: string; body: ModifyActionLabelRequest }>({
query: ({ id, body }) => ({ url: `actions/${id}/label`, method: 'PATCH', body }),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Actions, id: arg.id }];
}
}),
modifyMatchApplicationAction: build.mutation<
ActionSingleResponse,
{ id: string; body: ModifyActionMatchApplicationRequest }
>({
query: ({ id, body }) => ({
url: `actions/${id}/match-application`,
method: 'PATCH',
body
}),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Actions, id: arg.id }];
}
}),
modifyMatchHostAction: build.mutation<
ActionSingleResponse,
{ id: string; body: ModifyActionMatchHostRequest }
>({
query: ({ id, body }) => ({
url: `actions/${id}/match-host`,
method: 'PATCH',
body
}),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Actions, id: arg.id }];
}
}),
modifyMatchEventAction: build.mutation<
ActionSingleResponse,
{ id: string; body: ModifyActionMatchEventRequest }
>({
query: ({ id, body }) => ({
url: `actions/${id}/match-event`,
method: 'PATCH',
body
}),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Actions, id: arg.id }];
}
}),
modifyMatchProviderAction: build.mutation<
ActionSingleResponse,
{ id: string; body: ModifyActionMatchProviderRequest }
>({
query: ({ id, body }) => ({
url: `actions/${id}/match-provider`,
method: 'PATCH',
body
}),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Actions, id: arg.id }];
}
}),
modifyTypeAndPayloadAction: build.mutation<
ActionSingleResponse,
{ id: string; body: ModifyActionPayloadRequest }
>({
query: ({ id, body }) => ({
url: `actions/${id}/payload`,
method: 'PATCH',
body
}),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Actions, id: arg.id }];
}
}),
modifyEnabledAction: build.mutation<ActionSingleResponse, { id: string; body: ModifyActionEnabledRequest }>(
{
query: ({ id, body }) => ({ url: `actions/${id}/enabled`, method: 'PATCH', body }),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Actions, id: arg.id }];
}
}
),
deleteAction: build.mutation<void, { id: string }>({
query: ({ id }) => ({ url: `actions/${id}`, method: 'DELETE' }),
invalidatesTags
})
};
}
});
export const {
useGetActionsQuery,
useGetActionByIdQuery,
useDeleteActionMutation,
useModifyLabelActionMutation,
useModifyMatchEventActionMutation,
useModifyMatchApplicationActionMutation,
useModifyMatchHostActionMutation,
useModifyMatchProviderActionMutation,
useModifyTypeAndPayloadActionMutation,
useModifyEnabledActionMutation,
useCreateActionMutation,
useTestActionMutation
} = actionsApi;

View file

@ -0,0 +1,60 @@
import { injectEndpoints } from './index';
import EventFilterQueryParamNames from '../constants/api/eventFilterQueryParamNames';
import ApiTags from '../constants/apiTags';
import { EventSingleResponse, EventsRequestParams, EventsResponse } from '../types/event';
const TAG_LIST_ID = 'LIST';
export const eventsApi = injectEndpoints({
endpoints: (build) => {
return {
getEvents: build.query<EventsResponse, EventsRequestParams>({
query: ({ size, skip, order, orderBy }) => {
const params = new URLSearchParams();
if (size) {
params.append(EventFilterQueryParamNames.SIZE, `${size}`);
}
if (skip) {
params.append(EventFilterQueryParamNames.SKIP, `${skip}`);
}
if (order) {
params.append(EventFilterQueryParamNames.ORDER, `${order}`);
}
if (orderBy) {
params.append(EventFilterQueryParamNames.ORDER_BY, `${orderBy}`);
}
return { url: `events?${params.toString()}` };
},
providesTags: (result, error) => {
if (!error && result?.data.content) {
return [
{ type: ApiTags.Events, id: TAG_LIST_ID },
...result.data.content.map(({ id }) => ({ type: ApiTags.Events, id }))
];
}
return [];
}
}),
getEventById: build.query<EventSingleResponse, { id: string }>({
query: ({ id }) => ({ url: `events/${id}` }),
providesTags: (result, error) => {
if (!error && result?.data) {
return [{ type: ApiTags.Events, id: result.data.id }];
}
return [];
}
}),
deleteEvent: build.mutation<void, { id: string }>({
query: ({ id }) => ({ url: `events/${id}`, method: 'DELETE' }),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Events, id: arg.id }];
}
})
};
}
});
export const { useLazyGetEventsQuery, useGetEventByIdQuery, useDeleteEventMutation } = eventsApi;

View file

@ -0,0 +1,16 @@
import { injectEndpoints } from './index';
import ApiTags from '../constants/apiTags';
import { HealthResponse } from '../types';
export const healthApi = injectEndpoints({
endpoints: (build) => {
return {
getHealth: build.query<HealthResponse, void>({
query: () => ({ url: 'health' }),
providesTags: [ApiTags.Health]
})
};
}
});
export const { useGetHealthQuery } = healthApi;

View file

@ -0,0 +1,40 @@
import ApiTags from '../constants/apiTags';
import getConfiguration from '../getConfiguration';
import { updateAuth } from '../slices/authSlice';
import { RootState } from '../store';
import { BaseQueryApi, createApi, FetchArgs, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
const baseQuery = fetchBaseQuery({
baseUrl: getConfiguration().VITE_API_URL,
prepareHeaders: (headers, { getState }) => {
const state = getState() as RootState;
const username = state.auth.username;
const password = state.auth.password;
const authHeader = window.btoa(`${username}:${password}`);
if (username && password && authHeader) {
headers.set('Authorization', `Basic ${authHeader}`);
}
return headers;
}
});
const baseQueryWithReAuth = async (args: string | FetchArgs, api: BaseQueryApi, extraOptions: any) => {
let result = await baseQuery(args, api, extraOptions);
if (result?.meta?.response?.status === 401) {
api.dispatch(updateAuth({ username: null, password: null }));
result = await baseQuery(args, api, extraOptions);
}
return result;
};
export const api = createApi({
reducerPath: 'api',
baseQuery: baseQueryWithReAuth,
tagTypes: Object.values(ApiTags),
endpoints: () => ({})
});
export const { injectEndpoints } = api;

View file

@ -0,0 +1,16 @@
import { injectEndpoints } from './index';
import ApiTags from '../constants/apiTags';
import { InfoResponse } from '../types';
export const infoApi = injectEndpoints({
endpoints: (build) => {
return {
getInfo: build.query<InfoResponse, void>({
query: () => ({ url: 'info' }),
providesTags: [ApiTags.Info]
})
};
}
});
export const { useGetInfoQuery } = infoApi;

View file

@ -0,0 +1,20 @@
import { injectEndpoints } from './index';
import { LoginRequest } from '../types';
export const loginApi = injectEndpoints({
endpoints: (build) => {
return {
getProbeLogin: build.mutation<void, Partial<LoginRequest>>({
query: (body) => ({
url: 'login', // requires an endpoint which return 204 on successful login via basic auth
headers: {
Authorization: `Basic ${window.btoa(body.username + ':' + body.password)}`
}
}),
invalidatesTags: []
})
};
}
});
export const { useGetProbeLoginMutation } = loginApi;

View file

@ -0,0 +1,54 @@
import { injectEndpoints } from './index';
import ApiTags from '../constants/apiTags';
import { CreateSecretRequest, ModifySecretValueRequest, SecretSingleResponse, SecretsResponse } from '../types';
import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
const TAG_LIST_ID = 'LIST';
const invalidatesTags = (results?: SecretsResponse | SecretSingleResponse | void, error?: FetchBaseQueryError) => {
if (error) {
return [];
}
return [ApiTags.Secrets] as any;
};
export const secretsApi = injectEndpoints({
endpoints: (build) => {
return {
getSecrets: build.query<SecretsResponse, void>({
query: () => {
return { url: 'secrets' };
},
providesTags: (result, error) => {
if (!error && result?.data.content) {
return [
{ type: ApiTags.Secrets, id: TAG_LIST_ID },
...result.data.content.map(({ id }) => ({ type: ApiTags.Secrets, id }))
];
}
return [];
}
}),
createSecret: build.mutation<SecretSingleResponse, CreateSecretRequest>({
query: (body) => ({ url: 'secrets', method: 'POST', body }),
invalidatesTags
}),
modifyValueSecret: build.mutation<SecretSingleResponse, { id: string; body: ModifySecretValueRequest }>({
query: ({ id, body }) => ({ url: `secrets/${id}/value`, method: 'PATCH', body }),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Secrets, id: arg.id }];
}
}),
deleteSecret: build.mutation<void, { id: string }>({
query: ({ id }) => ({ url: `secrets/${id}`, method: 'DELETE' }),
invalidatesTags
})
};
}
});
export const { useGetSecretsQuery, useDeleteSecretMutation, useCreateSecretMutation, useModifyValueSecretMutation } =
secretsApi;

View file

@ -0,0 +1,84 @@
import { injectEndpoints } from './index';
import UpdateFilterQueryParamNames from '../constants/api/updateFilterQueryParamNames';
import ApiTags from '../constants/apiTags';
import { ModifyUpdateStateRequest, UpdateSingleResponse, UpdatesRequestParams, UpdatesResponse } from '../types';
import { forEach } from 'lodash';
const TAG_LIST_ID = 'LIST';
export const updatesApi = injectEndpoints({
endpoints: (build) => {
return {
getUpdates: build.query<UpdatesResponse, UpdatesRequestParams>({
query: ({ ...args }) => {
const { page, pageSize, order, orderBy, state, searchIn, searchTerm } = args;
const params = new URLSearchParams();
if (state) {
forEach(state, (s) => {
params.append(UpdateFilterQueryParamNames.STATE, s);
});
}
if (searchIn) {
params.append(UpdateFilterQueryParamNames.SEARCH_IN, `${searchIn}`);
}
if (searchTerm) {
params.append(UpdateFilterQueryParamNames.SEARCH_TERM, `${searchTerm}`);
}
if (page) {
params.append(UpdateFilterQueryParamNames.PAGE, `${page}`);
}
if (pageSize) {
params.append(UpdateFilterQueryParamNames.PAGE_SIZE, `${pageSize}`);
}
if (order) {
params.append(UpdateFilterQueryParamNames.ORDER, `${order}`);
}
if (orderBy) {
params.append(UpdateFilterQueryParamNames.ORDER_BY, `${orderBy}`);
}
return { url: `updates?${params.toString()}` };
},
providesTags: (result, error) => {
if (!error && result?.data.content) {
return [
{ type: ApiTags.Updates, id: TAG_LIST_ID },
...result.data.content.map(({ id }) => ({ type: ApiTags.Updates, id }))
];
}
return [];
}
}),
getUpdateById: build.query<UpdateSingleResponse, { id: string }>({
query: ({ id }) => ({ url: `updates/${id}` }),
providesTags: (result, error) => {
if (!error && result?.data) {
return [{ type: ApiTags.Updates, id: result.data.id }];
}
return [];
}
}),
modifyUpdateState: build.mutation<UpdateSingleResponse, { id: string; body: ModifyUpdateStateRequest }>({
query: ({ id, body }) => ({ url: `updates/${id}/state`, method: 'PATCH', body }),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Updates, id: arg.id }];
}
}),
deleteUpdate: build.mutation<void, { id: string }>({
query: ({ id }) => ({ url: `updates/${id}`, method: 'DELETE' }),
invalidatesTags: (error) => {
if (error) {
return [];
}
return [{ type: ApiTags.Updates }];
}
})
};
}
});
export const { useGetUpdatesQuery, useGetUpdateByIdQuery, useModifyUpdateStateMutation, useDeleteUpdateMutation } =
updatesApi;

View file

@ -0,0 +1,92 @@
import { injectEndpoints } from './index';
import WebhookFilterQueryParamNames from '../constants/api/webhookFilterQueryParamNames';
import ApiTags from '../constants/apiTags';
import {
CreateWebhookRequest,
ModifyWebhookIgnoreHostRequest,
ModifyWebhookLabelRequest,
WebhookSingleResponse,
WebhooksRequestParams,
WebhooksResponse
} from '../types';
import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
const TAG_LIST_ID = 'LIST';
const invalidatesTags = (results?: WebhooksResponse | WebhookSingleResponse | void, error?: FetchBaseQueryError) => {
if (error) {
return [];
}
return [ApiTags.Webhooks] as any;
};
export const webhooksApi = injectEndpoints({
endpoints: (build) => {
return {
getWebhooks: build.query<WebhooksResponse, WebhooksRequestParams>({
query: ({ page, pageSize, order, orderBy }) => {
const params = new URLSearchParams();
if (page) {
params.append(WebhookFilterQueryParamNames.PAGE, `${page}`);
}
if (pageSize) {
params.append(WebhookFilterQueryParamNames.PAGE_SIZE, `${pageSize}`);
}
if (order) {
params.append(WebhookFilterQueryParamNames.ORDER, `${order}`);
}
if (orderBy) {
params.append(WebhookFilterQueryParamNames.ORDER_BY, `${orderBy}`);
}
return { url: `webhooks?${params.toString()}` };
},
providesTags: (result, error) => {
if (!error && result?.data.content) {
return [
{ type: ApiTags.Webhooks, id: TAG_LIST_ID },
...result.data.content.map(({ id }) => ({ type: ApiTags.Webhooks, id }))
];
}
return [];
}
}),
createWebhook: build.mutation<WebhookSingleResponse, CreateWebhookRequest>({
query: (body) => ({ url: 'webhooks', method: 'POST', body }),
invalidatesTags
}),
deleteWebhook: build.mutation<void, { id: string }>({
query: ({ id }) => ({ url: `webhooks/${id}`, method: 'DELETE' }),
invalidatesTags
}),
modifyLabelWebhook: build.mutation<WebhookSingleResponse, { id: string; body: ModifyWebhookLabelRequest }>({
query: ({ id, body }) => ({ url: `webhooks/${id}/label`, method: 'PATCH', body }),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Webhooks, id: arg.id }];
}
}),
modifyIgnoreHostWebhook: build.mutation<
WebhookSingleResponse,
{ id: string; body: ModifyWebhookIgnoreHostRequest }
>({
query: ({ id, body }) => ({ url: `webhooks/${id}/ignore-host`, method: 'PATCH', body }),
invalidatesTags: (result, error, arg) => {
if (error) {
return [];
}
return [{ type: ApiTags.Webhooks, id: arg.id }];
}
})
};
}
});
export const {
useGetWebhooksQuery,
useDeleteWebhookMutation,
useCreateWebhookMutation,
useModifyLabelWebhookMutation,
useModifyIgnoreHostWebhookMutation
} = webhooksApi;

View file

@ -0,0 +1,8 @@
enum ActionFilterQueryParamNames {
PAGE = 'page',
PAGE_SIZE = 'pageSize',
ORDER = 'order',
ORDER_BY = 'orderBy'
}
export default ActionFilterQueryParamNames;

View file

@ -0,0 +1,8 @@
enum ActionInvocationFilterQueryParamNames {
PAGE = 'page',
PAGE_SIZE = 'pageSize',
ORDER = 'order',
ORDER_BY = 'orderBy'
}
export default ActionInvocationFilterQueryParamNames;

View file

@ -0,0 +1,6 @@
enum ActionInvocationOrder {
DESC = 'desc',
ASC = 'asc'
}
export default ActionInvocationOrder;

View file

@ -0,0 +1,9 @@
enum ActionInvocationOrderBy {
ID = 'id',
STATE = 'state',
RETRY_COUNT = 'retry_count',
CREATED_AT = 'created_at',
UPDATED_AT = 'updated_at'
}
export default ActionInvocationOrderBy;

View file

@ -0,0 +1,6 @@
enum ActionOrder {
DESC = 'desc',
ASC = 'asc'
}
export default ActionOrder;

View file

@ -0,0 +1,9 @@
enum ActionOrderBy {
ID = 'id',
LABEL = 'label',
TYPE = 'type',
CREATED_AT = 'created_at',
UPDATED_AT = 'updated_at'
}
export default ActionOrderBy;

View file

@ -0,0 +1,8 @@
enum EventFilterQueryParamNames {
SIZE = 'size',
SKIP = 'skip',
ORDER = 'order',
ORDER_BY = 'orderBy'
}
export default EventFilterQueryParamNames;

View file

@ -0,0 +1,6 @@
enum EventOrder {
DESC = 'desc',
ASC = 'asc'
}
export default EventOrder;

View file

@ -0,0 +1,8 @@
enum EventOrderBy {
ID = 'id',
NAME = 'name',
CREATED_AT = 'created_at',
UPDATED_AT = 'updated_at'
}
export default EventOrderBy;

View file

@ -0,0 +1,11 @@
enum UpdateFilterQueryParamNames {
PAGE = 'page',
PAGE_SIZE = 'pageSize',
ORDER = 'order',
ORDER_BY = 'orderBy',
STATE = 'state',
SEARCH_TERM = 'searchTerm',
SEARCH_IN = 'searchIn'
}
export default UpdateFilterQueryParamNames;

View file

@ -0,0 +1,6 @@
enum UpdateOrder {
DESC = 'desc',
ASC = 'asc'
}
export default UpdateOrder;

View file

@ -0,0 +1,10 @@
enum UpdateOrderBy {
ID = 'id',
CREATED_AT = 'created_at',
UPDATED_AT = 'updated_at',
APPLICATION = 'application',
PROVIDER = 'provider',
HOST = 'host'
}
export default UpdateOrderBy;

View file

@ -0,0 +1,7 @@
enum UpdateSearchIn {
APPLICATION = 'application',
PROVIDER = 'provider',
HOST = 'host'
}
export default UpdateSearchIn;

View file

@ -0,0 +1,8 @@
enum WebhookFilterQueryParamNames {
PAGE = 'page',
PAGE_SIZE = 'pageSize',
ORDER = 'order',
ORDER_BY = 'orderBy'
}
export default WebhookFilterQueryParamNames;

View file

@ -0,0 +1,6 @@
enum WebhookOrder {
DESC = 'desc',
ASC = 'asc'
}
export default WebhookOrder;

View file

@ -0,0 +1,9 @@
enum WebhookOrderBy {
ID = 'id',
CREATED_AT = 'created_at',
UPDATED_AT = 'updated_at',
LABEL = 'label',
TYPE = 'type'
}
export default WebhookOrderBy;

View file

@ -0,0 +1,7 @@
enum ApiErrorCodes {
NOT_FOUND = 'NotFound',
FORBIDDEN = 'Forbidden',
CONFLICT = 'Conflict',
ILLEGAL_ARGUMENT = 'IllegalArgument'
}
export default ApiErrorCodes;

View file

@ -0,0 +1,11 @@
enum ApiTags {
Health = 'Health',
Info = 'Info',
Updates = 'Updates',
Webhooks = 'Webhooks',
Secrets = 'Secrets',
Actions = 'Actions',
ActionInvocations = 'ActionInvocations',
Events = 'Events'
}
export default ApiTags;

View file

@ -0,0 +1,5 @@
enum AppPathParamNames {
UPDATE_ID = 'id'
}
export default AppPathParamNames;

View file

@ -0,0 +1,12 @@
enum AppPaths {
HOME = '',
LOGIN = 'login',
UPDATES = 'updates',
WEBHOOKS = 'webhooks',
SECRETS = 'secrets',
ACTIONS = 'actions',
ACTION_INVOCATIONS = 'action-invocations',
EVENTS = 'events'
}
export default AppPaths;

View file

@ -0,0 +1,7 @@
enum HttpStatusCode {
STATUS_400 = 400,
STATUS_401 = 401,
STATUS_403 = 403,
STATUS_404 = 404
}
export default HttpStatusCode;

View file

@ -0,0 +1 @@
export const STORE = 'persisted_store';

View file

@ -0,0 +1,5 @@
export const PAGE_SIZE_DEFAULT = 15;
export const PAGE_DEFAULT = 1;
export const PAGE_DEFAULT_OPTIONS = ['5', '10', '15', '25', '50', '100', '200', '500'];
export const SIZE_DEFAULT = 15;
export const SKIP_DEFAULT = 0;

View file

@ -0,0 +1,29 @@
declare global {
interface Window {
runtime_config: Configuration;
}
}
interface Configuration {
VITE_API_URL: string;
VITE_APP_TITLE: string;
}
/**
* Derive configuration values depending on environment:
* - load from process.env in case of development
* - load from window object otherwise
*
* development check must be fully written as isDevelopment uses configuration itself
*/
const getConfiguration = (): Configuration => {
if (window && window.runtime_config && Object.keys(window.runtime_config).length > 0) {
return window.runtime_config;
} else if (import.meta.env.DEV) {
return import.meta.env as unknown as Configuration;
}
throw new Error('Cannot bootstrap configuration from window or environment');
};
export default getConfiguration;

View file

@ -0,0 +1,34 @@
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
import en from './translations/en.json';
const resources = {
en: {
...en
}
};
i18next
.use(initReactI18next)
.use(LanguageDetector)
.init(
{
resources,
lng: 'en',
fallbackLng: 'en',
debug: import.meta.env.DEV,
interpolation: {
escapeValue: false // not needed for react as it escapes by default
},
defaultNS: 'common',
fallbackNS: 'common',
detection: {
order: ['navigator']
}
},
undefined
);
export default i18next;

View file

@ -0,0 +1,464 @@
{
"version": {
"version": "Version",
"number": "4.0.0"
},
"common": {
"404_title": "Not found.",
"404": "The page you've requested doesn't exist.",
"back_home": "Go back",
"home": "Home",
"login": "Login",
"updates": "Updates",
"webhooks": "Webhooks",
"actions": "Actions",
"action_invocations": "Action History",
"secrets": "Secrets",
"events": "Events",
"logout": "Logout"
},
"auth": {
"loading": "Loading..."
},
"health": {
"reload": "Reload",
"generic_error_title": "Services unhealthy",
"generic_error_content": "Health check failed, please try again later."
},
"login": {
"title": "Login",
"username": "Username",
"password": "Password",
"username_required": "Username is required",
"password_required": "Password is required",
"submit": "Submit",
"reset": "Reset",
"unauthorized": "Username or password are incorrect.",
"default_message": "Error while logging in."
},
"update": {
"handle_pending": "Recently updated",
"created_at": "Created on {{created}}",
"created_at_diff": "Updated on {{updated}}, but initially submitted on {{created}}",
"help_approve": "Approve",
"help_ignore": "Ignore",
"help_pending": "Reset to pending",
"help_details": "Show details",
"help_delete": "Delete",
"version": "Version",
"provider": "Provider",
"host": "Host",
"metadata": "Metadata",
"state": "State",
"created": "Created",
"updated": "Updated",
"delete_title": "Are you sure to delete? Cannot be undone.",
"delete": "Delete",
"cancel": "Cancel",
"error_default_delete": "Unable to delete update. Please make sure your device has network connection.",
"error_default_modify_state": "Unable to modify update. Please make sure your device has network connection.",
"error_unable_delete": "Resource cannot be found. Unable to delete update. Please refresh the page.",
"error_unable_modify_state": "Resource cannot be found. Unable to modify update. Please refresh the page.",
"error_unauthorized_delete": "Unable to delete update. Please refresh this page.",
"error_unauthorized_modify_state": "Unable to modify update. Please refresh this page.",
"error_forbidden_delete": "Forbidden to delete update.",
"error_forbidden_modify_state": "Forbidden to modify update."
},
"update_state_tag": {
"state_pending": "Pending",
"state_ignored": "Ignored",
"state_approved": "Approved"
},
"updates_single": {
"default_loading_error_message": "Unable to load update. Please make sure your device has network connection.",
"no_update": "No update found.",
"title_parent": "Updates",
"title": "Update Details",
"state": "State",
"application": "Application",
"version": "Version",
"host": "Host",
"provider": "Provider",
"metadata": "Metadata",
"created": "Created",
"updated": "Updated"
},
"updates": {
"title": "Updates",
"help": "<b>Updates</b> track information about externally reported data regarding an application, host, provider and a version attribute. You can manage an <b>Update</b>'s status by transitioning it through different states like pending or ignored. On arrival of new information through <b>Webhooks</b>, an <b>Update</b> changes its version property or attached metadata attribute and creates an <b>Event</b>. In case identical information is submitted, an <b>Event</b> is still produced. When an <b>Update</b>'s state is not pending, such a modification resets the update's state to pending again. If an <b>Update</b> is set to be ignored, no information is updated.",
"auto_refresh": "Auto Refresh",
"on": "On",
"off": "Off",
"reload_tooltip": "Reload all updates",
"reload": "Reload",
"no_updates": "No updates found.",
"error_default_loading": "Unable to load updates. Please make sure your device has network connection."
},
"updates_filters": {
"filters": "Filters",
"state": "State",
"state_placeholder": "Select state(s)",
"state_pending": "Pending",
"state_ignored": "Ignored",
"state_approved": "Approved",
"order_by": "Order by",
"order_by_id": "ID",
"order_by_created_at": "Created",
"order_by_updated_at": "Updated",
"order_by_application": "Application",
"order_by_provider": "Provider",
"order_by_host": "Host",
"order_asc": "Ascending",
"order_desc": "Descending",
"search_term": "Search",
"search_term_placeholder": "What are you looking for?",
"search_in": "Search in",
"search_in_application": "Application",
"search_in_provider": "Provider",
"search_in_host": "Host"
},
"webhook": {
"created_at": "Created on {{created}}",
"created_at_diff": "Updated on {{updated}}, but initially submitted on {{created}}",
"delete_title": "Are you sure to delete? Cannot be undone.",
"delete": "Delete",
"cancel": "Cancel",
"url": "URL",
"label": "Label",
"help_delete": "Delete",
"ignore_host": "Ignore host",
"type": "Type",
"type_generic": "Generic",
"type_diun": "Diun",
"created": "Created",
"updated": "Updated",
"error_default_delete": "Unable to delete webhook. Please make sure your device has network connection.",
"error_default_update_label": "Unable to update webhook label. Please make sure your device has network connection.",
"error_default_update_ignore_host": "Unable to update webhook ignore host. Please make sure your device has network connection.",
"error_unable_delete": "Resource cannot be found. Unable to delete webhook. Please refresh the page.",
"error_unable_update_label": "Resource cannot be found. Unable to update webhook label. Please refresh this page.",
"error_unable_update_ignore_host": "Resource cannot be found. Unable to update webhook ignore host. Please refresh this page.",
"error_forbidden_delete": "Forbidden to delete webhook.",
"error_forbidden_update_label": "Forbidden to update label.",
"error_forbidden_update_ignore_host": "Forbidden to update ignore host.",
"error_unauthorized_delete": "Unable to delete webhook. Please refresh this page.",
"error_unauthorized_update_label": "Unable to update webhook label. Please refresh this page.",
"error_unauthorized_update_ignore_host": "Unable to update webhook ignore host. Please refresh this page."
},
"webhooks": {
"title": "Webhooks",
"help": "<b>Webhooks</b> allow to submit new or modify existing <b>Updates</b> from an external source such as a commandline tool or another application with the help of a unique URL. On submission of new information via <b>Webhook</b>, <i>upda</i> keeps track of changes. By creating multiple <b>Webhooks</b>, you can submit information from separate applications into <i>upda</i>.",
"auto_refresh": "Auto Refresh",
"on": "On",
"off": "Off",
"no_webhooks": "No webhooks yet. Create one?",
"reload_tooltip": "Reload all webhooks",
"error_default_loading": "Unable to load webhooks. Please make sure your device has network connection."
},
"webhooks_filters": {
"order_by": "Order by",
"order_by_id": "ID",
"order_by_created_at": "Created",
"order_by_updated_at": "Updated",
"order_by_label": "Label",
"order_by_type": "Type",
"order_asc": "Ascending",
"order_desc": "Descending"
},
"webhook_create": {
"create": "Create new webhook",
"label": "Label",
"label_placeholder": "A label",
"type": "Type",
"type_generic": "Generic",
"type_diun": "Diun",
"ignore_host": "Ignore host",
"label_required": "Label is required",
"label_size": "Label must be at least 1 and at most 255 characters long",
"submit": "Submit",
"created_title": "Webhook created",
"created_message": "Webhook is ready to use. Write down the token, you'll not see it again:<br/><br/>{{token}}",
"error_unable": "Unable to create webhook. Please refresh this page.",
"error_unauthorized": "Unable to create webhook. Please refresh this page.",
"error_forbidden": "Forbidden to create webhook.",
"error_bad_request": "Invalid input. Unable to create webhook.",
"error_default": "Unable to create webhook. Please make sure your device has network connection."
},
"secrets": {
"title": "Secrets",
"help": "<b>Secrets</b> protect sensitive information. They can be used when managing <b>Actions</b> and are automatically injected when defined <b>Actions</b> are executed.",
"no_secrets": "No secrets yet. Create one?",
"reload_tooltip": "Reload all secrets",
"error_default_loading": "Unable to load secrets. Please make sure your device has network connection.",
"col_key": "Key",
"col_value": "Value",
"col_created_at": "Created",
"col_updated_at": "Updated",
"actions": "Actions"
},
"secret_create": {
"create": "Create new secret",
"key": "Key",
"key_placeholder": "Unique identifier",
"key_required": "Key is required",
"key_size": "Key must be at least 1 and at most 255 characters long",
"value": "Value",
"value_placeholder": "A secret value",
"value_required": "Value is required",
"value_size": "Value must be at least 1 character long",
"submit": "Submit",
"created_title": "Secret created or updated",
"created_message": "Secret is ready to use. Remember its value, you'll not see it again:<br/><br/>{{value}}",
"error_unable": "Unable to create secret. Please refresh this page.",
"error_unauthorized": "Unable to create secret. Please refresh this page.",
"error_forbidden": "Forbidden to create secret.",
"error_bad_request": "Invalid input. Unable to create secret.",
"error_default": "Unable to create secret. Please make sure your device has network connection."
},
"secret_update_value": {
"placeholder": "***REDACTED***",
"error_default_update_value": "Unable to update secret value. Please make sure your device has network connection.",
"error_unable_update_value": "Resource cannot be found. Unable to update secret value. Please refresh this page.",
"error_forbidden_update_value": "Forbidden to update value.",
"error_unauthorized_update_value": "Unable to update secret value. Please refresh this page."
},
"secret_delete": {
"delete_title": "Are you sure to delete? Cannot be undone.",
"delete": "Delete",
"cancel": "Cancel",
"help_delete": "Delete",
"error_default_delete": "Unable to delete secret. Please make sure your device has network connection.",
"error_unable_delete": "Resource cannot be found. Unable to delete secret. Please refresh the page.",
"error_forbidden_delete": "Forbidden to delete secret.",
"error_unauthorized_delete": "Unable to delete secret. Please refresh this page."
},
"action_invocations": {
"title": "Action History",
"help": "Shows enqueued (created), running and past invocations of <b>Actions</b>.",
"auto_refresh": "Auto Refresh",
"on": "On",
"off": "Off",
"no_action_invocations": "No action history yet.",
"reload_tooltip": "Reload action history",
"error_default_loading": "Unable to load action history. Please make sure your device has network connection.",
"col_state": "State",
"col_retry_count": "Attempt(s)",
"col_created_at": "Created",
"col_updated_at": "Updated",
"state_success": "Success",
"state_error": "Error",
"state_created": "Created",
"state_retrying": "Retrying",
"state_running": "Running",
"state_success_description": "This action has run successfully.",
"state_error_description": "This action produced an error. It won't be retried again.",
"state_created_description": "This action has been enqueued and is going to be processed in order.",
"state_running_description": "This action is currently running.",
"state_retrying_description": "This action failed previously, but is going to be retried until maximum attempts are exceeded."
},
"action_invocation_delete": {
"delete_title": "Are you sure to delete? Cannot be undone.",
"delete": "Delete",
"cancel": "Cancel",
"help_delete": "Delete",
"error_default_delete": "Unable to delete action history item. Please make sure your device has network connection.",
"error_unable_delete": "Resource cannot be found. Unable to delete action history item. Please refresh the page.",
"error_forbidden_delete": "Forbidden to delete action history item.",
"error_unauthorized_delete": "Unable to delete action history item. Please refresh this page."
},
"action_invocation_item": {
"message": "Message",
"action": "Action",
"label": "Label",
"type": "Type",
"event": "Event",
"name": "Name",
"error_default_loading_action": "Cannot load referenced action",
"error_default_loading_event": "Cannot load referenced event",
"reload_tooltip": "Reload",
"reload_text": "Try again"
},
"actions": {
"title": "Actions",
"help": "<b>Actions</b> are used to take action, e.g., call an external tool when an <b>Event</b> occurs. It can also be as simple as sending a notification to a service.",
"auto_refresh": "Auto Refresh",
"on": "On",
"off": "Off",
"no_actions": "No actions yet. Create one?",
"reload_tooltip": "Reload all actions",
"error_default_loading": "Unable to load actions. Please make sure your device has network connection.",
"col_label": "Label",
"col_enabled": "Enabled",
"col_type": "Type",
"col_created_at": "Created",
"col_updated_at": "Updated"
},
"action_item": {
"match_event": "Event",
"match_application": "Application",
"match_host": "Host",
"match_provider": "Provider",
"payload": "Configuration"
},
"action_create": {
"all": "all",
"create": "Create new action",
"label": "Label",
"label_help": "A label for you to identify",
"label_placeholder": "A label",
"label_required": "Label is required",
"label_size": "Label must be at least 1 and at most 255 characters long",
"match_event": "Event",
"match_event_help": "The action is triggered, when the event matches. If left blank, any event runs the action.",
"match_application": "Application",
"match_application_help": "The action is triggered, when the application matches. If left blank, any application runs the action.",
"match_provider": "Provider",
"match_provider_help": "The action is triggered, when the provider matches. If left blank, any provider runs the action.",
"match_host": "Host",
"match_host_help": "The action is triggered, when the host matches. If left blank, any host runs the action.",
"enabled_label": "Enabled",
"enabled_help": "Disabled actions won't run, even for new incoming events. This mechanism allows you can to configure and test an action before putting it live.",
"yes": "Yes",
"no": "No",
"submit": "Submit",
"error_unable": "Unable to create action. Please refresh this page.",
"error_unauthorized": "Unable to create action. Please refresh this page.",
"error_forbidden": "Forbidden to create action.",
"error_bad_request": "Invalid input. Unable to create action.",
"error_default": "Unable to create action. Please make sure your device has network connection."
},
"action_form_type": {
"type_label": "Type",
"type_help": "Changing the action's type also changes the required configuration",
"shoutrrr": "shoutrrr"
},
"action_form_shoutrrrr": {
"url": "URL",
"url_help": "shoutrrr URL according to https://containrrr.dev/shoutrrr/latest/services/overview/",
"urls_placeholder": "shoutrrr URL",
"urls_validate_minimum": "At least one URL is required",
"urls_validate_not_blank": "Provide an URL or delete this URL field",
"urls_new": "New URL",
"type_label": "Type",
"body_label": "Body",
"body_help": "Define the message which is being delivered. You can use the <VAR>...</VAR> and <SECRET>...</SECRET> syntax to inject dynamic content.",
"body_placeholder": "Update arrived on <VAR>HOST</VAR>.",
"body_required": "Body is required",
"body_size": "Body must be at least one character long"
},
"action_update_match_event": {
"error_default_update_value": "Unable to update match event. Please make sure your device has network connection.",
"error_unable_update_value": "Resource cannot be found. Unable to update match event. Please refresh this page.",
"error_forbidden_update_value": "Forbidden to update match event.",
"error_unauthorized_update_value": "Unable to update match event. Please refresh this page."
},
"action_select_event": {
"all": "all",
"update_created": "Update created",
"update_updated": "Update changed",
"update_updated_state": "Update's state changed",
"update_updated_version": "Update's version changed",
"update_deleted": "Update deleted"
},
"action_update_label": {
"error_default_update_value": "Unable to update label. Please make sure your device has network connection.",
"error_unable_update_value": "Resource cannot be found. Unable to update label. Please refresh this page.",
"error_forbidden_update_value": "Forbidden to update label.",
"error_unauthorized_update_value": "Unable to update label. Please refresh this page."
},
"action_update_enabled": {
"error_default_update_value": "Unable to update enabled flag. Please make sure your device has network connection.",
"error_unable_update_value": "Resource cannot be found. Unable to update enabled flag. Please refresh this page.",
"error_forbidden_update_value": "Forbidden to update enabled flag.",
"error_unauthorized_update_value": "Unable to update enabled flag. Please refresh this page."
},
"action_update_match_application": {
"all": "all match",
"error_default_update_value": "Unable to update match application. Please make sure your device has network connection.",
"error_unable_update_value": "Resource cannot be found. Unable to update match application. Please refresh this page.",
"error_forbidden_update_value": "Forbidden to update match application.",
"error_unauthorized_update_value": "Unable to update match application. Please refresh this page."
},
"action_update_match_host": {
"all": "all match",
"error_default_update_value": "Unable to update match host. Please make sure your device has network connection.",
"error_unable_update_value": "Resource cannot be found. Unable to update match host. Please refresh this page.",
"error_forbidden_update_value": "Forbidden to update match host.",
"error_unauthorized_update_value": "Unable to update match host. Please refresh this page."
},
"action_update_match_provider": {
"all": "all match",
"error_default_update_value": "Unable to update match provider. Please make sure your device has network connection.",
"error_unable_update_value": "Resource cannot be found. Unable to update match provider. Please refresh this page.",
"error_forbidden_update_value": "Forbidden to update match provider.",
"error_unauthorized_update_value": "Unable to update match provider. Please refresh this page."
},
"action_update_payload": {
"update_type_and_payload": "Advanced configuration",
"submit": "Save",
"error_default_update_value": "Unable to update advanced configuration. Please make sure your device has network connection.",
"error_unable_update_value": "Resource cannot be found. Unable to update advanced configuration. Please refresh this page.",
"error_forbidden_update_value": "Forbidden to update value.",
"error_unauthorized_update_value": "Unable to update advanced configuration. Please refresh this page."
},
"action_delete": {
"delete_title": "Are you sure to delete? Cannot be undone.",
"delete": "Delete",
"cancel": "Cancel",
"help_delete": "Delete",
"error_default_delete": "Unable to delete action. Please make sure your device has network connection.",
"error_unable_delete": "Resource cannot be found. Unable to delete action. Please refresh the page.",
"error_forbidden_delete": "Forbidden to delete action.",
"error_unauthorized_delete": "Unable to delete action. Please refresh this page."
},
"action_test": {
"test": "Test",
"application": "Test Application",
"host": "Test Host",
"provider": "Test Provider",
"version": "Test Version",
"state": "Test State",
"tested_title_success": "Success",
"tested_message_success": "Action ran successfully.",
"tested_title_error": "Error",
"tested_message_error": "Action failed to run. Reason: {{reason}}",
"error_unable": "Unable to test action. Please refresh this page.",
"error_unauthorized": "Unable to test action. Please refresh this page.",
"error_forbidden": "Forbidden to test action.",
"error_bad_request": "Invalid input. Unable to test action.",
"error_default": "Unable to test action. Please make sure your device has network connection."
},
"action_text_type": {
"shoutrrr": "shoutrrr"
},
"events": {
"title": "Events",
"help": "Events represent the chronological order of what is going on in the system. You can see when and how an <b>Update</b> has changed.",
"auto_refresh": "Auto Refresh",
"on": "On",
"off": "Off",
"reload": "Reload",
"reload_tooltip": "Reload all updates",
"load_more": "Load more",
"no_events": "No events yet.",
"error_default_loading": "Unable to load events. Please make sure your device has network connection."
},
"event": {
"name": "Name",
"help_delete": "Delete",
"delete_title": "Are you sure to delete? Cannot be undone.",
"delete": "Delete",
"cancel": "Cancel",
"error_default_delete": "Unable to delete event. Please make sure your device has network connection.",
"error_unable_delete": "Resource cannot be found. Unable to delete event. Please refresh the page.",
"error_forbidden_delete": "Forbidden to delete event.",
"error_unauthorized_delete": "Unable to delete event. Please refresh this page."
},
"event_text": {
"update_created": "Update of application <b>{{application}}</b> on host <b>{{host}}</b> for provider <b>{{provider}}</b> with version <b>{{version}}</b> has been created.",
"update_updated": "Update of application <b>{{application}}</b> on host <b>{{host}}</b> for provider <b>{{provider}}</b> has been changed (version or metadata). Version: <b>{{version}}</b> (was <b>{{versionPrior}}</b>).",
"update_updated_state": "Update of application <b>{{application}}</b> on host <b>{{host}}</b> for provider <b>{{provider}}</b> changed its state to <b>{{state}}</b> (was <b>{{statePrior}}</b>).",
"update_updated_version": "Update of application <b>{{application}}</b> on host <b>{{host}}</b> for provider <b>{{provider}}</b> has been changed its version to <b>{{version}}</b> (was <b>{{versionPrior}}</b>).",
"update_deleted": "Update of application <b>{{application}}</b> on host <b>{{host}}</b> for provider <b>{{provider}}</b> with version <b>{{version}}</b> has been deleted."
}
}

22
server/web/src/index.tsx Normal file
View file

@ -0,0 +1,22 @@
import './i18n';
import App from './App';
import store from './store';
import ReactDOM from 'react-dom/client';
import { Provider } from 'react-redux';
import { HashRouter as Router } from 'react-router-dom';
import './style/app-theme.less';
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
<Provider store={store}>
{/* the waring below appears when using ant menu due to react strict mode.
* Using <Button> results in "findDOMNode is deprecated in StrictMode" warning
* Fix not yet available. follow thread: https://github.com/ant-design/ant-design/issues/22493 */}
{/*<React.StrictMode>*/}
<Router>
<App />
</Router>
{/*</React.StrictMode>*/}
</Provider>
);

View file

@ -0,0 +1,17 @@
import { Layout, Space, Typography } from 'antd';
import { useTranslation } from 'react-i18next';
const AppFooter = () => {
const [t] = useTranslation('version');
return (
<Layout.Footer style={{ textAlign: 'center' }}>
<Space>
<Typography.Text>&copy; {new Date().getFullYear()}</Typography.Text>
<Typography.Text>
{t('version')} {t('number')}
</Typography.Text>
</Space>
</Layout.Footer>
);
};
export default AppFooter;

View file

@ -0,0 +1,23 @@
import AppFooter from './AppFooter';
import HealthHandler from './HealthHandler';
import Menu from './Menu';
import { Layout } from 'antd';
import { FC } from 'react';
import { Outlet } from 'react-router-dom';
const AppLayout: FC = () => {
return (
<Layout style={{ minHeight: '100vh' }}>
<Menu />
<Layout>
<HealthHandler>
<Layout.Content style={{ margin: '24px 16px 0', overflow: 'initial' }}>
<Outlet />
</Layout.Content>
<AppFooter />
</HealthHandler>
</Layout>
</Layout>
);
};
export default AppLayout;

View file

@ -0,0 +1,64 @@
import classes from './style/HealthHandler.module.less';
import { useGetHealthQuery } from '../api/healthApi';
import { Modal, ModalFuncProps, Skeleton } from 'antd';
import { FC, ReactNode, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
const HealthHandler: FC<{ children: ReactNode | ReactNode[] }> = ({ children }): JSX.Element => {
const [t] = useTranslation('health');
const { isLoading, isSuccess, isError, data } = useGetHealthQuery(undefined);
const [showChildren, setShowChildren] = useState<boolean>(false);
const [showModal, setShowModal] = useState<boolean>(false);
const [modal, setModal] = useState<{ update: (config: ModalFuncProps) => void; destroy: () => void }>();
useEffect(() => {
if (!isLoading && isSuccess && data?.data.healthy) {
setShowChildren(true);
setShowModal(false);
} else if (!isLoading && (isError || (!isError && !data?.data.healthy))) {
setShowChildren(false);
setShowModal(true);
}
}, [isLoading, isSuccess, isError, data]);
useEffect(() => {
if (showModal) {
const title = <strong>{t('generic_error_title')}</strong>;
const content = t('generic_error_content');
const okText = t('reload');
if (modal) {
modal.update({ title, content });
} else {
const props: ModalFuncProps = {
title,
content,
okButtonProps: { className: classes.okBtnHidden },
okText,
onOk: () => {
window.location.reload();
}
};
const error = Modal.error(props);
setModal(error);
}
} else {
modal?.destroy();
}
}, [t, modal, showModal]);
if (isLoading) {
return <Skeleton loading={isLoading} active={isLoading} />;
} else {
if (showChildren) {
return <>{children}</>;
} else {
return <></>;
}
}
};
export default HealthHandler;

View file

@ -0,0 +1,17 @@
import PrimaryMenu from './PrimaryMenu';
import { Layout } from 'antd';
import { useTranslation } from 'react-i18next';
const { Header } = Layout;
const Menu = () => {
const [t] = useTranslation('common');
return (
<Header style={{ display: 'flex' }}>
<PrimaryMenu t={t} />
</Header>
);
};
export default Menu;

View file

@ -0,0 +1,107 @@
import classes from './style/PrimaryMenu.module.less';
import AppPaths from '../constants/appPaths';
import { useAuthenticatedSelector } from '../selectors/authSelectors';
import { useAuthorization } from '../use/useAuthorization';
import { getPageFullPath } from '../utils/urlHelper';
import {
BarsOutlined,
BuildOutlined,
ClockCircleOutlined,
LinkOutlined,
LockOutlined,
LogoutOutlined,
UnorderedListOutlined,
UserOutlined
} from '@ant-design/icons';
import { Menu, Typography } from 'antd';
import { TFunction } from 'i18next';
import { forEach } from 'lodash';
import { FC, useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
export type PrimaryMenuProps = {
t: TFunction;
};
const PrimaryMenu: FC<PrimaryMenuProps> = ({ t }): JSX.Element => {
const navigate = useNavigate();
const isAuthenticated = useAuthenticatedSelector();
const { logout, getUserName } = useAuthorization();
const username = getUserName();
const primaryNavs = useMemo(() => {
const staticItems = [
isAuthenticated && {
label: t('updates'),
key: AppPaths.UPDATES,
icon: <UnorderedListOutlined />,
onClick: () => navigate(getPageFullPath(AppPaths.UPDATES))
},
isAuthenticated && {
label: t('webhooks'),
key: AppPaths.WEBHOOKS,
icon: <LinkOutlined />,
onClick: () => navigate(getPageFullPath(AppPaths.WEBHOOKS))
},
isAuthenticated && {
label: t('actions'),
key: AppPaths.ACTIONS,
icon: <BuildOutlined />,
onClick: () => navigate(getPageFullPath(AppPaths.ACTIONS))
},
isAuthenticated && {
label: t('action_invocations'),
key: AppPaths.ACTION_INVOCATIONS,
icon: <BarsOutlined />,
onClick: () => navigate(getPageFullPath(AppPaths.ACTION_INVOCATIONS))
},
isAuthenticated && {
label: t('secrets'),
key: AppPaths.SECRETS,
icon: <LockOutlined />,
onClick: () => navigate(getPageFullPath(AppPaths.SECRETS))
},
isAuthenticated && {
label: t('events'),
key: AppPaths.EVENTS,
icon: <ClockCircleOutlined />,
onClick: () => navigate(getPageFullPath(AppPaths.EVENTS))
}
];
const items = [];
forEach(staticItems, (s) => {
items.push(s);
});
if (!isAuthenticated) {
items.push({
label: t('login'),
key: AppPaths.LOGIN,
icon: <UserOutlined />,
onClick: () => navigate(getPageFullPath(AppPaths.LOGIN))
});
} else {
items.push({
key: 'menu_logout',
icon: <LogoutOutlined />,
label: (
<Typography.Text strong ellipsis className={classes.username}>
{username}
</Typography.Text>
),
onClick: () => {
logout();
}
});
}
return items;
}, [isAuthenticated, t, navigate, username, logout]);
return (
<Menu theme="dark" selectable={false} mode="horizontal" items={primaryNavs} style={{ flex: 1, minWidth: 0 }} />
);
};
export default PrimaryMenu;

View file

@ -0,0 +1,3 @@
.okBtnHidden {
display: none;
}

View file

@ -0,0 +1,3 @@
.username {
color: white;
}

View file

@ -0,0 +1,3 @@
.centered {
justify-content: center;
}

Some files were not shown because too many files have changed in this diff Show more