Compare commits
No commits in common. "master" and "librepages" have entirely different histories.
master
...
librepages
54 changed files with 3880 additions and 5891 deletions
16
.gitignore
vendored
16
.gitignore
vendored
|
@ -1,16 +0,0 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
__pycache__/
|
||||
src/secrets/**
|
||||
dist/
|
||||
out/
|
||||
tmp/
|
||||
coverage/
|
1
.nvmrc
1
.nvmrc
|
@ -1 +0,0 @@
|
|||
18
|
10
.reuse/dep5
10
.reuse/dep5
|
@ -1,10 +0,0 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: forgejo-notifications-core
|
||||
Upstream-Contact: Aravinth Manivannan <realaravinth@batsense.net>
|
||||
Source:
|
||||
|
||||
# Sample paragraph, commented out:
|
||||
#
|
||||
# Files: src/*
|
||||
# Copyright: $YEAR $NAME <$CONTACT>
|
||||
# License: ...
|
8
.swcrc
8
.swcrc
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
steps:
|
||||
setup_forgeo:
|
||||
image: python
|
||||
commands:
|
||||
- pip install requests
|
||||
- make env.config
|
||||
|
||||
build:
|
||||
image: node:18
|
||||
commands:
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@latest-8 --activate
|
||||
- pnpm install
|
||||
- pnpm run lint
|
||||
- pnpm run test
|
||||
- pnpm run build
|
||||
- pnpm run doc
|
||||
|
||||
deploy_docs:
|
||||
image: python
|
||||
when:
|
||||
event: [push, pull_request, tag, deployment]
|
||||
commands:
|
||||
- make ci-deploy
|
||||
secrets: [GITEA_WRITE_DEPLOY_KEY, LIBREPAGES_DEPLOY_SECRET]
|
||||
|
||||
services:
|
||||
forgejo:
|
||||
image: codeberg.org/forgejo/forgejo:1.20.1-0
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
|
@ -1,235 +0,0 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
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 Affero 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
|
||||
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 AGPL, see <http://www.gnu.org/licenses/>.
|
28
Makefile
28
Makefile
|
@ -1,28 +0,0 @@
|
|||
env.up:
|
||||
docker-compose -f ./docker-compose-dev-deps.yml up -d
|
||||
|
||||
env.down:
|
||||
docker-compose -f ./docker-compose-dev-deps.yml down --remove-orphans -v
|
||||
|
||||
env.config:
|
||||
./integration/tests.sh
|
||||
|
||||
test:
|
||||
./integration/tests.sh
|
||||
pnpm run test
|
||||
|
||||
ci-deploy: ## Deploy from CI/CD. Only call from within CI
|
||||
@if [ "${CI}" != "woodpecker" ]; \
|
||||
then echo "Only call from within CI. Will re-write your local Git configuration. To override, set export CI=woodpecker"; \
|
||||
exit 1; \
|
||||
fi
|
||||
git config --global user.email "${CI_COMMIT_AUTHOR_EMAIL}"
|
||||
git config --global user.name "${CI_COMMIT_AUTHOR}"
|
||||
mv coverage docs/ || true
|
||||
./scripts/ci.sh --init "$$GITEA_WRITE_DEPLOY_KEY"
|
||||
./scripts/ci.sh --deploy librepages docs/ "${CI_COMMIT_AUTHOR} <${CI_COMMIT_AUTHOR_EMAIL}>"
|
||||
./scripts/ci.sh --push ${LIBREPAGES_DEPLOY_SECRET} librepages
|
||||
./scripts/ci.sh --clean
|
||||
|
||||
help: ## Prints help for targets with comments
|
||||
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
53
README.md
53
README.md
|
@ -1,53 +0,0 @@
|
|||
[![status-badge](https://ci.batsense.net/api/badges/85/status.svg)](https://ci.batsense.net/repos/85)
|
||||
|
||||
---
|
||||
|
||||
1. Docs: https://forgejo-notifications-core.docs.forgeflux.org/
|
||||
2. Code coverage: https://forgejo-notifications-core.docs.forgeflux.org/coverage/lcov-report/index
|
||||
|
||||
## Dev Notes
|
||||
|
||||
Requires your Forgejo instance admin to enable CORS for at least the
|
||||
origin which serves the notification panel. Please see
|
||||
[here](https://forgejo.org/docs/latest/admin/config-cheat-sheet/#cors-cors)
|
||||
for more information.
|
||||
|
||||
NOTE: The test [forgejo configuration](./integration/conf/app.ini) may
|
||||
be insecure for your usecase since it allows CORS for all origins with
|
||||
the widest possible surface.
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
pnpm run build
|
||||
```
|
||||
|
||||
Compiled library will be available at `./dist/index.js`
|
||||
|
||||
## Docs
|
||||
|
||||
https://forgejo-notifications-core.docs.forgeflux.org
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
pnpm run doc
|
||||
firefox ./docs/index.html
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
There are [scripts][./integration] to setup a Forgejo instance locally,
|
||||
create [bunch of]./integration/lib.sh) of users, repository and issues
|
||||
to test all functionality offered by this library. It might be useful to
|
||||
recreate this environment with `make env.up and ./integration/tests.sh`
|
||||
for development.
|
||||
|
||||
Uses Docker.
|
||||
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
make env.up
|
||||
make test
|
||||
```
|
43
assets/highlight.css
Normal file
43
assets/highlight.css
Normal file
|
@ -0,0 +1,43 @@
|
|||
:root {
|
||||
--light-hl-0: #795E26;
|
||||
--dark-hl-0: #DCDCAA;
|
||||
--light-hl-1: #000000;
|
||||
--dark-hl-1: #D4D4D4;
|
||||
--light-hl-2: #A31515;
|
||||
--dark-hl-2: #CE9178;
|
||||
--light-code-background: #FFFFFF;
|
||||
--dark-code-background: #1E1E1E;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) { :root {
|
||||
--hl-0: var(--light-hl-0);
|
||||
--hl-1: var(--light-hl-1);
|
||||
--hl-2: var(--light-hl-2);
|
||||
--code-background: var(--light-code-background);
|
||||
} }
|
||||
|
||||
@media (prefers-color-scheme: dark) { :root {
|
||||
--hl-0: var(--dark-hl-0);
|
||||
--hl-1: var(--dark-hl-1);
|
||||
--hl-2: var(--dark-hl-2);
|
||||
--code-background: var(--dark-code-background);
|
||||
} }
|
||||
|
||||
:root[data-theme='light'] {
|
||||
--hl-0: var(--light-hl-0);
|
||||
--hl-1: var(--light-hl-1);
|
||||
--hl-2: var(--light-hl-2);
|
||||
--code-background: var(--light-code-background);
|
||||
}
|
||||
|
||||
:root[data-theme='dark'] {
|
||||
--hl-0: var(--dark-hl-0);
|
||||
--hl-1: var(--dark-hl-1);
|
||||
--hl-2: var(--dark-hl-2);
|
||||
--code-background: var(--dark-code-background);
|
||||
}
|
||||
|
||||
.hl-0 { color: var(--hl-0); }
|
||||
.hl-1 { color: var(--hl-1); }
|
||||
.hl-2 { color: var(--hl-2); }
|
||||
pre, code { background: var(--code-background); }
|
59
assets/main.js
Normal file
59
assets/main.js
Normal file
File diff suppressed because one or more lines are too long
1
assets/navigation.js
Normal file
1
assets/navigation.js
Normal file
|
@ -0,0 +1 @@
|
|||
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA4uuVipJrShRslJKSU1LLM0pUdJRKkgsyQAKJOckFhenFutDJfQySnJzgLLZmXkpSlaGRha1sQAM4TeJPQAAAA=="
|
1
assets/search.js
Normal file
1
assets/search.js
Normal file
|
@ -0,0 +1 @@
|
|||
window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA61YTW/iMBD9L95rljKGhI/bqtJqe9g9VO1eEKoiMCUqSVCc7Bfiv+84hNiGcRIiLlVt3psZz5txJjmwLP0t2XxxYB9RsmZz4FOPJWEs2JytxSYsdjnzWJHtcL3ahVIK+VDtD7Z5vMMfq20EsKN3tuMDr+2s0kTmWbHK06zR1icbaNj12D7MRJIbQWlXMOTj2pey3ujjBOhnW4qs/LfZgUb18pKnHyJpdnGG9LK/SjPZJkOJ6GqdD8e6ZqTIX1R0X4p82+zlAtnL23tnb+939vZNhGvRUs4kvqvnwPdHQe367S3/u28pvGt3g+utzzCobTWGQnCJLVeRKUSaRf/CPEpbivm2sAeXlu9wiHNG3LK/tt0qNaZvYb3KDtVUgfo25mNr52tQ33P8SPNoE61KdVqcEejeXov4NclQzBvdu2j3OP3LVlm+KQU1pZd/5OTPyH+J2h5RF8he3ja49R2RKmNPyZOURYtTmtDLdxxmH2benlsT7WDczfvXNHsW+/T2IDSxb811SL2B6uvlMY1jxEqMt5tDgtDie+kxdC3+sPmB/RKZVPf7nPHBaDBD/CYSu7WaVNl5uDo5YMvqt59CzY0KcYI8DJm3GHp8MpjwYLn0FmdG+UO5UcIAV0DBwIJxXHEKxi3YCFcjCjayYGNcjSnY2IL5uPIpmG/BAlwFFCywYBNcTSjYxIJNcTWlYFMLhqIsZhRsZqdXZRtIHeBCiFIJWgpbC1A5B1INsOUAlXYgBQFbEVCZB1ITsEUBlXwgZQFbF1D5B1IZsKUBJQGQ4oCtDigVgNQHbIFACQGkRGBrxJUQnNSI2xpxJQQnNeIX/VI2DN0xJ43KfsdGz8X66dT32Lnn4fTA3qrLYHa+hg5shn+OR936aqUMh/ZMqLlYdzUZq41mW2+dBtegOplqVtIUX1N8B6V+p9YsI0ZXiOrZGVfPziiJTvepEerUiHXqsIF3crUlN5isSxucaxsokNPGNdFIFHdlComJPWMZ0Y+N6MfdDOTVpGRYCQwrQYOVIi7Kmc8djyEjuHRES+VbeFi+T2ryRHMnHajb6rVQGzCkbFCy/IphhGwWa4MGhbSdgSE6uERX06JKWF5OiwbZOCu4DqtmHjPTV7IZ7Q2u/qaMYA1n5eBkVKLRSdzVSlK1gd22+HzQMYzcPFJwo+xcVVd9rtEco+Bd9X4hsNmcLkb93UnTjIOR58IreB/txS5KELNYHo//ATdIPpoQFAAA";
|
1383
assets/style.css
Normal file
1383
assets/style.css
Normal file
File diff suppressed because it is too large
Load diff
380
classes/default.html
Normal file
380
classes/default.html
Normal file
File diff suppressed because one or more lines are too long
96
coverage/clover.xml
Normal file
96
coverage/clover.xml
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<coverage generated="1695140853600" clover="3.2.0">
|
||||
<project timestamp="1695140853600" name="All files">
|
||||
<metrics statements="84" coveredstatements="69" conditionals="16" coveredconditionals="10" methods="22" coveredmethods="19" elements="122" coveredelements="98" complexity="0" loc="84" ncloc="84" packages="1" files="2" classes="2"/>
|
||||
<file name="auth.ts" path="/woodpecker/src/git.batsense.net/realaravinth/forgejo-notifications-core/src/auth.ts">
|
||||
<metrics statements="3" coveredstatements="3" conditionals="0" coveredconditionals="0" methods="2" coveredmethods="2"/>
|
||||
<line num="8" count="1" type="stmt"/>
|
||||
<line num="12" count="22" type="stmt"/>
|
||||
<line num="16" count="1" type="stmt"/>
|
||||
</file>
|
||||
<file name="index.ts" path="/woodpecker/src/git.batsense.net/realaravinth/forgejo-notifications-core/src/index.ts">
|
||||
<metrics statements="81" coveredstatements="66" conditionals="16" coveredconditionals="10" methods="20" coveredmethods="17"/>
|
||||
<line num="5" count="1" type="stmt"/>
|
||||
<line num="23" count="1" type="stmt"/>
|
||||
<line num="24" count="1" type="stmt"/>
|
||||
<line num="32" count="1" type="stmt"/>
|
||||
<line num="33" count="1" type="stmt"/>
|
||||
<line num="34" count="1" type="stmt"/>
|
||||
<line num="41" count="22" type="cond" truecount="1" falsecount="1"/>
|
||||
<line num="42" count="22" type="stmt"/>
|
||||
<line num="44" count="0" type="stmt"/>
|
||||
<line num="52" count="21" type="stmt"/>
|
||||
<line num="56" count="20" type="cond" truecount="0" falsecount="1"/>
|
||||
<line num="57" count="0" type="stmt"/>
|
||||
<line num="58" count="0" type="stmt"/>
|
||||
<line num="59" count="0" type="stmt"/>
|
||||
<line num="61" count="20" type="stmt"/>
|
||||
<line num="68" count="2" type="stmt"/>
|
||||
<line num="69" count="2" type="stmt"/>
|
||||
<line num="74" count="2" type="stmt"/>
|
||||
<line num="78" count="0" type="stmt"/>
|
||||
<line num="85" count="3" type="stmt"/>
|
||||
<line num="86" count="3" type="stmt"/>
|
||||
<line num="87" count="3" type="stmt"/>
|
||||
<line num="93" count="3" type="stmt"/>
|
||||
<line num="99" count="1" type="stmt"/>
|
||||
<line num="100" count="1" type="stmt"/>
|
||||
<line num="106" count="1" type="stmt"/>
|
||||
<line num="107" count="1" type="stmt"/>
|
||||
<line num="115" count="1" type="stmt"/>
|
||||
<line num="116" count="1" type="stmt"/>
|
||||
<line num="121" count="1" type="stmt"/>
|
||||
<line num="128" count="5" type="stmt"/>
|
||||
<line num="135" count="5" type="stmt"/>
|
||||
<line num="137" count="5" type="stmt"/>
|
||||
<line num="138" count="12" type="stmt"/>
|
||||
<line num="141" count="5" type="stmt"/>
|
||||
<line num="143" count="5" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="144" count="5" type="stmt"/>
|
||||
<line num="145" count="5" type="stmt"/>
|
||||
<line num="148" count="5" type="stmt"/>
|
||||
<line num="149" count="2" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="150" count="2" type="stmt"/>
|
||||
<line num="151" count="2" type="stmt"/>
|
||||
<line num="153" count="0" type="cond" truecount="0" falsecount="1"/>
|
||||
<line num="154" count="0" type="cond" truecount="0" falsecount="1"/>
|
||||
<line num="155" count="0" type="stmt"/>
|
||||
<line num="156" count="0" type="stmt"/>
|
||||
<line num="161" count="5" type="stmt"/>
|
||||
<line num="162" count="5" type="stmt"/>
|
||||
<line num="163" count="12" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="164" count="5" type="stmt"/>
|
||||
<line num="165" count="5" type="stmt"/>
|
||||
<line num="168" count="5" type="stmt"/>
|
||||
<line num="176" count="0" type="stmt"/>
|
||||
<line num="177" count="0" type="stmt"/>
|
||||
<line num="186" count="0" type="stmt"/>
|
||||
<line num="187" count="0" type="stmt"/>
|
||||
<line num="197" count="7" type="stmt"/>
|
||||
<line num="198" count="7" type="stmt"/>
|
||||
<line num="203" count="7" type="stmt"/>
|
||||
<line num="205" count="7" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="206" count="7" type="stmt"/>
|
||||
<line num="209" count="7" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="210" count="7" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="211" count="7" type="stmt"/>
|
||||
<line num="215" count="7" type="cond" truecount="0" falsecount="1"/>
|
||||
<line num="216" count="0" type="cond" truecount="0" falsecount="1"/>
|
||||
<line num="217" count="0" type="stmt"/>
|
||||
<line num="221" count="7" type="stmt"/>
|
||||
<line num="230" count="6" type="stmt"/>
|
||||
<line num="231" count="6" type="stmt"/>
|
||||
<line num="236" count="6" type="stmt"/>
|
||||
<line num="238" count="6" type="stmt"/>
|
||||
<line num="239" count="4" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="240" count="4" type="stmt"/>
|
||||
<line num="243" count="4" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="244" count="4" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="245" count="4" type="stmt"/>
|
||||
<line num="248" count="4" type="stmt"/>
|
||||
<line num="251" count="6" type="stmt"/>
|
||||
<line num="253" count="6" type="stmt"/>
|
||||
<line num="257" count="1" type="stmt"/>
|
||||
</file>
|
||||
</project>
|
||||
</coverage>
|
3
coverage/coverage-final.json
Normal file
3
coverage/coverage-final.json
Normal file
File diff suppressed because one or more lines are too long
133
coverage/lcov-report/auth.ts.html
Normal file
133
coverage/lcov-report/auth.ts.html
Normal file
|
@ -0,0 +1,133 @@
|
|||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Code coverage report for auth.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1><a href="index.html">All files</a> auth.ts</h1>
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>4/4</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
<template id="filterTemplate">
|
||||
<div class="quiet">
|
||||
Filter:
|
||||
<input oninput="onInput()" type="search" id="fileSearch">
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
class Auth {
|
||||
token: string;
|
||||
constructor(token: string) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
getToken(): string {
|
||||
return this.token;
|
||||
}
|
||||
}
|
||||
|
||||
export default Auth;
|
||||
</pre></td></tr></table></pre>
|
||||
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-09-19T16:27:33.592Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
prettyPrint();
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
<script src="block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
224
coverage/lcov-report/base.css
Normal file
224
coverage/lcov-report/base.css
Normal file
|
@ -0,0 +1,224 @@
|
|||
body, html {
|
||||
margin:0; padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica, Arial;
|
||||
font-size: 14px;
|
||||
color:#333;
|
||||
}
|
||||
.small { font-size: 12px; }
|
||||
*, *:after, *:before {
|
||||
-webkit-box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
h1 { font-size: 20px; margin: 0;}
|
||||
h2 { font-size: 14px; }
|
||||
pre {
|
||||
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
a { color:#0074D9; text-decoration:none; }
|
||||
a:hover { text-decoration:underline; }
|
||||
.strong { font-weight: bold; }
|
||||
.space-top1 { padding: 10px 0 0 0; }
|
||||
.pad2y { padding: 20px 0; }
|
||||
.pad1y { padding: 10px 0; }
|
||||
.pad2x { padding: 0 20px; }
|
||||
.pad2 { padding: 20px; }
|
||||
.pad1 { padding: 10px; }
|
||||
.space-left2 { padding-left:55px; }
|
||||
.space-right2 { padding-right:20px; }
|
||||
.center { text-align:center; }
|
||||
.clearfix { display:block; }
|
||||
.clearfix:after {
|
||||
content:'';
|
||||
display:block;
|
||||
height:0;
|
||||
clear:both;
|
||||
visibility:hidden;
|
||||
}
|
||||
.fl { float: left; }
|
||||
@media only screen and (max-width:640px) {
|
||||
.col3 { width:100%; max-width:100%; }
|
||||
.hide-mobile { display:none!important; }
|
||||
}
|
||||
|
||||
.quiet {
|
||||
color: #7f7f7f;
|
||||
color: rgba(0,0,0,0.5);
|
||||
}
|
||||
.quiet a { opacity: 0.7; }
|
||||
|
||||
.fraction {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
background: #E8E8E8;
|
||||
padding: 4px 5px;
|
||||
border-radius: 3px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.path a:link, div.path a:visited { color: #333; }
|
||||
table.coverage {
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
text-align: right;
|
||||
padding: 0 5px 0 20px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
min-width:20px;
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 100%;
|
||||
}
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #333;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
.coverage-summary {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
||||
.keyline-all { border: 1px solid #ddd; }
|
||||
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
||||
.coverage-summary tbody { border: 1px solid #bbb; }
|
||||
.coverage-summary td { border-right: 1px solid #bbb; }
|
||||
.coverage-summary td:last-child { border-right: none; }
|
||||
.coverage-summary th {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.coverage-summary th.file { border-right: none !important; }
|
||||
.coverage-summary th.pct { }
|
||||
.coverage-summary th.pic,
|
||||
.coverage-summary th.abs,
|
||||
.coverage-summary td.pct,
|
||||
.coverage-summary td.abs { text-align: right; }
|
||||
.coverage-summary td.file { white-space: nowrap; }
|
||||
.coverage-summary td.pic { min-width: 120px !important; }
|
||||
.coverage-summary tfoot td { }
|
||||
|
||||
.coverage-summary .sorter {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
.coverage-summary .sorted .sorter {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
.coverage-summary .sorted-desc .sorter {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
.status-line { height: 10px; }
|
||||
/* yellow */
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
/* dark red */
|
||||
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
||||
.low .chart { border:1px solid #C21F39 }
|
||||
.highlighted,
|
||||
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
||||
background: #C21F39 !important;
|
||||
}
|
||||
/* medium red */
|
||||
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
||||
/* light red */
|
||||
.low, .cline-no { background:#FCE1E5 }
|
||||
/* light green */
|
||||
.high, .cline-yes { background:rgb(230,245,208) }
|
||||
/* medium green */
|
||||
.cstat-yes { background:rgb(161,215,106) }
|
||||
/* dark green */
|
||||
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
||||
.high .chart { border:1px solid rgb(77,146,33) }
|
||||
/* dark yellow (gold) */
|
||||
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
|
||||
.medium .chart { border:1px solid #f9cd0b; }
|
||||
/* light yellow */
|
||||
.medium { background: #fff4c2; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
span.cline-neutral { background: #eaeaea; }
|
||||
|
||||
.coverage-summary td.empty {
|
||||
opacity: .5;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
line-height: 1;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.cover-fill, .cover-empty {
|
||||
display:inline-block;
|
||||
height: 12px;
|
||||
}
|
||||
.chart {
|
||||
line-height: 0;
|
||||
}
|
||||
.cover-empty {
|
||||
background: white;
|
||||
}
|
||||
.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
.wrapper {
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%;
|
||||
margin: 0 auto -48px;
|
||||
}
|
||||
.footer, .push {
|
||||
height: 48px;
|
||||
}
|
87
coverage/lcov-report/block-navigation.js
Normal file
87
coverage/lcov-report/block-navigation.js
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* eslint-disable */
|
||||
var jumpToCode = (function init() {
|
||||
// Classes of code we would like to highlight in the file view
|
||||
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
|
||||
|
||||
// Elements to highlight in the file listing view
|
||||
var fileListingElements = ['td.pct.low'];
|
||||
|
||||
// We don't want to select elements that are direct descendants of another match
|
||||
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
|
||||
|
||||
// Selecter that finds elements on the page to which we can jump
|
||||
var selector =
|
||||
fileListingElements.join(', ') +
|
||||
', ' +
|
||||
notSelector +
|
||||
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
|
||||
|
||||
// The NodeList of matching elements
|
||||
var missingCoverageElements = document.querySelectorAll(selector);
|
||||
|
||||
var currentIndex;
|
||||
|
||||
function toggleClass(index) {
|
||||
missingCoverageElements
|
||||
.item(currentIndex)
|
||||
.classList.remove('highlighted');
|
||||
missingCoverageElements.item(index).classList.add('highlighted');
|
||||
}
|
||||
|
||||
function makeCurrent(index) {
|
||||
toggleClass(index);
|
||||
currentIndex = index;
|
||||
missingCoverageElements.item(index).scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
inline: 'center'
|
||||
});
|
||||
}
|
||||
|
||||
function goToPrevious() {
|
||||
var nextIndex = 0;
|
||||
if (typeof currentIndex !== 'number' || currentIndex === 0) {
|
||||
nextIndex = missingCoverageElements.length - 1;
|
||||
} else if (missingCoverageElements.length > 1) {
|
||||
nextIndex = currentIndex - 1;
|
||||
}
|
||||
|
||||
makeCurrent(nextIndex);
|
||||
}
|
||||
|
||||
function goToNext() {
|
||||
var nextIndex = 0;
|
||||
|
||||
if (
|
||||
typeof currentIndex === 'number' &&
|
||||
currentIndex < missingCoverageElements.length - 1
|
||||
) {
|
||||
nextIndex = currentIndex + 1;
|
||||
}
|
||||
|
||||
makeCurrent(nextIndex);
|
||||
}
|
||||
|
||||
return function jump(event) {
|
||||
if (
|
||||
document.getElementById('fileSearch') === document.activeElement &&
|
||||
document.activeElement != null
|
||||
) {
|
||||
// if we're currently focused on the search input, we don't want to navigate
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.which) {
|
||||
case 78: // n
|
||||
case 74: // j
|
||||
goToNext();
|
||||
break;
|
||||
case 66: // b
|
||||
case 75: // k
|
||||
case 80: // p
|
||||
goToPrevious();
|
||||
break;
|
||||
}
|
||||
};
|
||||
})();
|
||||
window.addEventListener('keydown', jumpToCode);
|
BIN
coverage/lcov-report/favicon.png
Normal file
BIN
coverage/lcov-report/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 445 B |
131
coverage/lcov-report/index.html
Normal file
131
coverage/lcov-report/index.html
Normal file
|
@ -0,0 +1,131 @@
|
|||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Code coverage report for All files</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>All files</h1>
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">82.55% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>71/86</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">62.5% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>10/16</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">86.36% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>19/22</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">82.14% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>69/84</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
<template id="filterTemplate">
|
||||
<div class="quiet">
|
||||
Filter:
|
||||
<input oninput="onInput()" type="search" id="fileSearch">
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="auth.ts"><a href="auth.ts.html">auth.ts</a></td>
|
||||
<td data-value="100" class="pic high">
|
||||
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
||||
</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">4/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="3" class="abs high">3/3</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="index.ts"><a href="index.ts.html">index.ts</a></td>
|
||||
<td data-value="81.7" class="pic high">
|
||||
<div class="chart"><div class="cover-fill" style="width: 81%"></div><div class="cover-empty" style="width: 19%"></div></div>
|
||||
</td>
|
||||
<td data-value="81.7" class="pct high">81.7%</td>
|
||||
<td data-value="82" class="abs high">67/82</td>
|
||||
<td data-value="62.5" class="pct medium">62.5%</td>
|
||||
<td data-value="16" class="abs medium">10/16</td>
|
||||
<td data-value="85" class="pct high">85%</td>
|
||||
<td data-value="20" class="abs high">17/20</td>
|
||||
<td data-value="81.48" class="pct high">81.48%</td>
|
||||
<td data-value="81" class="abs high">66/81</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-09-19T16:27:33.592Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
prettyPrint();
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
<script src="block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
859
coverage/lcov-report/index.ts.html
Normal file
859
coverage/lcov-report/index.ts.html
Normal file
|
@ -0,0 +1,859 @@
|
|||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Code coverage report for index.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1><a href="index.html">All files</a> index.ts</h1>
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">81.7% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>67/82</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">62.5% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>10/16</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">85% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>17/20</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">81.48% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>66/81</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
<template id="filterTemplate">
|
||||
<div class="quiet">
|
||||
Filter:
|
||||
<input oninput="onInput()" type="search" id="fileSearch">
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<a name='L93'></a><a href='#L93'>93</a>
|
||||
<a name='L94'></a><a href='#L94'>94</a>
|
||||
<a name='L95'></a><a href='#L95'>95</a>
|
||||
<a name='L96'></a><a href='#L96'>96</a>
|
||||
<a name='L97'></a><a href='#L97'>97</a>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a>
|
||||
<a name='L137'></a><a href='#L137'>137</a>
|
||||
<a name='L138'></a><a href='#L138'>138</a>
|
||||
<a name='L139'></a><a href='#L139'>139</a>
|
||||
<a name='L140'></a><a href='#L140'>140</a>
|
||||
<a name='L141'></a><a href='#L141'>141</a>
|
||||
<a name='L142'></a><a href='#L142'>142</a>
|
||||
<a name='L143'></a><a href='#L143'>143</a>
|
||||
<a name='L144'></a><a href='#L144'>144</a>
|
||||
<a name='L145'></a><a href='#L145'>145</a>
|
||||
<a name='L146'></a><a href='#L146'>146</a>
|
||||
<a name='L147'></a><a href='#L147'>147</a>
|
||||
<a name='L148'></a><a href='#L148'>148</a>
|
||||
<a name='L149'></a><a href='#L149'>149</a>
|
||||
<a name='L150'></a><a href='#L150'>150</a>
|
||||
<a name='L151'></a><a href='#L151'>151</a>
|
||||
<a name='L152'></a><a href='#L152'>152</a>
|
||||
<a name='L153'></a><a href='#L153'>153</a>
|
||||
<a name='L154'></a><a href='#L154'>154</a>
|
||||
<a name='L155'></a><a href='#L155'>155</a>
|
||||
<a name='L156'></a><a href='#L156'>156</a>
|
||||
<a name='L157'></a><a href='#L157'>157</a>
|
||||
<a name='L158'></a><a href='#L158'>158</a>
|
||||
<a name='L159'></a><a href='#L159'>159</a>
|
||||
<a name='L160'></a><a href='#L160'>160</a>
|
||||
<a name='L161'></a><a href='#L161'>161</a>
|
||||
<a name='L162'></a><a href='#L162'>162</a>
|
||||
<a name='L163'></a><a href='#L163'>163</a>
|
||||
<a name='L164'></a><a href='#L164'>164</a>
|
||||
<a name='L165'></a><a href='#L165'>165</a>
|
||||
<a name='L166'></a><a href='#L166'>166</a>
|
||||
<a name='L167'></a><a href='#L167'>167</a>
|
||||
<a name='L168'></a><a href='#L168'>168</a>
|
||||
<a name='L169'></a><a href='#L169'>169</a>
|
||||
<a name='L170'></a><a href='#L170'>170</a>
|
||||
<a name='L171'></a><a href='#L171'>171</a>
|
||||
<a name='L172'></a><a href='#L172'>172</a>
|
||||
<a name='L173'></a><a href='#L173'>173</a>
|
||||
<a name='L174'></a><a href='#L174'>174</a>
|
||||
<a name='L175'></a><a href='#L175'>175</a>
|
||||
<a name='L176'></a><a href='#L176'>176</a>
|
||||
<a name='L177'></a><a href='#L177'>177</a>
|
||||
<a name='L178'></a><a href='#L178'>178</a>
|
||||
<a name='L179'></a><a href='#L179'>179</a>
|
||||
<a name='L180'></a><a href='#L180'>180</a>
|
||||
<a name='L181'></a><a href='#L181'>181</a>
|
||||
<a name='L182'></a><a href='#L182'>182</a>
|
||||
<a name='L183'></a><a href='#L183'>183</a>
|
||||
<a name='L184'></a><a href='#L184'>184</a>
|
||||
<a name='L185'></a><a href='#L185'>185</a>
|
||||
<a name='L186'></a><a href='#L186'>186</a>
|
||||
<a name='L187'></a><a href='#L187'>187</a>
|
||||
<a name='L188'></a><a href='#L188'>188</a>
|
||||
<a name='L189'></a><a href='#L189'>189</a>
|
||||
<a name='L190'></a><a href='#L190'>190</a>
|
||||
<a name='L191'></a><a href='#L191'>191</a>
|
||||
<a name='L192'></a><a href='#L192'>192</a>
|
||||
<a name='L193'></a><a href='#L193'>193</a>
|
||||
<a name='L194'></a><a href='#L194'>194</a>
|
||||
<a name='L195'></a><a href='#L195'>195</a>
|
||||
<a name='L196'></a><a href='#L196'>196</a>
|
||||
<a name='L197'></a><a href='#L197'>197</a>
|
||||
<a name='L198'></a><a href='#L198'>198</a>
|
||||
<a name='L199'></a><a href='#L199'>199</a>
|
||||
<a name='L200'></a><a href='#L200'>200</a>
|
||||
<a name='L201'></a><a href='#L201'>201</a>
|
||||
<a name='L202'></a><a href='#L202'>202</a>
|
||||
<a name='L203'></a><a href='#L203'>203</a>
|
||||
<a name='L204'></a><a href='#L204'>204</a>
|
||||
<a name='L205'></a><a href='#L205'>205</a>
|
||||
<a name='L206'></a><a href='#L206'>206</a>
|
||||
<a name='L207'></a><a href='#L207'>207</a>
|
||||
<a name='L208'></a><a href='#L208'>208</a>
|
||||
<a name='L209'></a><a href='#L209'>209</a>
|
||||
<a name='L210'></a><a href='#L210'>210</a>
|
||||
<a name='L211'></a><a href='#L211'>211</a>
|
||||
<a name='L212'></a><a href='#L212'>212</a>
|
||||
<a name='L213'></a><a href='#L213'>213</a>
|
||||
<a name='L214'></a><a href='#L214'>214</a>
|
||||
<a name='L215'></a><a href='#L215'>215</a>
|
||||
<a name='L216'></a><a href='#L216'>216</a>
|
||||
<a name='L217'></a><a href='#L217'>217</a>
|
||||
<a name='L218'></a><a href='#L218'>218</a>
|
||||
<a name='L219'></a><a href='#L219'>219</a>
|
||||
<a name='L220'></a><a href='#L220'>220</a>
|
||||
<a name='L221'></a><a href='#L221'>221</a>
|
||||
<a name='L222'></a><a href='#L222'>222</a>
|
||||
<a name='L223'></a><a href='#L223'>223</a>
|
||||
<a name='L224'></a><a href='#L224'>224</a>
|
||||
<a name='L225'></a><a href='#L225'>225</a>
|
||||
<a name='L226'></a><a href='#L226'>226</a>
|
||||
<a name='L227'></a><a href='#L227'>227</a>
|
||||
<a name='L228'></a><a href='#L228'>228</a>
|
||||
<a name='L229'></a><a href='#L229'>229</a>
|
||||
<a name='L230'></a><a href='#L230'>230</a>
|
||||
<a name='L231'></a><a href='#L231'>231</a>
|
||||
<a name='L232'></a><a href='#L232'>232</a>
|
||||
<a name='L233'></a><a href='#L233'>233</a>
|
||||
<a name='L234'></a><a href='#L234'>234</a>
|
||||
<a name='L235'></a><a href='#L235'>235</a>
|
||||
<a name='L236'></a><a href='#L236'>236</a>
|
||||
<a name='L237'></a><a href='#L237'>237</a>
|
||||
<a name='L238'></a><a href='#L238'>238</a>
|
||||
<a name='L239'></a><a href='#L239'>239</a>
|
||||
<a name='L240'></a><a href='#L240'>240</a>
|
||||
<a name='L241'></a><a href='#L241'>241</a>
|
||||
<a name='L242'></a><a href='#L242'>242</a>
|
||||
<a name='L243'></a><a href='#L243'>243</a>
|
||||
<a name='L244'></a><a href='#L244'>244</a>
|
||||
<a name='L245'></a><a href='#L245'>245</a>
|
||||
<a name='L246'></a><a href='#L246'>246</a>
|
||||
<a name='L247'></a><a href='#L247'>247</a>
|
||||
<a name='L248'></a><a href='#L248'>248</a>
|
||||
<a name='L249'></a><a href='#L249'>249</a>
|
||||
<a name='L250'></a><a href='#L250'>250</a>
|
||||
<a name='L251'></a><a href='#L251'>251</a>
|
||||
<a name='L252'></a><a href='#L252'>252</a>
|
||||
<a name='L253'></a><a href='#L253'>253</a>
|
||||
<a name='L254'></a><a href='#L254'>254</a>
|
||||
<a name='L255'></a><a href='#L255'>255</a>
|
||||
<a name='L256'></a><a href='#L256'>256</a>
|
||||
<a name='L257'></a><a href='#L257'>257</a>
|
||||
<a name='L258'></a><a href='#L258'>258</a>
|
||||
<a name='L259'></a><a href='#L259'>259</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">20x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import Auth from "./auth";
|
||||
import User from "./spec/user";
|
||||
import Notification from "./spec/notification";
|
||||
import Issue from "./spec/issue";
|
||||
import Repository from "./spec/repository";
|
||||
import Comment from "./spec/comments";
|
||||
|
||||
class Forgejo {
|
||||
url: URL;
|
||||
username: string;
|
||||
token?: Auth;
|
||||
cors: boolean;
|
||||
/**
|
||||
* Represents a Forgejo instance.
|
||||
* @constructor
|
||||
* @param {string} url - The URL of the Forgejo instance
|
||||
*/
|
||||
constructor(url: string) {
|
||||
this.url = new URL(url);
|
||||
this.cors = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate with token
|
||||
* @param {Auth} token - access token
|
||||
*/
|
||||
async setTokenAuth(token: string) {
|
||||
this.token = new Auth(token);
|
||||
let res = await this.getUser();
|
||||
this.username = res.username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get access token
|
||||
*/
|
||||
getTokenAuth(): Auth {
|
||||
if (this.token) {
|
||||
return this.token;
|
||||
} else <span class="missing-if-branch" title="else path not taken" >E</span>{
|
||||
<span class="cstat-no" title="statement not covered" > throw new Error("set authentication token before use");</span>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get access token in header format for the fetch API
|
||||
*/
|
||||
getTokenAuthHeader() {
|
||||
return { Authorization: `token ${this.getTokenAuth().getToken()}` };
|
||||
}
|
||||
|
||||
getUrl(): URL {
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.cors) {
|
||||
let url = <span class="cstat-no" title="statement not covered" >new URL("http://localhost:3030");</span>
|
||||
<span class="cstat-no" title="statement not covered" > url.pathname = this.url.toString();</span>
|
||||
<span class="cstat-no" title="statement not covered" > return url;</span>
|
||||
}
|
||||
return this.url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logged in user
|
||||
*/
|
||||
async getUser(): Promise<User> {
|
||||
this.url.pathname = "/api/v1/user";
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
<span class="fstat-no" title="function not covered" > setCors() {</span>
|
||||
<span class="cstat-no" title="statement not covered" > this.cors = true;</span>
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all notifications
|
||||
*/
|
||||
async getNotifications(): Promise<Array<Notification>> {
|
||||
this.url.pathname = "/api/v1/notifications";
|
||||
console.log(this.url);
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
|
||||
return await res.json();
|
||||
}
|
||||
/**
|
||||
* Get number of unread notifications
|
||||
*/
|
||||
async getNumUnreadNotifications(): Promise<number> {
|
||||
this.url.pathname = "/api/v1/notifications/new";
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
|
||||
let data = await res.json();
|
||||
return data["new"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Notification Thread
|
||||
* @param {number} id - The ID of a notification thread
|
||||
*/
|
||||
async getNotificationThread(id: number): Promise<Notification> {
|
||||
this.url.pathname = `/api/v1/notifications/threads/${id}`;
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time at which the issue was last read
|
||||
*/
|
||||
lastReadTime(issue: Issue): Date {
|
||||
return new Date("01/01/01"); // TODO: return last read time from storage. If unread, return 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if logged in user is mentioned in the issue
|
||||
*/
|
||||
async findMentionsInIssue(issue: Issue) {
|
||||
let unreadTime = this.lastReadTime(issue);
|
||||
|
||||
const mentionUtil = (str: string): boolean => {
|
||||
return str.includes(this.username);
|
||||
};
|
||||
|
||||
const items = [];
|
||||
|
||||
if (new Date(issue.created_at) > unreadTime) {
|
||||
items.push(issue.title);
|
||||
items.push(issue.body);
|
||||
}
|
||||
|
||||
issue.lazy_comments_data.forEach((comment) => {
|
||||
if (comment.created_at > unreadTime) {
|
||||
items.push(comment.body);
|
||||
return;
|
||||
}
|
||||
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (comment.updated_at) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (comment.updated_at > unreadTime) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > items.push(comment.body);</span>
|
||||
<span class="cstat-no" title="statement not covered" > return;</span>
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let mention = false;
|
||||
items.forEach((item) => {
|
||||
if (mentionUtil(item)) {
|
||||
mention = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
return mention;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark Notification Read
|
||||
* @param {number} id - The ID of a notification thread
|
||||
*/
|
||||
<span class="fstat-no" title="function not covered" > async m</span>arkNotificationRead(id: number) {
|
||||
<span class="cstat-no" title="statement not covered" > this.url.pathname = `/api/v1/notifications/threads/${id}`;</span>
|
||||
<span class="cstat-no" title="statement not covered" > await fetch(this.url, { method: "PATCH" });</span>
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark Notification Read for a specific repository
|
||||
* @param {string} owner - Name of the owner of the repository
|
||||
* @param {string} repo - Name of the repository
|
||||
*/
|
||||
<span class="fstat-no" title="function not covered" > async m</span>arkNotificationReadForRepo(owner: string, repo: string) {
|
||||
<span class="cstat-no" title="statement not covered" > this.url.pathname = `/api/v1/repos/${owner}/${repo}/notifications`;</span>
|
||||
<span class="cstat-no" title="statement not covered" > await fetch(this.url, { method: "PUT" });</span>
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Issue and its comments
|
||||
* @param {str} owner - The owner of the repository
|
||||
* @param {str} repo - The name of the repository
|
||||
* @param {number} id - The ID of an issue
|
||||
*/
|
||||
async getIssue(owner: string, repo: string, id: number): Promise<Issue> {
|
||||
this.url.pathname = `/api/v1/repos/${owner}/${repo}/issues/${id}`;
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
let issue = await res.json();
|
||||
|
||||
if (typeof issue.created_at === "string") {
|
||||
issue.created_at = new Date(issue.created_at);
|
||||
}
|
||||
|
||||
if (issue.updated_at) {
|
||||
if (typeof issue.updated_at === "string") {
|
||||
issue.updated_at = new Date(issue.updated_at);
|
||||
}
|
||||
}
|
||||
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (issue.closed_at) {
|
||||
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (typeof issue.closed_at === "string") {</span>
|
||||
<span class="cstat-no" title="statement not covered" > issue.closed_at = new Date(issue.closed_at);</span>
|
||||
}
|
||||
}
|
||||
|
||||
return issue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and save comments for the issue objects
|
||||
*/
|
||||
async getCommentsForIssue(issue: Issue): Promise<Issue> {
|
||||
// TODO: check if issue.number != issue.id causes problems. I'm assuming
|
||||
// Issue.number is the local repository issue ID and issue.id is DB ID
|
||||
this.url.pathname = `/api/v1/repos/${issue.repository.owner}/${issue.repository.name}/issues/${issue.number}/comments`;
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
let c: Array<Comment> = await res.json();
|
||||
|
||||
c = c.map((comment) => {
|
||||
if (typeof comment.created_at === "string") {
|
||||
comment.created_at = new Date(comment.created_at);
|
||||
}
|
||||
|
||||
if (comment.updated_at) {
|
||||
if (typeof comment.updated_at === "string") {
|
||||
comment.updated_at = new Date(comment.updated_at);
|
||||
}
|
||||
}
|
||||
return comment;
|
||||
});
|
||||
|
||||
issue.lazy_comments_data = c;
|
||||
|
||||
return issue;
|
||||
}
|
||||
}
|
||||
|
||||
export default Forgejo;
|
||||
//export { Notification, Issue, Repository, Comment, User };
|
||||
</pre></td></tr></table></pre>
|
||||
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-09-19T16:27:33.592Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
prettyPrint();
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
<script src="block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
1
coverage/lcov-report/prettify.css
Normal file
1
coverage/lcov-report/prettify.css
Normal file
|
@ -0,0 +1 @@
|
|||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
2
coverage/lcov-report/prettify.js
Normal file
2
coverage/lcov-report/prettify.js
Normal file
File diff suppressed because one or more lines are too long
BIN
coverage/lcov-report/sort-arrow-sprite.png
Normal file
BIN
coverage/lcov-report/sort-arrow-sprite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 138 B |
196
coverage/lcov-report/sorter.js
Normal file
196
coverage/lcov-report/sorter.js
Normal file
|
@ -0,0 +1,196 @@
|
|||
/* eslint-disable */
|
||||
var addSorting = (function() {
|
||||
'use strict';
|
||||
var cols,
|
||||
currentSort = {
|
||||
index: 0,
|
||||
desc: false
|
||||
};
|
||||
|
||||
// returns the summary table element
|
||||
function getTable() {
|
||||
return document.querySelector('.coverage-summary');
|
||||
}
|
||||
// returns the thead element of the summary table
|
||||
function getTableHeader() {
|
||||
return getTable().querySelector('thead tr');
|
||||
}
|
||||
// returns the tbody element of the summary table
|
||||
function getTableBody() {
|
||||
return getTable().querySelector('tbody');
|
||||
}
|
||||
// returns the th element for nth column
|
||||
function getNthColumn(n) {
|
||||
return getTableHeader().querySelectorAll('th')[n];
|
||||
}
|
||||
|
||||
function onFilterInput() {
|
||||
const searchValue = document.getElementById('fileSearch').value;
|
||||
const rows = document.getElementsByTagName('tbody')[0].children;
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
const row = rows[i];
|
||||
if (
|
||||
row.textContent
|
||||
.toLowerCase()
|
||||
.includes(searchValue.toLowerCase())
|
||||
) {
|
||||
row.style.display = '';
|
||||
} else {
|
||||
row.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// loads the search box
|
||||
function addSearchBox() {
|
||||
var template = document.getElementById('filterTemplate');
|
||||
var templateClone = template.content.cloneNode(true);
|
||||
templateClone.getElementById('fileSearch').oninput = onFilterInput;
|
||||
template.parentElement.appendChild(templateClone);
|
||||
}
|
||||
|
||||
// loads all columns
|
||||
function loadColumns() {
|
||||
var colNodes = getTableHeader().querySelectorAll('th'),
|
||||
colNode,
|
||||
cols = [],
|
||||
col,
|
||||
i;
|
||||
|
||||
for (i = 0; i < colNodes.length; i += 1) {
|
||||
colNode = colNodes[i];
|
||||
col = {
|
||||
key: colNode.getAttribute('data-col'),
|
||||
sortable: !colNode.getAttribute('data-nosort'),
|
||||
type: colNode.getAttribute('data-type') || 'string'
|
||||
};
|
||||
cols.push(col);
|
||||
if (col.sortable) {
|
||||
col.defaultDescSort = col.type === 'number';
|
||||
colNode.innerHTML =
|
||||
colNode.innerHTML + '<span class="sorter"></span>';
|
||||
}
|
||||
}
|
||||
return cols;
|
||||
}
|
||||
// attaches a data attribute to every tr element with an object
|
||||
// of data values keyed by column name
|
||||
function loadRowData(tableRow) {
|
||||
var tableCols = tableRow.querySelectorAll('td'),
|
||||
colNode,
|
||||
col,
|
||||
data = {},
|
||||
i,
|
||||
val;
|
||||
for (i = 0; i < tableCols.length; i += 1) {
|
||||
colNode = tableCols[i];
|
||||
col = cols[i];
|
||||
val = colNode.getAttribute('data-value');
|
||||
if (col.type === 'number') {
|
||||
val = Number(val);
|
||||
}
|
||||
data[col.key] = val;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
// loads all row data
|
||||
function loadData() {
|
||||
var rows = getTableBody().querySelectorAll('tr'),
|
||||
i;
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
rows[i].data = loadRowData(rows[i]);
|
||||
}
|
||||
}
|
||||
// sorts the table using the data for the ith column
|
||||
function sortByIndex(index, desc) {
|
||||
var key = cols[index].key,
|
||||
sorter = function(a, b) {
|
||||
a = a.data[key];
|
||||
b = b.data[key];
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
},
|
||||
finalSorter = sorter,
|
||||
tableBody = document.querySelector('.coverage-summary tbody'),
|
||||
rowNodes = tableBody.querySelectorAll('tr'),
|
||||
rows = [],
|
||||
i;
|
||||
|
||||
if (desc) {
|
||||
finalSorter = function(a, b) {
|
||||
return -1 * sorter(a, b);
|
||||
};
|
||||
}
|
||||
|
||||
for (i = 0; i < rowNodes.length; i += 1) {
|
||||
rows.push(rowNodes[i]);
|
||||
tableBody.removeChild(rowNodes[i]);
|
||||
}
|
||||
|
||||
rows.sort(finalSorter);
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
tableBody.appendChild(rows[i]);
|
||||
}
|
||||
}
|
||||
// removes sort indicators for current column being sorted
|
||||
function removeSortIndicators() {
|
||||
var col = getNthColumn(currentSort.index),
|
||||
cls = col.className;
|
||||
|
||||
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
||||
col.className = cls;
|
||||
}
|
||||
// adds sort indicators for current column being sorted
|
||||
function addSortIndicators() {
|
||||
getNthColumn(currentSort.index).className += currentSort.desc
|
||||
? ' sorted-desc'
|
||||
: ' sorted';
|
||||
}
|
||||
// adds event listeners for all sorter widgets
|
||||
function enableUI() {
|
||||
var i,
|
||||
el,
|
||||
ithSorter = function ithSorter(i) {
|
||||
var col = cols[i];
|
||||
|
||||
return function() {
|
||||
var desc = col.defaultDescSort;
|
||||
|
||||
if (currentSort.index === i) {
|
||||
desc = !currentSort.desc;
|
||||
}
|
||||
sortByIndex(i, desc);
|
||||
removeSortIndicators();
|
||||
currentSort.index = i;
|
||||
currentSort.desc = desc;
|
||||
addSortIndicators();
|
||||
};
|
||||
};
|
||||
for (i = 0; i < cols.length; i += 1) {
|
||||
if (cols[i].sortable) {
|
||||
// add the click event handler on the th so users
|
||||
// dont have to click on those tiny arrows
|
||||
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener('click', ithSorter(i));
|
||||
} else {
|
||||
el.attachEvent('onclick', ithSorter(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// adds sorting functionality to the UI
|
||||
return function() {
|
||||
if (!getTable()) {
|
||||
return;
|
||||
}
|
||||
cols = loadColumns();
|
||||
loadData();
|
||||
addSearchBox();
|
||||
addSortIndicators();
|
||||
enableUI();
|
||||
};
|
||||
})();
|
||||
|
||||
window.addEventListener('load', addSorting);
|
162
coverage/lcov.info
Normal file
162
coverage/lcov.info
Normal file
|
@ -0,0 +1,162 @@
|
|||
TN:
|
||||
SF:src/auth.ts
|
||||
FN:7,(anonymous_1)
|
||||
FN:11,(anonymous_2)
|
||||
FNF:2
|
||||
FNH:2
|
||||
FNDA:1,(anonymous_1)
|
||||
FNDA:22,(anonymous_2)
|
||||
DA:8,1
|
||||
DA:12,22
|
||||
DA:16,1
|
||||
LF:3
|
||||
LH:3
|
||||
BRF:0
|
||||
BRH:0
|
||||
end_of_record
|
||||
TN:
|
||||
SF:src/index.ts
|
||||
FN:22,(anonymous_2)
|
||||
FN:31,(anonymous_3)
|
||||
FN:40,(anonymous_4)
|
||||
FN:51,(anonymous_5)
|
||||
FN:55,(anonymous_6)
|
||||
FN:67,(anonymous_7)
|
||||
FN:77,(anonymous_8)
|
||||
FN:84,(anonymous_9)
|
||||
FN:98,(anonymous_10)
|
||||
FN:114,(anonymous_11)
|
||||
FN:127,(anonymous_12)
|
||||
FN:134,(anonymous_13)
|
||||
FN:137,(anonymous_14)
|
||||
FN:148,(anonymous_15)
|
||||
FN:162,(anonymous_16)
|
||||
FN:175,(anonymous_17)
|
||||
FN:185,(anonymous_18)
|
||||
FN:196,(anonymous_19)
|
||||
FN:227,(anonymous_20)
|
||||
FN:238,(anonymous_21)
|
||||
FNF:20
|
||||
FNH:17
|
||||
FNDA:1,(anonymous_2)
|
||||
FNDA:1,(anonymous_3)
|
||||
FNDA:22,(anonymous_4)
|
||||
FNDA:21,(anonymous_5)
|
||||
FNDA:20,(anonymous_6)
|
||||
FNDA:2,(anonymous_7)
|
||||
FNDA:0,(anonymous_8)
|
||||
FNDA:3,(anonymous_9)
|
||||
FNDA:1,(anonymous_10)
|
||||
FNDA:1,(anonymous_11)
|
||||
FNDA:5,(anonymous_12)
|
||||
FNDA:5,(anonymous_13)
|
||||
FNDA:12,(anonymous_14)
|
||||
FNDA:2,(anonymous_15)
|
||||
FNDA:12,(anonymous_16)
|
||||
FNDA:0,(anonymous_17)
|
||||
FNDA:0,(anonymous_18)
|
||||
FNDA:7,(anonymous_19)
|
||||
FNDA:6,(anonymous_20)
|
||||
FNDA:4,(anonymous_21)
|
||||
DA:5,1
|
||||
DA:23,1
|
||||
DA:24,1
|
||||
DA:32,1
|
||||
DA:33,1
|
||||
DA:34,1
|
||||
DA:41,22
|
||||
DA:42,22
|
||||
DA:44,0
|
||||
DA:52,21
|
||||
DA:56,20
|
||||
DA:57,0
|
||||
DA:58,0
|
||||
DA:59,0
|
||||
DA:61,20
|
||||
DA:68,2
|
||||
DA:69,2
|
||||
DA:74,2
|
||||
DA:78,0
|
||||
DA:85,3
|
||||
DA:86,3
|
||||
DA:87,3
|
||||
DA:93,3
|
||||
DA:99,1
|
||||
DA:100,1
|
||||
DA:106,1
|
||||
DA:107,1
|
||||
DA:115,1
|
||||
DA:116,1
|
||||
DA:121,1
|
||||
DA:128,5
|
||||
DA:135,5
|
||||
DA:137,5
|
||||
DA:138,12
|
||||
DA:141,5
|
||||
DA:143,5
|
||||
DA:144,5
|
||||
DA:145,5
|
||||
DA:148,5
|
||||
DA:149,2
|
||||
DA:150,2
|
||||
DA:151,2
|
||||
DA:153,0
|
||||
DA:154,0
|
||||
DA:155,0
|
||||
DA:156,0
|
||||
DA:161,5
|
||||
DA:162,5
|
||||
DA:163,12
|
||||
DA:164,5
|
||||
DA:165,5
|
||||
DA:168,5
|
||||
DA:176,0
|
||||
DA:177,0
|
||||
DA:186,0
|
||||
DA:187,0
|
||||
DA:197,7
|
||||
DA:198,7
|
||||
DA:203,7
|
||||
DA:205,7
|
||||
DA:206,7
|
||||
DA:209,7
|
||||
DA:210,7
|
||||
DA:211,7
|
||||
DA:215,7
|
||||
DA:216,0
|
||||
DA:217,0
|
||||
DA:221,7
|
||||
DA:230,6
|
||||
DA:231,6
|
||||
DA:236,6
|
||||
DA:238,6
|
||||
DA:239,4
|
||||
DA:240,4
|
||||
DA:243,4
|
||||
DA:244,4
|
||||
DA:245,4
|
||||
DA:248,4
|
||||
DA:251,6
|
||||
DA:253,6
|
||||
DA:257,1
|
||||
LF:81
|
||||
LH:66
|
||||
BRDA:41,0,0,22
|
||||
BRDA:41,0,1,0
|
||||
BRDA:56,1,0,0
|
||||
BRDA:143,2,0,5
|
||||
BRDA:149,3,0,2
|
||||
BRDA:153,4,0,0
|
||||
BRDA:154,5,0,0
|
||||
BRDA:163,6,0,5
|
||||
BRDA:205,7,0,7
|
||||
BRDA:209,8,0,7
|
||||
BRDA:210,9,0,7
|
||||
BRDA:215,10,0,0
|
||||
BRDA:216,11,0,0
|
||||
BRDA:239,12,0,4
|
||||
BRDA:243,13,0,4
|
||||
BRDA:244,14,0,4
|
||||
BRF:16
|
||||
BRH:10
|
||||
end_of_record
|
|
@ -1,19 +0,0 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
forgejo:
|
||||
image: codeberg.org/forgejo/forgejo:1.20.1-0
|
||||
container_name: hostea-dash-forgejo
|
||||
network_mode: host
|
||||
environment:
|
||||
- USER_UID=1001
|
||||
- USER_GID=1001
|
||||
- FORGEJO_cors_ENABLED=true
|
||||
- FORGEJO_cors_ALLOW_DOMAIN="*"
|
||||
- FORGEJO_cors_METHODS="GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS"
|
||||
- FORGEJO_cors_ALLOW_CREDENTIALS=false
|
||||
restart: always
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./integration/conf/app.ini:/data/gitea/conf/app.ini:wo
|
76
index.html
Normal file
76
index.html
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,3 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
@ -1,17 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import argparse
|
||||
|
||||
from .cli import Cli
|
||||
|
||||
|
||||
def admin(args):
|
||||
print(args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli = Cli()
|
||||
opts = cli.parse()
|
||||
opts.func(opts, c=cli.c)
|
|
@ -1,39 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
set -Exeuo pipefail
|
||||
|
||||
source integration/lib.sh
|
||||
|
||||
init() {
|
||||
# if is_ci
|
||||
# then
|
||||
# echo "[*] CI environment detected"
|
||||
# else
|
||||
docker_compose_up
|
||||
setup_env
|
||||
sleep 5
|
||||
# wait_for_env
|
||||
# fi
|
||||
forgejo_root
|
||||
init_users_repo
|
||||
fleet_repo_init
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if ! is_ci
|
||||
then
|
||||
docker_compose_down
|
||||
teardown_env
|
||||
sed -i /localhost.*/d ~/.ssh/known_hosts
|
||||
fi
|
||||
}
|
||||
|
||||
new_fleet_repo() {
|
||||
new_fleet_repo_init $2
|
||||
}
|
||||
|
||||
$1 $@
|
|
@ -1,220 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import argparse
|
||||
|
||||
from requests import Session
|
||||
|
||||
|
||||
def forgejo_from_args(args, c: Session):
|
||||
from .forgejo import Forgejo
|
||||
|
||||
return Forgejo(
|
||||
host=args.host,
|
||||
username=args.username,
|
||||
password=args.password,
|
||||
email=args.email,
|
||||
c=c,
|
||||
)
|
||||
|
||||
|
||||
class Forgejo:
|
||||
def __init__(self, parser, c: Session):
|
||||
self.c = c
|
||||
self.parser = parser
|
||||
self.subparser = self.parser.add_subparsers()
|
||||
self.install()
|
||||
self.register()
|
||||
self.login()
|
||||
self.create_repository()
|
||||
self.create_issue()
|
||||
self.create_comment()
|
||||
self.create_access_token()
|
||||
|
||||
def __add_credentials_parser(self, parser):
|
||||
group = parser.add_argument_group("credentials", "User credentials")
|
||||
group.add_argument("username", type=str, help="Forgejo user's username")
|
||||
group.add_argument("password", type=str, help="Forgejo user's password")
|
||||
group.add_argument("email", type=str, help="Forgejo user's email")
|
||||
group.add_argument("host", type=str, help="URI at which Forgejo is running")
|
||||
|
||||
def install(self):
|
||||
def run(args, c: Session):
|
||||
forgejo = forgejo_from_args(args, c=c)
|
||||
forgejo.install()
|
||||
|
||||
self.install_parser = self.subparser.add_parser(
|
||||
name="install", description="Install Forgejo", help="Install Forgejo"
|
||||
)
|
||||
self.__add_credentials_parser(self.install_parser)
|
||||
self.install_parser.set_defaults(func=run)
|
||||
|
||||
def register(self):
|
||||
def run(args, c: Session):
|
||||
forgejo = forgejo_from_args(args, c=c)
|
||||
forgejo.register()
|
||||
|
||||
self.register_parser = self.subparser.add_parser(
|
||||
name="register",
|
||||
description="Forgejo user registration",
|
||||
help="Register a user on Forgejo",
|
||||
)
|
||||
self.__add_credentials_parser(self.register_parser)
|
||||
self.register_parser.set_defaults(func=run)
|
||||
|
||||
def login(self):
|
||||
def run(args, c: Session):
|
||||
forgejo = forgejo_from_args(args, c=c)
|
||||
forgejo.login()
|
||||
|
||||
self.login_parser = self.subparser.add_parser(
|
||||
name="login", description="Forgejo user login", help="Login on Forgejo"
|
||||
)
|
||||
self.__add_credentials_parser(self.login_parser)
|
||||
self.login_parser.set_defaults(func=run)
|
||||
|
||||
def create_repository(self):
|
||||
def run(args, c: Session):
|
||||
forgejo = forgejo_from_args(args, c=c)
|
||||
forgejo.login()
|
||||
forgejo.create_repository(name=args.repo_name)
|
||||
|
||||
self.create_repository_parser = self.subparser.add_parser(
|
||||
name="create_repo",
|
||||
description="Create repository on Forgejo",
|
||||
help="Create repository on Forgejo",
|
||||
)
|
||||
self.__add_credentials_parser(self.create_repository_parser)
|
||||
self.create_repository_parser.set_defaults(func=run)
|
||||
self.create_repository_parser.add_argument(
|
||||
"repo_name", type=str, help="Name of the repository to be created"
|
||||
)
|
||||
|
||||
def create_issue(self):
|
||||
def run(args, c: Session):
|
||||
forgejo = forgejo_from_args(args, c=c)
|
||||
forgejo.login()
|
||||
forgejo.create_issue(
|
||||
owner=args.owner, repo=args.repo, title=args.title, body=args.body
|
||||
)
|
||||
|
||||
self.create_issue_parser = self.subparser.add_parser(
|
||||
name="create_issue",
|
||||
description="Create issue on a repository owned by someone on Forgejo",
|
||||
help="Create issue on Forgejo",
|
||||
)
|
||||
self.__add_credentials_parser(self.create_issue_parser)
|
||||
self.create_issue_parser.set_defaults(func=run)
|
||||
self.create_issue_parser.add_argument(
|
||||
"owner", type=str, help="Owner of the repo"
|
||||
)
|
||||
|
||||
self.create_issue_parser.add_argument(
|
||||
"repo", type=str, help="Name of the repository"
|
||||
)
|
||||
|
||||
self.create_issue_parser.add_argument("title", type=str, help="title")
|
||||
|
||||
self.create_issue_parser.add_argument("body", type=str, help="body")
|
||||
|
||||
def create_comment(self):
|
||||
def run(args, c: Session):
|
||||
forgejo = forgejo_from_args(args, c=c)
|
||||
forgejo.login()
|
||||
forgejo.create_comment(
|
||||
owner=args.owner, repo=args.repo, issue=args.issue, body=args.body
|
||||
)
|
||||
|
||||
self.create_comment_parser = self.subparser.add_parser(
|
||||
name="create_comment",
|
||||
description="Create comment on a repository owned by someone on Forgejo",
|
||||
help="Create comment on Forgejo",
|
||||
)
|
||||
self.__add_credentials_parser(self.create_comment_parser)
|
||||
self.create_comment_parser.set_defaults(func=run)
|
||||
self.create_comment_parser.add_argument(
|
||||
"owner", type=str, help="Owner of the repo"
|
||||
)
|
||||
|
||||
self.create_comment_parser.add_argument(
|
||||
"repo", type=str, help="Name of the repository"
|
||||
)
|
||||
|
||||
self.create_comment_parser.add_argument(
|
||||
"issue", type=int, help="ID of the issue"
|
||||
)
|
||||
|
||||
self.create_comment_parser.add_argument("body", type=str, help="body")
|
||||
|
||||
def create_access_token(self):
|
||||
def run(args, c: Session):
|
||||
forgejo = forgejo_from_args(args, c=c)
|
||||
forgejo.login()
|
||||
forgejo.create_access_token(name=args.name, file=args.file, repo=args.repo)
|
||||
|
||||
self.create_access_token_parser = self.subparser.add_parser(
|
||||
name="create_access_token",
|
||||
description="Create access token for user",
|
||||
help="Create access toekn for user",
|
||||
)
|
||||
self.__add_credentials_parser(self.create_access_token_parser)
|
||||
self.create_access_token_parser.set_defaults(func=run)
|
||||
self.create_access_token_parser.add_argument(
|
||||
"name", type=str, help="name of the access token"
|
||||
)
|
||||
|
||||
self.create_access_token_parser.add_argument(
|
||||
"file", type=str, help="filepath to write the token value"
|
||||
)
|
||||
|
||||
self.create_access_token_parser.add_argument(
|
||||
"repo", type=str, help="repo name write to json file"
|
||||
)
|
||||
|
||||
|
||||
class Cli:
|
||||
def __init__(self):
|
||||
c = Session()
|
||||
self.c = c
|
||||
self.parser = argparse.ArgumentParser(
|
||||
description="Install and Bootstrap Forgejo and Hostea Dashboard"
|
||||
)
|
||||
self.subparser = self.parser.add_subparsers()
|
||||
self.check_env()
|
||||
self.forgejo()
|
||||
|
||||
def __add_credentials_parser(self, parser):
|
||||
group = parser.add_argument_group("credentials", "User credentials")
|
||||
group.add_argument("username", type=str, help="Forgejo user's username")
|
||||
group.add_argument("password", type=str, help="Forgejo user's password")
|
||||
group.add_argument("email", type=str, help="Forgejo user's email")
|
||||
|
||||
def check_env(self):
|
||||
def run(args, c: Session):
|
||||
from .forgejo import Forgejo
|
||||
|
||||
Forgejo.check_online(host=args.forgejo_host)
|
||||
|
||||
self.check_env_parser = self.subparser.add_parser(
|
||||
name="check_env",
|
||||
description="Check and block until environment is ready",
|
||||
help="Check and block until environment is ready",
|
||||
)
|
||||
|
||||
self.check_env_parser.add_argument(
|
||||
"forgejo_host", type=str, help="URI at which Forgejo is running"
|
||||
)
|
||||
|
||||
self.check_env_parser.set_defaults(func=run)
|
||||
|
||||
def forgejo(self):
|
||||
self.forgejo = self.subparser.add_parser(
|
||||
name="forgejo",
|
||||
description="Forgejo",
|
||||
help="Forgejo-related functionality",
|
||||
)
|
||||
Forgejo(parser=self.forgejo, c=self.c)
|
||||
|
||||
def parse(self):
|
||||
return self.parser.parse_args()
|
|
@ -1,109 +0,0 @@
|
|||
APP_NAME = Forgejo:+Beyond+Coding+We+Forge
|
||||
RUN_USER = git
|
||||
WORK_PATH = /data/gitea
|
||||
RUN_MODE = prod
|
||||
|
||||
[cors]
|
||||
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ;
|
||||
; ; More information about CORS can be found here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#The_HTTP_response_headers
|
||||
; ; enable cors headers (disabled by default)
|
||||
ENABLED = true
|
||||
; ;
|
||||
; ; scheme of allowed requests
|
||||
; SCHEME = http
|
||||
; ;
|
||||
; ; list of requesting domains that are allowed
|
||||
ALLOW_DOMAIN = *
|
||||
; ;
|
||||
; ; allow subdomains of headers listed above to request
|
||||
; ALLOW_SUBDOMAIN = false
|
||||
; ;
|
||||
; ; list of methods allowed to request
|
||||
METHODS = GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS
|
||||
; ;
|
||||
; ; max time to cache response
|
||||
; MAX_AGE = 10m
|
||||
; ;
|
||||
; ; allow request with credentials
|
||||
ALLOW_CREDENTIALS = true
|
||||
; ;
|
||||
; ; headers to permit
|
||||
HEADERS = Content-Type,User-Agent
|
||||
|
||||
[federation]
|
||||
ENABLED = true
|
||||
|
||||
[database]
|
||||
DB_TYPE = sqlite3
|
||||
HOST = localhost:3306
|
||||
NAME = forgejo
|
||||
USER = root
|
||||
PASSWD =
|
||||
SCHEMA =
|
||||
SSL_MODE = disable
|
||||
PATH = /data/gitea/gitea.db
|
||||
LOG_SQL = false
|
||||
|
||||
[repository]
|
||||
ROOT = /data/git/repositories
|
||||
|
||||
[server]
|
||||
SSH_DOMAIN = localhost:3000
|
||||
DOMAIN = localhost:3000
|
||||
HTTP_PORT = 3000
|
||||
ROOT_URL = http://localhost:3000/
|
||||
APP_DATA_PATH = /data/gitea/data
|
||||
DISABLE_SSH = false
|
||||
SSH_PORT = 22
|
||||
LFS_START_SERVER = true
|
||||
LFS_JWT_SECRET = P0LeRSoFLTlw8oR4KIfkYxj0iPD6hP91a_VCIct_YW4
|
||||
OFFLINE_MODE = false
|
||||
|
||||
[lfs]
|
||||
PATH = /data/git/lfs
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
ENABLE_NOTIFY_MAIL = false
|
||||
DISABLE_REGISTRATION = false
|
||||
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
|
||||
ENABLE_CAPTCHA = false
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
DEFAULT_ENABLE_TIMETRACKING = true
|
||||
NO_REPLY_ADDRESS = noreply.localhost
|
||||
|
||||
[openid]
|
||||
ENABLE_OPENID_SIGNIN = true
|
||||
ENABLE_OPENID_SIGNUP = true
|
||||
|
||||
[cron.update_checker]
|
||||
ENABLED = false
|
||||
|
||||
[session]
|
||||
PROVIDER = file
|
||||
|
||||
[log]
|
||||
MODE = console
|
||||
LEVEL = info
|
||||
ROOT_PATH = /data/gitea/log
|
||||
|
||||
[repository.pull-request]
|
||||
DEFAULT_MERGE_STYLE = merge
|
||||
|
||||
[repository.signing]
|
||||
DEFAULT_TRUST_MODEL = committer
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2OTUwNTk0MDB9.kEvkrCByZx5i6dqNKE-KrYlmSvkMWjFPXUIdelEqcII
|
||||
PASSWORD_HASH_ALGO = pbkdf2
|
||||
|
||||
[oauth2]
|
||||
JWT_SECRET = A0Js-ebR-1DEIwL0KAPDiE1Ohw0S-FV3bYvNgAFFCrM
|
|
@ -1,109 +0,0 @@
|
|||
APP_NAME = Forgejo:+Beyond+Coding+We+Forge
|
||||
RUN_USER = git
|
||||
WORK_PATH = /data/gitea
|
||||
RUN_MODE = prod
|
||||
|
||||
[cors]
|
||||
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ;
|
||||
; ; More information about CORS can be found here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#The_HTTP_response_headers
|
||||
; ; enable cors headers (disabled by default)
|
||||
ENABLED = true
|
||||
; ;
|
||||
; ; scheme of allowed requests
|
||||
; SCHEME = http
|
||||
; ;
|
||||
; ; list of requesting domains that are allowed
|
||||
ALLOW_DOMAIN = *
|
||||
; ;
|
||||
; ; allow subdomains of headers listed above to request
|
||||
; ALLOW_SUBDOMAIN = false
|
||||
; ;
|
||||
; ; list of methods allowed to request
|
||||
METHODS = GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS
|
||||
; ;
|
||||
; ; max time to cache response
|
||||
; MAX_AGE = 10m
|
||||
; ;
|
||||
; ; allow request with credentials
|
||||
ALLOW_CREDENTIALS = true
|
||||
; ;
|
||||
; ; headers to permit
|
||||
HEADERS = Content-Type,User-Agent
|
||||
|
||||
[federation]
|
||||
ENABLED = true
|
||||
|
||||
[database]
|
||||
DB_TYPE = sqlite3
|
||||
HOST = localhost:3306
|
||||
NAME = forgejo
|
||||
USER = root
|
||||
PASSWD =
|
||||
SCHEMA =
|
||||
SSL_MODE = disable
|
||||
PATH = /data/gitea/gitea.db
|
||||
LOG_SQL = false
|
||||
|
||||
[repository]
|
||||
ROOT = /data/git/repositories
|
||||
|
||||
[server]
|
||||
SSH_DOMAIN = forgejo:3000
|
||||
DOMAIN = forgejo:3000
|
||||
HTTP_PORT = 3000
|
||||
ROOT_URL = http://forgejo:3000/
|
||||
APP_DATA_PATH = /data/gitea/data
|
||||
DISABLE_SSH = false
|
||||
SSH_PORT = 22
|
||||
LFS_START_SERVER = true
|
||||
LFS_JWT_SECRET = P0LeRSoFLTlw8oR4KIfkYxj0iPD6hP91a_VCIct_YW4
|
||||
OFFLINE_MODE = false
|
||||
|
||||
[lfs]
|
||||
PATH = /data/git/lfs
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
ENABLE_NOTIFY_MAIL = false
|
||||
DISABLE_REGISTRATION = false
|
||||
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
|
||||
ENABLE_CAPTCHA = false
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
DEFAULT_ENABLE_TIMETRACKING = true
|
||||
NO_REPLY_ADDRESS = noreply.forgejo
|
||||
|
||||
[openid]
|
||||
ENABLE_OPENID_SIGNIN = true
|
||||
ENABLE_OPENID_SIGNUP = true
|
||||
|
||||
[cron.update_checker]
|
||||
ENABLED = false
|
||||
|
||||
[session]
|
||||
PROVIDER = file
|
||||
|
||||
[log]
|
||||
MODE = console
|
||||
LEVEL = info
|
||||
ROOT_PATH = /data/gitea/log
|
||||
|
||||
[repository.pull-request]
|
||||
DEFAULT_MERGE_STYLE = merge
|
||||
|
||||
[repository.signing]
|
||||
DEFAULT_TRUST_MODEL = committer
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2OTUwNTk0MDB9.kEvkrCByZx5i6dqNKE-KrYlmSvkMWjFPXUIdelEqcII
|
||||
PASSWORD_HASH_ALGO = pbkdf2
|
||||
|
||||
[oauth2]
|
||||
JWT_SECRET = A0Js-ebR-1DEIwL0KAPDiE1Ohw0S-FV3bYvNgAFFCrM
|
|
@ -1,34 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
from html.parser import HTMLParser
|
||||
|
||||
|
||||
class ParseCSRF(HTMLParser):
|
||||
token: str = None
|
||||
|
||||
def __init__(self, name):
|
||||
HTMLParser.__init__(self)
|
||||
self.name = name
|
||||
|
||||
def handle_starttag(self, tag: str, attrs: (str, str)):
|
||||
if self.token:
|
||||
return
|
||||
|
||||
if tag != "input":
|
||||
return
|
||||
|
||||
token = None
|
||||
for index, (k, v) in enumerate(attrs):
|
||||
if k == "value":
|
||||
token = v
|
||||
|
||||
if all([k == "name", v == self.name]):
|
||||
if token:
|
||||
self.token = token
|
||||
return
|
||||
for inner_index, (nk, nv) in enumerate(attrs, start=index):
|
||||
if nk == "value":
|
||||
self.token = nv
|
||||
return
|
|
@ -1,315 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import os
|
||||
import random
|
||||
import json
|
||||
from urllib.parse import urlunparse, urlparse
|
||||
from html.parser import HTMLParser
|
||||
from time import sleep
|
||||
|
||||
from requests import Session
|
||||
from requests.auth import HTTPBasicAuth
|
||||
import requests
|
||||
|
||||
from .csrf import ParseCSRF
|
||||
|
||||
# FORGEJO_USER = "root"
|
||||
# FORGEJO_EMAIL = "root@example.com"
|
||||
# FORGEJO_PASSWORD = "foobarpassword"
|
||||
# HOST = "http://localhost:8080"
|
||||
#
|
||||
# REPOS = []
|
||||
|
||||
|
||||
class Forgejo:
|
||||
def __init__(self, host: str, username: str, password: str, email: str, c: Session):
|
||||
self.host = host
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.email = email
|
||||
self.c = c
|
||||
self.__csrf_key = "_csrf"
|
||||
self.__logged_in = False
|
||||
|
||||
def get_uri(self, path: str):
|
||||
parsed = urlparse(self.host)
|
||||
return urlunparse((parsed.scheme, parsed.netloc, path, "", "", ""))
|
||||
|
||||
def get_api_uri(self, path: str):
|
||||
parsed = urlparse(self.host)
|
||||
return urlunparse(
|
||||
(
|
||||
parsed.scheme,
|
||||
f"{self.username}:{self.password}@{parsed.netloc}",
|
||||
path,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def check_online(host: str):
|
||||
"""
|
||||
Check if Forgejo instance is online
|
||||
"""
|
||||
count = 0
|
||||
parsed = urlparse(host)
|
||||
url = urlunparse((parsed.scheme, parsed.netloc, "/", "", "", ""))
|
||||
|
||||
while True:
|
||||
try:
|
||||
res = requests.get(url, allow_redirects=False)
|
||||
if any([res.status_code == 302, res.status_code == 200]):
|
||||
break
|
||||
except:
|
||||
sleep(2)
|
||||
print(f"Retrying {count} time")
|
||||
count += 1
|
||||
continue
|
||||
|
||||
def install(self):
|
||||
"""
|
||||
Install Forgejo, first form that a user sees when a new instance is
|
||||
deployed
|
||||
"""
|
||||
|
||||
parsed = urlparse(self.host)
|
||||
# cwd = os.environ.get("PWD")
|
||||
# user = os.environ.get("USER")
|
||||
payload = {
|
||||
"db_type": "sqlite3",
|
||||
"db_host": "localhost:3306",
|
||||
"db_user": "root",
|
||||
"db_passwd": "",
|
||||
"db_name": "forgejo",
|
||||
"ssl_mode": "disable",
|
||||
"db_schema": "",
|
||||
"charset": "utf8",
|
||||
"db_path": "/data/gitea/gitea.db",
|
||||
"app_name": "Forgejo:+Beyond+Coding+We+Forge",
|
||||
"repo_root_path": "/data/git/repositories",
|
||||
"lfs_root_path": "/data/git/lfs",
|
||||
"run_user": "git",
|
||||
"domain": parsed.netloc,
|
||||
"ssh_port": "22",
|
||||
"http_port": "3000",
|
||||
"app_url": self.get_uri(""),
|
||||
"log_root_path": "/data/gitea/log",
|
||||
"smtp_host": "",
|
||||
"smtp_from": "",
|
||||
"smtp_user": "",
|
||||
"smtp_passwd": "",
|
||||
"enable_federated_avatar": "on",
|
||||
"enable_open_id_sign_in": "on",
|
||||
"enable_open_id_sign_up": "on",
|
||||
"default_allow_create_organization": "on",
|
||||
"default_enable_timetracking": "on",
|
||||
"no_reply_address": "noreply.localhost",
|
||||
"password_algorithm": "pbkdf2",
|
||||
"admin_name": self.username,
|
||||
"admin_passwd": self.password,
|
||||
"admin_confirm_passwd": self.password,
|
||||
"admin_email": self.email,
|
||||
}
|
||||
|
||||
resp = self.c.post(self.get_uri(""), data=payload, allow_redirects=False)
|
||||
sleep(10)
|
||||
|
||||
def get_csrf_token(self, url: str) -> str:
|
||||
"""
|
||||
Get CSRF token at a URI
|
||||
"""
|
||||
resp = self.c.get(url, allow_redirects=False)
|
||||
if resp.status_code != 200 and resp.status_code != 302:
|
||||
print(url, resp.status_code)
|
||||
raise Exception(f"Can't get csrf token: {resp.status_code}")
|
||||
parser = ParseCSRF(name=self.__csrf_key)
|
||||
parser.feed(resp.text)
|
||||
csrf = parser.token
|
||||
return csrf
|
||||
|
||||
def register(self):
|
||||
"""
|
||||
Register User
|
||||
"""
|
||||
url = self.get_uri("/user/sign_up")
|
||||
csrf = self.get_csrf_token(url)
|
||||
payload = {
|
||||
"_csrf": csrf,
|
||||
"user_name": self.username,
|
||||
"password": self.password,
|
||||
"retype": self.password,
|
||||
"email": self.email,
|
||||
}
|
||||
self.c.post(url, data=payload, allow_redirects=False)
|
||||
|
||||
def login(self):
|
||||
"""
|
||||
Login, must be called at least once before performing authenticated
|
||||
operations
|
||||
"""
|
||||
if self.__logged_in:
|
||||
return
|
||||
url = self.get_uri("/user/login")
|
||||
csrf = self.get_csrf_token(url)
|
||||
payload = {
|
||||
"_csrf": csrf,
|
||||
"user_name": self.username,
|
||||
"password": self.password,
|
||||
"remember": "on",
|
||||
}
|
||||
resp = self.c.post(url, data=payload, allow_redirects=False)
|
||||
if any(
|
||||
[resp.status_code == 302, resp.status_code == 200, resp.status_code == 303]
|
||||
):
|
||||
print("User logged in")
|
||||
self.__logged_in = True
|
||||
return
|
||||
|
||||
raise Exception(
|
||||
f"[ERROR] Authentication failed. status code {resp.status_code}"
|
||||
)
|
||||
|
||||
def create_repository(self, name: str):
|
||||
"""
|
||||
Create repository
|
||||
"""
|
||||
self.login()
|
||||
|
||||
def get_repository_payload(csrf: str, name: str, user_id: str):
|
||||
data = {
|
||||
"_csrf": csrf,
|
||||
"uid": user_id,
|
||||
"repo_name": name,
|
||||
"description": f"this repository is named {name}",
|
||||
"repo_template": "",
|
||||
"issue_labels": "",
|
||||
"gitignores": "",
|
||||
"license": "",
|
||||
"readme": "Default",
|
||||
"default_branch": "master",
|
||||
"trust_model": "default",
|
||||
}
|
||||
return data
|
||||
|
||||
url = self.get_uri("/repo/create")
|
||||
user_id = self.c.get(self.get_api_uri("/api/v1/user")).json()["id"]
|
||||
|
||||
csrf = self.get_csrf_token(url)
|
||||
data = get_repository_payload(csrf, name, user_id=user_id)
|
||||
|
||||
resp = self.c.post(url, data=data, allow_redirects=False)
|
||||
print(f"Created repository {name}")
|
||||
if (
|
||||
resp.status_code != 302
|
||||
and resp.status_code != 200
|
||||
and resp.status_code != 303
|
||||
):
|
||||
raise Exception(
|
||||
f"Error while creating repository: {name} {resp.status_code}"
|
||||
)
|
||||
|
||||
def create_issue(self, owner: str, repo: str, title: str, body: str):
|
||||
"""
|
||||
Create issue
|
||||
"""
|
||||
self.login()
|
||||
|
||||
def create_issue_payload(csrf: str, title: str, body: str):
|
||||
data = {
|
||||
"_csrf": csrf,
|
||||
"title": title,
|
||||
"content": body,
|
||||
"search": "",
|
||||
"label_ids": "",
|
||||
"milestone_id": "",
|
||||
"project_id": "",
|
||||
"assignee_ids": "",
|
||||
"redirect_after_creation": "",
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
url = self.get_uri(f"/{owner}/{repo}/issues/new")
|
||||
csrf = self.get_csrf_token(url)
|
||||
data = create_issue_payload(csrf=csrf, title=title, body=body)
|
||||
|
||||
resp = self.c.post(url, data=data, allow_redirects=False)
|
||||
print(f"Created issue")
|
||||
if (
|
||||
resp.status_code != 302
|
||||
and resp.status_code != 200
|
||||
and resp.status_code != 303
|
||||
):
|
||||
raise Exception(f"Error while creating issue: {resp.status_code}")
|
||||
|
||||
def create_comment(self, owner: str, repo: str, issue: int, body: str):
|
||||
"""
|
||||
Create comment
|
||||
"""
|
||||
self.login()
|
||||
|
||||
def create_comment_payload(csrf: str, body: str):
|
||||
data = {
|
||||
"_csrf": csrf,
|
||||
"content": body,
|
||||
"status": "",
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
url = self.get_uri(f"/{owner}/{repo}/issues/{issue}")
|
||||
csrf = self.get_csrf_token(url)
|
||||
data = create_comment_payload(csrf, body)
|
||||
|
||||
url = self.get_uri(f"/{owner}/{repo}/issues/{issue}/comments")
|
||||
resp = self.c.post(url, data=data, allow_redirects=False)
|
||||
print(f"Created comment")
|
||||
if (
|
||||
resp.status_code != 302
|
||||
and resp.status_code != 200
|
||||
and resp.status_code != 303
|
||||
):
|
||||
raise Exception(f"Error while creating comment: {resp.status_code}")
|
||||
|
||||
def create_access_token(self, name: str, file: str, repo: str):
|
||||
"""
|
||||
Create access token
|
||||
"""
|
||||
|
||||
def create_access_token_payload(name: str):
|
||||
data = {
|
||||
"name": name,
|
||||
"scopes": [
|
||||
"read:issue",
|
||||
"write:notification",
|
||||
"read:repository",
|
||||
"read:user",
|
||||
],
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
url = self.get_uri("/api/v1/users/owner_user/tokens")
|
||||
data = create_access_token_payload(name)
|
||||
|
||||
session = Session()
|
||||
session.auth = (self.username, self.password)
|
||||
resp = session.post(url, json=data, allow_redirects=False)
|
||||
|
||||
if resp.status_code != 201:
|
||||
raise Exception(f"Error while creating comment: {resp.status_code}")
|
||||
|
||||
print("Created access token")
|
||||
data = resp.json()
|
||||
with open(file, "w") as f:
|
||||
data["login"] = self.username
|
||||
data["email"] = self.email
|
||||
data["repo"] = repo
|
||||
data["forgejo_url"] = self.get_uri("")
|
||||
content = json.dumps(data)
|
||||
f.write(content)
|
||||
print(f"Wrote access token to {file}")
|
|
@ -1,187 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
is_ci(){
|
||||
if [ -z ${CI+x} ];
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
if is_ci
|
||||
then
|
||||
FORGEJO_URL="http://forgejo:3000"
|
||||
FORGEJO_SSH_URL="ssh://git@forgejo:22"
|
||||
mkdir /woodpecker/src/git.batsense.net/realaravinth/forgejo-notifications-core/tmp/
|
||||
FORGEJO_USER1_ACCESS_TOKEN_FILE_PATH=/woodpecker/src/git.batsense.net/realaravinth/forgejo-notifications-core/tmp/user1-accesstoken.json
|
||||
else
|
||||
FORGEJO_URL="http://localhost:3000"
|
||||
FORGEJO_USER1_ACCESS_TOKEN_FILE_PATH=$(realpath tmp/user1-accesstoken.json)
|
||||
FORGEJO_SSH_URL="ssh://git@localhost:22"
|
||||
fi
|
||||
|
||||
readonly FORGEJO_ROOT_USERNAME=root
|
||||
readonly FORGEJO_ROOT_EMAIL="$FORGEJO_ROOT_USERNAME@example.org"
|
||||
readonly FORGEJO_ROOT_PASSOWRD=supercomplicatedpassword
|
||||
|
||||
readonly FORGEJO_USER1_USERNAME=owner_user
|
||||
readonly FORGEJO_USER1_PASSWORD=supercomplicatedpassword
|
||||
readonly FORGEJO_USER1_EMAIL="$FORGEJO_USER1_USERNAME@example.org"
|
||||
readonly FORGEJO_USER1_SUPPORT_REPO="support"
|
||||
readonly FORGEJO_USER1_ACCESS_TOKEN_NAME="coreaccesstoken"
|
||||
rm $FORGEJO_USER1_ACCESS_TOKEN_FILE_PATH || true
|
||||
|
||||
readonly FORGEJO_TESTUSER_USERNAME=test_user
|
||||
readonly FORGEJO_TESTUSER_PASSWORD=supercomplicatedpassword
|
||||
readonly FORGEJO_TESTUSER_EMAIL="$FORGEJO_TESTUSER_USERNAME@example.org"
|
||||
|
||||
|
||||
wait_for_env() {
|
||||
python -m integration \
|
||||
check_env $FORGEJO_URL
|
||||
}
|
||||
|
||||
# register root user on Forgejo to simulate Hoste admin and integrate SSO
|
||||
forgejo_root(){
|
||||
python -m integration \
|
||||
forgejo install \
|
||||
$FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \
|
||||
$FORGEJO_ROOT_EMAIL \
|
||||
$FORGEJO_URL
|
||||
python -m integration \
|
||||
forgejo register \
|
||||
$FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \
|
||||
$FORGEJO_ROOT_EMAIL \
|
||||
$FORGEJO_URL
|
||||
python -m integration \
|
||||
forgejo login \
|
||||
$FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \
|
||||
$FORGEJO_ROOT_EMAIL \
|
||||
$FORGEJO_URL
|
||||
}
|
||||
|
||||
|
||||
# register user "Hostea" on Forgejo and create support repository
|
||||
init_users_repo() {
|
||||
python -m integration \
|
||||
forgejo register \
|
||||
$FORGEJO_USER1_USERNAME $FORGEJO_USER1_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL
|
||||
python -m integration \
|
||||
forgejo login \
|
||||
$FORGEJO_USER1_USERNAME $FORGEJO_USER1_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL
|
||||
python -m integration \
|
||||
forgejo create_repo \
|
||||
$FORGEJO_USER1_USERNAME $FORGEJO_USER1_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_SUPPORT_REPO
|
||||
|
||||
python -m integration \
|
||||
forgejo register \
|
||||
$FORGEJO_TESTUSER_USERNAME $FORGEJO_TESTUSER_PASSWORD \
|
||||
$FORGEJO_TESTUSER_EMAIL \
|
||||
$FORGEJO_URL
|
||||
|
||||
python -m integration \
|
||||
forgejo create_issue \
|
||||
$FORGEJO_TESTUSER_USERNAME $FORGEJO_TESTUSER_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_USERNAME \
|
||||
$FORGEJO_USER1_SUPPORT_REPO \
|
||||
"normal issue title" "normal issue body"
|
||||
|
||||
python -m integration \
|
||||
forgejo create_comment \
|
||||
$FORGEJO_TESTUSER_USERNAME $FORGEJO_TESTUSER_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_USERNAME \
|
||||
$FORGEJO_USER1_SUPPORT_REPO \
|
||||
1 "normal body"
|
||||
|
||||
python -m integration \
|
||||
forgejo create_comment \
|
||||
$FORGEJO_TESTUSER_USERNAME $FORGEJO_TESTUSER_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_USERNAME \
|
||||
$FORGEJO_USER1_SUPPORT_REPO \
|
||||
1 "mention body @$FORGEJO_USER1_USERNAME"
|
||||
|
||||
python -m integration \
|
||||
forgejo create_issue \
|
||||
$FORGEJO_TESTUSER_USERNAME $FORGEJO_TESTUSER_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_USERNAME \
|
||||
$FORGEJO_USER1_SUPPORT_REPO \
|
||||
"normal issue title" "mention issue @$FORGEJO_USER1_USERNAME"
|
||||
|
||||
python -m integration \
|
||||
forgejo create_issue \
|
||||
$FORGEJO_TESTUSER_USERNAME $FORGEJO_TESTUSER_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_USERNAME \
|
||||
$FORGEJO_USER1_SUPPORT_REPO \
|
||||
"mention issue @$FORGEJO_USER1_USERNAME" "normal issue body"
|
||||
|
||||
|
||||
python -m integration \
|
||||
forgejo create_issue \
|
||||
$FORGEJO_TESTUSER_USERNAME $FORGEJO_TESTUSER_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_USERNAME \
|
||||
$FORGEJO_USER1_SUPPORT_REPO \
|
||||
"mention issue @$FORGEJO_USER1_USERNAME" "mention issue @$FORGEJO_USER1_USERNAME"
|
||||
|
||||
python -m integration \
|
||||
forgejo create_issue \
|
||||
$FORGEJO_TESTUSER_USERNAME $FORGEJO_TESTUSER_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_USERNAME \
|
||||
$FORGEJO_USER1_SUPPORT_REPO \
|
||||
"normal issue title and normal body" "normal body"
|
||||
|
||||
python -m integration \
|
||||
forgejo create_access_token \
|
||||
$FORGEJO_USER1_USERNAME $FORGEJO_USER1_PASSWORD \
|
||||
$FORGEJO_USER1_EMAIL \
|
||||
$FORGEJO_URL \
|
||||
$FORGEJO_USER1_ACCESS_TOKEN_NAME \
|
||||
$FORGEJO_USER1_ACCESS_TOKEN_FILE_PATH \
|
||||
$FORGEJO_USER1_SUPPORT_REPO
|
||||
}
|
||||
|
||||
setup_env() {
|
||||
# mkdir tmp/ || true
|
||||
# nohup python manage.py runserver > /dev/null 2>&1 &
|
||||
# SERVER_PID=$!
|
||||
# echo $SERVER_PID > $SERVER_PID_FILE
|
||||
echo "TODO"
|
||||
}
|
||||
|
||||
teardown_env() {
|
||||
echo "TODO"
|
||||
#kill $(cat $SERVER_PID_FILE)
|
||||
}
|
||||
|
||||
docker_compose_up() {
|
||||
echo "[*] Starting Forgejo"
|
||||
docker-compose -f docker-compose-dev-deps.yml up
|
||||
}
|
||||
|
||||
docker_compose_down() {
|
||||
docker-compose -f docker-compose-dev-deps.yml down
|
||||
docker-compose -f docker-compose-dev-deps.yml down --remove-orphans
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
set -Exeuo pipefail
|
||||
|
||||
source integration/lib.sh
|
||||
|
||||
main() {
|
||||
teardown_env || true
|
||||
setup_env
|
||||
wait_for_env
|
||||
forgejo_root
|
||||
init_users_repo
|
||||
teardown_env
|
||||
echo "All Good! :)"
|
||||
}
|
||||
|
||||
main
|
|
@ -1,19 +0,0 @@
|
|||
const foo = require("./tmp/user1-accesstoken.json");
|
||||
|
||||
module.exports = {
|
||||
transform: {
|
||||
"^.+\\.(t|j)sx?$": "@swc/jest",
|
||||
},
|
||||
testEnvironment: "jsdom",
|
||||
setupFiles: ["./setupJest.js"],
|
||||
collectCoverage: true,
|
||||
coveragePathIgnorePatterns: [
|
||||
"/node_modules/",
|
||||
"setupTests.ts",
|
||||
"setUpTests.ts",
|
||||
"setUpTests.js",
|
||||
],
|
||||
testEnvironmentOptions: {
|
||||
url: foo["forgejo_url"],
|
||||
},
|
||||
};
|
43
modules.html
Normal file
43
modules.html
Normal file
File diff suppressed because one or more lines are too long
62
package.json
62
package.json
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
"author": "Aravinth Manivannan <realaravinth@batsense.net>",
|
||||
"description": "JS library to interact with Forgejo API to work with notification",
|
||||
"version": "0.1.0-alpha-1",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"type": "module",
|
||||
"module": "dist/web.js",
|
||||
"main": "dist/web.js",
|
||||
"keywords": [
|
||||
"Forgejo",
|
||||
"ForgeFlux"
|
||||
],
|
||||
"homepage": "https://forgejo-notifications-core.docs.forgeflux.org/",
|
||||
"files": [
|
||||
"dist/web.js",
|
||||
"dist/web.js.map",
|
||||
"package.json",
|
||||
"pnpm-lock.yaml"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://git.batsense.net/realaravinth/forgejo-notifications-core/issues",
|
||||
"email": "realaravinth@batsense.net"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "http://batsense.net/donate"
|
||||
},
|
||||
{
|
||||
"type": "liberapay",
|
||||
"url": "https://liberapay.com/realaravinth"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.batsense.net/realaravinth/forgejo-notifications-core/"
|
||||
},
|
||||
"name": "forgejo-notifications-core",
|
||||
"scripts": {
|
||||
"build": "swc ./src/index.ts -o ./dist/index.js && spack --config ./spack.config.cjs",
|
||||
"lint": "prettier --write ./src/*",
|
||||
"test": "jest",
|
||||
"doc": "typedoc ./src/index.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^29.7.0",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.85",
|
||||
"@swc/jest": "^0.2.29",
|
||||
"@types/jest": "^29.5.5",
|
||||
"@types/node": "^20.6.2",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"jsdom": "^22.1.0",
|
||||
"prettier": "3.0.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typedoc": "^0.25.1",
|
||||
"typescript": "^5.2.2",
|
||||
"whatwg-fetch": "^3.6.19"
|
||||
}
|
||||
}
|
3693
pnpm-lock.yaml
3693
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
169
scripts/ci.sh
169
scripts/ci.sh
|
@ -1,169 +0,0 @@
|
|||
#!/bin/bash
|
||||
# ci.sh: Helper script to automate deployment operations on CI/CD
|
||||
# Copyright © 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -xEeuo pipefail
|
||||
|
||||
readonly SSH_ID_FILE=/tmp/ci-ssh-id
|
||||
readonly SSH_REMOTE_NAME=origin-ssh
|
||||
|
||||
check_arg(){
|
||||
if [ -z $1 ]
|
||||
then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
match_arg() {
|
||||
if [ $1 == $2 ] || [ $1 == $3 ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
help() {
|
||||
cat << EOF
|
||||
USAGE: ci.sh [SUBCOMMAND]
|
||||
Helper script to automate deployment operations on CI/CD
|
||||
|
||||
Subcommands
|
||||
|
||||
-c --clean cleanup secrets, SSH key and other runtime data
|
||||
-i --init <SSH_PRIVATE_KEY> initialize environment, write SSH private to file
|
||||
-d --deploy commit buidl to
|
||||
-p --push <PAGES-SECRET> <TARGET BRANCH> push branch to Gitea and call Pages server
|
||||
-h --help print this help menu
|
||||
EOF
|
||||
}
|
||||
|
||||
# $1: SSH private key
|
||||
write_ssh(){
|
||||
truncate --size 0 $SSH_ID_FILE
|
||||
echo "$1" > $SSH_ID_FILE
|
||||
chmod 600 $SSH_ID_FILE
|
||||
}
|
||||
|
||||
set_ssh_remote() {
|
||||
http_remote_url=$(git remote get-url origin)
|
||||
remote_hostname=$(echo $http_remote_url | cut -d '/' -f 3)
|
||||
repository_owner=$(echo $http_remote_url | cut -d '/' -f 4)
|
||||
repository_name=$(echo $http_remote_url | cut -d '/' -f 5)
|
||||
ssh_remote="git@$remote_hostname:$repository_owner/$repository_name"
|
||||
ssh_remote="git@git.batsense.net:realaravinth/forgejo-notifications-core.git"
|
||||
git remote add $SSH_REMOTE_NAME $ssh_remote
|
||||
}
|
||||
|
||||
clean() {
|
||||
if [ -f $SSH_ID_FILE ]
|
||||
then
|
||||
shred $SSH_ID_FILE
|
||||
rm $SSH_ID_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
# $1: branch name
|
||||
# $2: directory containing build assets
|
||||
# $3: Author in <author-name author@example.com> format
|
||||
deploy() {
|
||||
original_branch=$(git branch --show-current)
|
||||
tmp_dir=$(mktemp -d)
|
||||
cp -r $2/* $tmp_dir
|
||||
|
||||
if [[ -z $(git ls-remote --heads origin ${1}) ]]
|
||||
then
|
||||
echo "[*] Creating deployment branch $1"
|
||||
git checkout --orphan $1
|
||||
else
|
||||
echo "[*] Deployment branch $1 exists, pulling changes from remote"
|
||||
git fetch origin $1
|
||||
git switch $1
|
||||
fi
|
||||
|
||||
git rm -rf .
|
||||
/bin/rm -rf *
|
||||
cp -r $tmp_dir/* .
|
||||
git add --all
|
||||
if [ $(git status --porcelain | xargs | sed '/^$/d' | wc -l) -gt 0 ];
|
||||
then
|
||||
echo "[*] Repository has changed, committing changes"
|
||||
git commit \
|
||||
--author="$3" \
|
||||
--message="new deploy: $(date --iso-8601=seconds)"
|
||||
fi
|
||||
git checkout $original_branch
|
||||
}
|
||||
|
||||
|
||||
# $1: Pages API secret
|
||||
# $2: Deployment target branch
|
||||
push() {
|
||||
if (( "$#" < 2 ))
|
||||
then
|
||||
help
|
||||
else
|
||||
git -c core.sshCommand="/usr/bin/ssh -oStrictHostKeyChecking=no -i $SSH_ID_FILE"\
|
||||
push --force $SSH_REMOTE_NAME $2
|
||||
curl -vv --location --request \
|
||||
POST "https://deploy.batsense.net/api/v1/update"\
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw "{ \"secret\": \"$1\", \"branch\": \"$2\" }"
|
||||
fi
|
||||
}
|
||||
|
||||
if (( "$#" < 1 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
if match_arg $1 '-i' '--init'
|
||||
then
|
||||
if (( "$#" < 2 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
set_ssh_remote
|
||||
write_ssh "$2"
|
||||
elif match_arg $1 '-c' '--clean'
|
||||
then
|
||||
clean
|
||||
elif match_arg $1 '-p' '--push'
|
||||
then
|
||||
if (( "$#" < 3 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
push $2 $3
|
||||
elif match_arg $1 '-d' '--deploy'
|
||||
then
|
||||
check_arg $2
|
||||
check_arg $3
|
||||
check_arg $4
|
||||
deploy $2 $3 $4
|
||||
elif match_arg $1 '-h' '--help'
|
||||
then
|
||||
help
|
||||
else
|
||||
help
|
||||
fi
|
|
@ -1 +0,0 @@
|
|||
import 'whatwg-fetch';
|
|
@ -1,8 +0,0 @@
|
|||
module.exports = {
|
||||
entry: {
|
||||
web: __dirname + "/src/index.ts",
|
||||
},
|
||||
output: {
|
||||
path: __dirname + "/dist",
|
||||
},
|
||||
};
|
|
@ -1,87 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import Forgejo from "./index";
|
||||
import authtoken from "../tmp/user1-accesstoken.json";
|
||||
|
||||
const forgeoUrl = authtoken["forgejo_url"];
|
||||
const token = authtoken["sha1"];
|
||||
const username = authtoken["login"];
|
||||
const repo = authtoken["repo"];
|
||||
const api = new Forgejo(forgeoUrl);
|
||||
|
||||
test("use authentication without setting it ", async () => {
|
||||
await api.setTokenAuth(token);
|
||||
expect(api.getTokenAuth().getToken()).toBe(token);
|
||||
let headers = api.getTokenAuthHeader();
|
||||
expect(headers.Authorization).toBe(`token ${token}`);
|
||||
});
|
||||
|
||||
test("verify /user API ", async () => {
|
||||
let user = await api.getUser();
|
||||
expect(user["login"]).toBe(username);
|
||||
});
|
||||
|
||||
test("notifications API ", async () => {
|
||||
let notifications = await api.getNotifications();
|
||||
expect(notifications.length).toBe(5);
|
||||
expect(await api.getNumUnreadNotifications()).toBe(5);
|
||||
|
||||
let notification = await api.getNotificationThread(notifications[0].id);
|
||||
expect(notification).toEqual(notifications[0]);
|
||||
});
|
||||
|
||||
test("issue API ", async () => {
|
||||
let notifications = await api.getNotifications();
|
||||
let issue = await api.getIssue(username, repo, 1);
|
||||
let notification = notifications.find((n) => {
|
||||
if (n.subject.html_url == issue.html_url) {
|
||||
return n;
|
||||
}
|
||||
});
|
||||
expect(notification.subject.type).toEqual("Issue");
|
||||
expect(issue.title).toEqual(notification.subject.title);
|
||||
expect(issue.lazy_comments_data).toBeUndefined();
|
||||
expect(issue.created_at instanceof Date).toBe(true);
|
||||
expect(issue.updated_at instanceof Date).toBe(true);
|
||||
if (issue.closed_at) {
|
||||
// TODO: add issue closing functionality in integration/forgejo.py and verify this
|
||||
expect(issue.closed_at instanceof Date).toBe(true);
|
||||
}
|
||||
// expect(typeof(issue.created_at)).toBe('Date');
|
||||
});
|
||||
|
||||
test("comments API ", async () => {
|
||||
let notifications = await api.getNotifications();
|
||||
let issue = await api.getIssue(username, repo, 1);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(issue.lazy_comments_data.length).toBe(2);
|
||||
|
||||
issue.lazy_comments_data?.forEach((comment) => {
|
||||
expect(comment.created_at instanceof Date).toBe(true);
|
||||
expect(comment.updated_at instanceof Date).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test("mentions in issue", async () => {
|
||||
let issue = await api.getIssue(username, repo, 1);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(true);
|
||||
|
||||
issue = await api.getIssue(username, repo, 2);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(true);
|
||||
|
||||
issue = await api.getIssue(username, repo, 3);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(true);
|
||||
|
||||
issue = await api.getIssue(username, repo, 4);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(true);
|
||||
|
||||
issue = await api.getIssue(username, repo, 5);
|
||||
issue = await api.getCommentsForIssue(issue);
|
||||
expect(await api.findMentionsInIssue(issue)).toBe(false);
|
||||
});
|
16
src/auth.ts
16
src/auth.ts
|
@ -1,16 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
class Auth {
|
||||
token: string;
|
||||
constructor(token: string) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
getToken(): string {
|
||||
return this.token;
|
||||
}
|
||||
}
|
||||
|
||||
export default Auth;
|
258
src/index.ts
258
src/index.ts
|
@ -1,258 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import Auth from "./auth";
|
||||
import User from "./spec/user";
|
||||
import Notification from "./spec/notification";
|
||||
import Issue from "./spec/issue";
|
||||
import Repository from "./spec/repository";
|
||||
import Comment from "./spec/comments";
|
||||
|
||||
class Forgejo {
|
||||
url: URL;
|
||||
username: string;
|
||||
token?: Auth;
|
||||
cors: boolean;
|
||||
/**
|
||||
* Represents a Forgejo instance.
|
||||
* @constructor
|
||||
* @param {string} url - The URL of the Forgejo instance
|
||||
*/
|
||||
constructor(url: string) {
|
||||
this.url = new URL(url);
|
||||
this.cors = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate with token
|
||||
* @param {Auth} token - access token
|
||||
*/
|
||||
async setTokenAuth(token: string) {
|
||||
this.token = new Auth(token);
|
||||
let res = await this.getUser();
|
||||
this.username = res.username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get access token
|
||||
*/
|
||||
getTokenAuth(): Auth {
|
||||
if (this.token) {
|
||||
return this.token;
|
||||
} else {
|
||||
throw new Error("set authentication token before use");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get access token in header format for the fetch API
|
||||
*/
|
||||
getTokenAuthHeader() {
|
||||
return { Authorization: `token ${this.getTokenAuth().getToken()}` };
|
||||
}
|
||||
|
||||
getUrl(): URL {
|
||||
if (this.cors) {
|
||||
let url = new URL("http://localhost:3030");
|
||||
url.pathname = this.url.toString();
|
||||
return url;
|
||||
}
|
||||
return this.url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logged in user
|
||||
*/
|
||||
async getUser(): Promise<User> {
|
||||
this.url.pathname = "/api/v1/user";
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
setCors() {
|
||||
this.cors = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all notifications
|
||||
*/
|
||||
async getNotifications(): Promise<Array<Notification>> {
|
||||
this.url.pathname = "/api/v1/notifications";
|
||||
console.log(this.url);
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
|
||||
return await res.json();
|
||||
}
|
||||
/**
|
||||
* Get number of unread notifications
|
||||
*/
|
||||
async getNumUnreadNotifications(): Promise<number> {
|
||||
this.url.pathname = "/api/v1/notifications/new";
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
|
||||
let data = await res.json();
|
||||
return data["new"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Notification Thread
|
||||
* @param {number} id - The ID of a notification thread
|
||||
*/
|
||||
async getNotificationThread(id: number): Promise<Notification> {
|
||||
this.url.pathname = `/api/v1/notifications/threads/${id}`;
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time at which the issue was last read
|
||||
*/
|
||||
lastReadTime(issue: Issue): Date {
|
||||
return new Date("01/01/01"); // TODO: return last read time from storage. If unread, return 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if logged in user is mentioned in the issue
|
||||
*/
|
||||
async findMentionsInIssue(issue: Issue) {
|
||||
let unreadTime = this.lastReadTime(issue);
|
||||
|
||||
const mentionUtil = (str: string): boolean => {
|
||||
return str.includes(this.username);
|
||||
};
|
||||
|
||||
const items = [];
|
||||
|
||||
if (new Date(issue.created_at) > unreadTime) {
|
||||
items.push(issue.title);
|
||||
items.push(issue.body);
|
||||
}
|
||||
|
||||
issue.lazy_comments_data.forEach((comment) => {
|
||||
if (comment.created_at > unreadTime) {
|
||||
items.push(comment.body);
|
||||
return;
|
||||
}
|
||||
if (comment.updated_at) {
|
||||
if (comment.updated_at > unreadTime) {
|
||||
items.push(comment.body);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let mention = false;
|
||||
items.forEach((item) => {
|
||||
if (mentionUtil(item)) {
|
||||
mention = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
return mention;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark Notification Read
|
||||
* @param {number} id - The ID of a notification thread
|
||||
*/
|
||||
async markNotificationRead(id: number) {
|
||||
this.url.pathname = `/api/v1/notifications/threads/${id}`;
|
||||
await fetch(this.url, { method: "PATCH" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark Notification Read for a specific repository
|
||||
* @param {string} owner - Name of the owner of the repository
|
||||
* @param {string} repo - Name of the repository
|
||||
*/
|
||||
async markNotificationReadForRepo(owner: string, repo: string) {
|
||||
this.url.pathname = `/api/v1/repos/${owner}/${repo}/notifications`;
|
||||
await fetch(this.url, { method: "PUT" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Issue and its comments
|
||||
* @param {str} owner - The owner of the repository
|
||||
* @param {str} repo - The name of the repository
|
||||
* @param {number} id - The ID of an issue
|
||||
*/
|
||||
async getIssue(owner: string, repo: string, id: number): Promise<Issue> {
|
||||
this.url.pathname = `/api/v1/repos/${owner}/${repo}/issues/${id}`;
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
let issue = await res.json();
|
||||
|
||||
if (typeof issue.created_at === "string") {
|
||||
issue.created_at = new Date(issue.created_at);
|
||||
}
|
||||
|
||||
if (issue.updated_at) {
|
||||
if (typeof issue.updated_at === "string") {
|
||||
issue.updated_at = new Date(issue.updated_at);
|
||||
}
|
||||
}
|
||||
|
||||
if (issue.closed_at) {
|
||||
if (typeof issue.closed_at === "string") {
|
||||
issue.closed_at = new Date(issue.closed_at);
|
||||
}
|
||||
}
|
||||
|
||||
return issue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and save comments for the issue objects
|
||||
*/
|
||||
async getCommentsForIssue(issue: Issue): Promise<Issue> {
|
||||
// TODO: check if issue.number != issue.id causes problems. I'm assuming
|
||||
// Issue.number is the local repository issue ID and issue.id is DB ID
|
||||
this.url.pathname = `/api/v1/repos/${issue.repository.owner}/${issue.repository.name}/issues/${issue.number}/comments`;
|
||||
let res = await fetch(this.getUrl(), {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
let c: Array<Comment> = await res.json();
|
||||
|
||||
c = c.map((comment) => {
|
||||
if (typeof comment.created_at === "string") {
|
||||
comment.created_at = new Date(comment.created_at);
|
||||
}
|
||||
|
||||
if (comment.updated_at) {
|
||||
if (typeof comment.updated_at === "string") {
|
||||
comment.updated_at = new Date(comment.updated_at);
|
||||
}
|
||||
}
|
||||
return comment;
|
||||
});
|
||||
|
||||
issue.lazy_comments_data = c;
|
||||
|
||||
return issue;
|
||||
}
|
||||
}
|
||||
|
||||
export default Forgejo;
|
||||
//export { Notification, Issue, Repository, Comment, User };
|
|
@ -1,21 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import User from "./user";
|
||||
|
||||
/**
|
||||
* Subset schema of comment object returned by Forgejo REST API
|
||||
*/
|
||||
type Comment = {
|
||||
id: number;
|
||||
html_url: URL;
|
||||
pull_request_url?: URL;
|
||||
issue_url?: URL;
|
||||
user: User;
|
||||
body: string;
|
||||
created_at: string | Date;
|
||||
updated_at: string | Date;
|
||||
};
|
||||
|
||||
export default Comment;
|
|
@ -1,39 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import User from "./user";
|
||||
import Comment from "./comments";
|
||||
|
||||
/**
|
||||
* Subset schema of issue object returned by Forgejo REST API
|
||||
*/
|
||||
type Issue = {
|
||||
id: number;
|
||||
url: URL;
|
||||
html_url: URL;
|
||||
number: 1;
|
||||
user: User;
|
||||
title: string;
|
||||
body: string;
|
||||
assignee?: User;
|
||||
assignees?: Array<User>;
|
||||
state: string;
|
||||
is_locked: boolean;
|
||||
comments: number;
|
||||
created_at: string | Date;
|
||||
updated_at: string | Date;
|
||||
closed_at?: string | Date;
|
||||
due_date?: string;
|
||||
repository: MiniRepository;
|
||||
lazy_comments_data?: Array<Comment>;
|
||||
};
|
||||
|
||||
type MiniRepository = {
|
||||
id: number;
|
||||
name: string;
|
||||
owner: string;
|
||||
full_name: string;
|
||||
};
|
||||
|
||||
export default Issue;
|
|
@ -1,28 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import Repository from "./repository";
|
||||
|
||||
type Subject = {
|
||||
title: string;
|
||||
url: URL;
|
||||
html_url: URL;
|
||||
latest_comment_url: string;
|
||||
type: string; // Issue
|
||||
state: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Subset schema of notification object returned by Forgejo REST API
|
||||
*/
|
||||
type Notification = {
|
||||
id: number;
|
||||
repository: Repository;
|
||||
subject: Subject;
|
||||
unread: boolean;
|
||||
pinned: boolean;
|
||||
url: URL;
|
||||
};
|
||||
|
||||
export default Notification;
|
|
@ -1,18 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import User from "./user";
|
||||
|
||||
/**
|
||||
* Subset schema of repository object returned by Forgejo REST API
|
||||
*/
|
||||
type Repository = {
|
||||
id: number;
|
||||
name: string;
|
||||
full_name: string;
|
||||
html_url: string;
|
||||
owner: User;
|
||||
};
|
||||
|
||||
export default Repository;
|
|
@ -1,16 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/** Subset schema of user object returned by Forgejo REST API. */
|
||||
type User = {
|
||||
id: number;
|
||||
login: string;
|
||||
username: string;
|
||||
email: string;
|
||||
avatar_url: URL;
|
||||
full_name: string;
|
||||
html_url: string;
|
||||
};
|
||||
|
||||
export default User;
|
Loading…
Reference in a new issue