diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 000000000..e15770ec5
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,3 @@
+- [ ] I agree to license my contribution under AGPL-3.0-only with my contribution automatically being licensed under LGPL-3.0 additionally after 6 months
+
+***
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 619bb9c3e..77d24bcd0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -13,8 +13,10 @@ jobs:
steps:
# Initialization
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 18
- run: npm install
- name: Run Tests
timeout-minutes: 5
diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml
index fab273be4..02902c195 100644
--- a/.github/workflows/eslint.yml
+++ b/.github/workflows/eslint.yml
@@ -13,8 +13,10 @@ jobs:
steps:
# Initialization
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 18
- run: npm install
- name: Run Tests
timeout-minutes: 5
diff --git a/.github/workflows/generate-sqlite-base.yml b/.github/workflows/generate-sqlite-base.yml
index c320e58dc..f4bcf0602 100644
--- a/.github/workflows/generate-sqlite-base.yml
+++ b/.github/workflows/generate-sqlite-base.yml
@@ -14,8 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 18
- run: npm install
- name: Set config
run: |
@@ -23,7 +25,7 @@ jobs:
- name: Run Server
timeout-minutes: 10
run: npm start
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v3
with:
name: SponsorTimesDB.db
path: databases/sponsorTimes.db
diff --git a/.github/workflows/postgres-redis-ci.yml b/.github/workflows/postgres-redis-ci.yml
index 6bf05b089..6963ab59e 100644
--- a/.github/workflows/postgres-redis-ci.yml
+++ b/.github/workflows/postgres-redis-ci.yml
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Build the docker-compose stack
env:
PG_USER: ci_db_user
@@ -20,7 +20,9 @@ jobs:
run: docker-compose -f docker/docker-compose-ci.yml up -d
- name: Check running containers
run: docker ps
- - uses: actions/setup-node@v2
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 18
- run: npm install
- name: Run Tests
env:
diff --git a/Dockerfile b/Dockerfile
index 26b77cb76..c632414b8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,16 +1,16 @@
-FROM node:16-alpine as builder
+FROM node:18-alpine as builder
RUN apk add --no-cache --virtual .build-deps python3 make g++
COPY package.json package-lock.json tsconfig.json entrypoint.sh ./
COPY src src
RUN npm ci && npm run tsc
-FROM node:16-alpine as app
+FROM node:18-alpine as app
WORKDIR /usr/src/app
-RUN apk add git postgresql-client
+RUN apk add --no-cache git postgresql-client
COPY --from=builder ./node_modules ./node_modules
COPY --from=builder ./dist ./dist
COPY ./.git ./.git
COPY entrypoint.sh .
COPY databases/*.sql databases/
EXPOSE 8080
-CMD ./entrypoint.sh
\ No newline at end of file
+CMD ./entrypoint.sh
diff --git a/LICENSE b/LICENSE
index 16c4d7f3c..be3f7b28e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,21 +1,661 @@
-MIT License
-
-Copyright (c) 2019 Ajay Ramachandran
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ 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.
+
+
+ Copyright (C)
+
+ 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 .
+
+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
+.
diff --git a/LICENSE.old b/LICENSE.old
new file mode 100644
index 000000000..649826216
--- /dev/null
+++ b/LICENSE.old
@@ -0,0 +1,27 @@
+License for code prior to commit d738e89f203e9cea21b7df4acb9f4b3505f0acdd
+
+You must follow LICENSE instead if you want to use any newer version.
+
+----
+
+MIT License
+
+Copyright (c) 2019 Ajay Ramachandran
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.MD b/README.MD
index 4be6058ec..c2f9564d5 100644
--- a/README.MD
+++ b/README.MD
@@ -35,3 +35,7 @@ If you want to make changes, run `npm run dev` to automatically reload the serve
# API Docs
Available [here](https://wiki.sponsor.ajay.app/index.php/API_Docs)
+
+# License
+
+This is licensed under AGPL-3.0-only.
\ No newline at end of file
diff --git a/ci.json b/ci.json
index 5a3ee2fb4..1637b41e4 100644
--- a/ci.json
+++ b/ci.json
@@ -76,5 +76,6 @@
"clientSecret": "testClientSecret",
"redirectUri": "http://127.0.0.1/fake/callback"
},
- "minReputationToSubmitFiller": -1
+ "minReputationToSubmitFiller": -1,
+ "minUserIDLength": 0
}
diff --git a/config.json.example b/config.json.example
index 2445ba95a..7adefc219 100644
--- a/config.json.example
+++ b/config.json.example
@@ -66,5 +66,6 @@
{
"name": "vipUsers"
}]
- }
+ },
+ "minUserIDLength": 30 // minimum length of UserID to be accepted
}
diff --git a/entrypoint.sh b/entrypoint.sh
index 9b73c6b78..661b68b06 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -4,9 +4,9 @@ echo 'Entrypoint script'
cd /usr/src/app
# blank config, use defaults
-cat < config.json
+test -e config.json || cat < config.json
{
}
EOF
-node dist/src/index.js
\ No newline at end of file
+node dist/src/index.js
diff --git a/package-lock.json b/package-lock.json
index a03b338ec..8ab460a0c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7,45 +7,45 @@
"": {
"name": "sponsor_block_server",
"version": "0.1.0",
- "license": "MIT",
+ "license": "AGPL-3.0-only",
"dependencies": {
- "axios": "^0.27.2",
- "better-sqlite3": "^7.6.0",
- "cron": "^2.0.0",
- "express": "^4.18.1",
+ "axios": "^1.1.3",
+ "better-sqlite3": "^8.0.1",
+ "cron": "^2.1.0",
+ "express": "^4.18.2",
"express-promise-router": "^4.1.1",
- "express-rate-limit": "^6.4.0",
+ "express-rate-limit": "^6.7.0",
"form-data": "^4.0.0",
"lodash": "^4.17.21",
- "pg": "^8.7.3",
+ "pg": "^8.8.0",
"rate-limit-redis": "^3.0.1",
- "redis": "^4.2.0",
+ "redis": "^4.5.0",
"sync-mysql": "^3.0.1"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
- "@types/better-sqlite3": "^7.5.0",
+ "@types/better-sqlite3": "^7.6.2",
"@types/cron": "^2.0.0",
- "@types/express": "^4.17.13",
- "@types/lodash": "^4.14.182",
- "@types/mocha": "^9.1.1",
- "@types/node": "^18.0.3",
+ "@types/express": "^4.17.14",
+ "@types/lodash": "^4.14.189",
+ "@types/mocha": "^10.0.0",
+ "@types/node": "^18.11.9",
"@types/pg": "^8.6.5",
"@types/sinon": "^10.0.13",
- "@typescript-eslint/eslint-plugin": "^5.30.6",
- "@typescript-eslint/parser": "^5.30.6",
+ "@typescript-eslint/eslint-plugin": "^5.44.0",
+ "@typescript-eslint/parser": "^5.44.0",
"axios-mock-adapter": "^1.21.2",
- "eslint": "^8.19.0",
- "mocha": "^10.0.0",
- "nodemon": "^2.0.19",
+ "eslint": "^8.28.0",
+ "mocha": "^10.1.0",
+ "nodemon": "^2.0.20",
"nyc": "^15.1.0",
- "sinon": "^14.0.0",
+ "sinon": "^14.0.2",
"ts-mock-imports": "^1.3.8",
- "ts-node": "^10.8.2",
- "typescript": "^4.7.4"
+ "ts-node": "^10.9.1",
+ "typescript": "^4.9.3"
},
"engines": {
- "node": ">=16"
+ "node": ">=18"
}
},
"node_modules/@ampproject/remapping": {
@@ -474,14 +474,14 @@
}
},
"node_modules/@eslint/eslintrc": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz",
- "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==",
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
+ "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
- "espree": "^9.3.2",
+ "espree": "^9.4.0",
"globals": "^13.15.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
@@ -491,34 +491,38 @@
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
- }
- },
- "node_modules/@eslint/eslintrc/node_modules/minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
- "dev": true,
- "dependencies": {
- "brace-expansion": "^1.1.7"
},
- "engines": {
- "node": "*"
+ "funding": {
+ "url": "https://opencollective.com/eslint"
}
},
"node_modules/@humanwhocodes/config-array": {
- "version": "0.9.5",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz",
- "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==",
+ "version": "0.11.7",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz",
+ "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==",
"dev": true,
"dependencies": {
"@humanwhocodes/object-schema": "^1.2.1",
"debug": "^4.1.1",
- "minimatch": "^3.0.4"
+ "minimatch": "^3.0.5"
},
"engines": {
"node": ">=10.10.0"
}
},
+ "node_modules/@humanwhocodes/module-importer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
+ "dev": true,
+ "engines": {
+ "node": ">=12.22"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
"node_modules/@humanwhocodes/object-schema": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
@@ -740,20 +744,20 @@
}
},
"node_modules/@redis/bloom": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.0.2.tgz",
- "integrity": "sha512-EBw7Ag1hPgFzdznK2PBblc1kdlj5B5Cw3XwI9/oG7tSn85/HKy3X9xHy/8tm/eNXJYHLXHJL/pkwBpFMVVefkw==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.1.0.tgz",
+ "integrity": "sha512-9QovlxmpRtvxVbN0UBcv8WfdSMudNZZTFqCsnBszcQXqaZb/TVe30ScgGEO7u1EAIacTPAo7/oCYjYAxiHLanQ==",
"peerDependencies": {
"@redis/client": "^1.0.0"
}
},
"node_modules/@redis/client": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.2.0.tgz",
- "integrity": "sha512-a8Nlw5fv2EIAFJxTDSSDVUT7yfBGpZO96ybZXzQpgkyLg/dxtQ1uiwTc0EGfzg1mrPjZokeBSEGTbGXekqTNOg==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.4.0.tgz",
+ "integrity": "sha512-1gEj1AkyXPlkcC/9/T5xpDcQF8ntERURjLBgEWMTdUZqe181zfI9BY3jc2OzjTLkvZh5GV7VT4ktoJG2fV2ufw==",
"dependencies": {
- "cluster-key-slot": "1.1.0",
- "generic-pool": "3.8.2",
+ "cluster-key-slot": "1.1.1",
+ "generic-pool": "3.9.0",
"yallist": "4.0.0"
},
"engines": {
@@ -761,41 +765,41 @@
}
},
"node_modules/@redis/graph": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/@redis/graph/-/graph-1.0.1.tgz",
- "integrity": "sha512-oDE4myMCJOCVKYMygEMWuriBgqlS5FqdWerikMoJxzmmTUErnTRRgmIDa2VcgytACZMFqpAOWDzops4DOlnkfQ==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@redis/graph/-/graph-1.1.0.tgz",
+ "integrity": "sha512-16yZWngxyXPd+MJxeSr0dqh2AIOi8j9yXKcKCwVaKDbH3HTuETpDVPcLujhFYVPtYrngSco31BUcSa9TH31Gqg==",
"peerDependencies": {
"@redis/client": "^1.0.0"
}
},
"node_modules/@redis/json": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/@redis/json/-/json-1.0.3.tgz",
- "integrity": "sha512-4X0Qv0BzD9Zlb0edkUoau5c1bInWSICqXAGrpwEltkncUwcxJIGEcVryZhLgb0p/3PkKaLIWkjhHRtLe9yiA7Q==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@redis/json/-/json-1.0.4.tgz",
+ "integrity": "sha512-LUZE2Gdrhg0Rx7AN+cZkb1e6HjoSKaeeW8rYnt89Tly13GBI5eP4CwDVr+MY8BAYfCg4/N15OUrtLoona9uSgw==",
"peerDependencies": {
"@redis/client": "^1.0.0"
}
},
"node_modules/@redis/search": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/@redis/search/-/search-1.0.6.tgz",
- "integrity": "sha512-pP+ZQRis5P21SD6fjyCeLcQdps+LuTzp2wdUbzxEmNhleighDDTD5ck8+cYof+WLec4csZX7ks+BuoMw0RaZrA==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@redis/search/-/search-1.1.0.tgz",
+ "integrity": "sha512-NyFZEVnxIJEybpy+YskjgOJRNsfTYqaPbK/Buv6W2kmFNaRk85JiqjJZA5QkRmWvGbyQYwoO5QfDi2wHskKrQQ==",
"peerDependencies": {
"@redis/client": "^1.0.0"
}
},
"node_modules/@redis/time-series": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.0.3.tgz",
- "integrity": "sha512-OFp0q4SGrTH0Mruf6oFsHGea58u8vS/iI5+NpYdicaM+7BgqBZH8FFvNZ8rYYLrUO/QRqMq72NpXmxLVNcdmjA==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.0.4.tgz",
+ "integrity": "sha512-ThUIgo2U/g7cCuZavucQTQzA9g9JbDDY2f64u3AbAoz/8vE2lt2U37LamDUVChhaDA3IRT9R6VvJwqnUfTJzng==",
"peerDependencies": {
"@redis/client": "^1.0.0"
}
},
"node_modules/@sinonjs/commons": {
- "version": "1.8.3",
- "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz",
- "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz",
+ "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==",
"dev": true,
"dependencies": {
"type-detect": "4.0.8"
@@ -810,21 +814,30 @@
"@sinonjs/commons": "^1.7.0"
}
},
+ "node_modules/@sinonjs/fake-timers/node_modules/@sinonjs/commons": {
+ "version": "1.8.5",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.5.tgz",
+ "integrity": "sha512-rTpCA0wG1wUxglBSFdMMY0oTrKYvgf4fNgv/sXbfCVAdf+FnPBdKJR/7XbpTCwbCrvCbdPYnlWaUUYz4V2fPDA==",
+ "dev": true,
+ "dependencies": {
+ "type-detect": "4.0.8"
+ }
+ },
"node_modules/@sinonjs/samsam": {
- "version": "6.1.1",
- "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.1.tgz",
- "integrity": "sha512-cZ7rKJTLiE7u7Wi/v9Hc2fs3Ucc3jrWeMgPHbbTCeVAB2S0wOBbYlkJVeNSL04i7fdhT8wIbDq1zhC/PXTD2SA==",
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-7.0.1.tgz",
+ "integrity": "sha512-zsAk2Jkiq89mhZovB2LLOdTCxJF4hqqTToGP0ASWlhp4I1hqOjcfmZGafXntCN7MDC6yySH0mFHrYtHceOeLmw==",
"dev": true,
"dependencies": {
- "@sinonjs/commons": "^1.6.0",
+ "@sinonjs/commons": "^2.0.0",
"lodash.get": "^4.4.2",
"type-detect": "^4.0.8"
}
},
"node_modules/@sinonjs/text-encoding": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
- "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz",
+ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
"dev": true
},
"node_modules/@tsconfig/node10": {
@@ -852,9 +865,9 @@
"dev": true
},
"node_modules/@types/better-sqlite3": {
- "version": "7.5.0",
- "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.5.0.tgz",
- "integrity": "sha512-G9ZbMjydW2yj1AgiPlUtdgF3a1qNpLJLudc9ynJCeJByS3XFWpmT9LT+VSHrKHFbxb31CvtYwetLTOvG9zdxdg==",
+ "version": "7.6.2",
+ "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.2.tgz",
+ "integrity": "sha512-RgmaapusqTq6IMAr4McMyAsC6RshYTCjXCnzwVV59WctUxC8bNPyUfT9t5F81lKcU41lLurhjqjoMHfauzfqGg==",
"dev": true,
"dependencies": {
"@types/node": "*"
@@ -890,9 +903,9 @@
}
},
"node_modules/@types/express": {
- "version": "4.17.13",
- "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
- "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==",
+ "version": "4.17.14",
+ "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz",
+ "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==",
"devOptional": true,
"dependencies": {
"@types/body-parser": "*",
@@ -919,9 +932,9 @@
"dev": true
},
"node_modules/@types/lodash": {
- "version": "4.14.182",
- "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz",
- "integrity": "sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==",
+ "version": "4.14.189",
+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.189.tgz",
+ "integrity": "sha512-kb9/98N6X8gyME9Cf7YaqIMvYGnBSWqEci6tiettE6iJWH1XdJz/PO8LB0GtLCG7x8dU3KWhZT+lA1a35127tA==",
"dev": true
},
"node_modules/@types/luxon": {
@@ -937,15 +950,15 @@
"devOptional": true
},
"node_modules/@types/mocha": {
- "version": "9.1.1",
- "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz",
- "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==",
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.0.tgz",
+ "integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==",
"dev": true
},
"node_modules/@types/node": {
- "version": "18.0.3",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.3.tgz",
- "integrity": "sha512-HzNRZtp4eepNitP+BD6k2L6DROIDG4Q0fm4x+dwfsr6LGmROENnok75VGw40628xf+iR24WeMFcHuuBDUAzzsQ==",
+ "version": "18.11.9",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
+ "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
"devOptional": true
},
"node_modules/@types/pg": {
@@ -971,6 +984,12 @@
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
"devOptional": true
},
+ "node_modules/@types/semver": {
+ "version": "7.3.13",
+ "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
+ "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==",
+ "dev": true
+ },
"node_modules/@types/serve-static": {
"version": "1.13.10",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz",
@@ -997,17 +1016,17 @@
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.6.tgz",
- "integrity": "sha512-J4zYMIhgrx4MgnZrSDD7sEnQp7FmhKNOaqaOpaoQ/SfdMfRB/0yvK74hTnvH+VQxndZynqs5/Hn4t+2/j9bADg==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.44.0.tgz",
+ "integrity": "sha512-j5ULd7FmmekcyWeArx+i8x7sdRHzAtXTkmDPthE4amxZOWKFK7bomoJ4r7PJ8K7PoMzD16U8MmuZFAonr1ERvw==",
"dev": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "5.30.6",
- "@typescript-eslint/type-utils": "5.30.6",
- "@typescript-eslint/utils": "5.30.6",
+ "@typescript-eslint/scope-manager": "5.44.0",
+ "@typescript-eslint/type-utils": "5.44.0",
+ "@typescript-eslint/utils": "5.44.0",
"debug": "^4.3.4",
- "functional-red-black-tree": "^1.0.1",
"ignore": "^5.2.0",
+ "natural-compare-lite": "^1.4.0",
"regexpp": "^3.2.0",
"semver": "^7.3.7",
"tsutils": "^3.21.0"
@@ -1030,14 +1049,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.30.6.tgz",
- "integrity": "sha512-gfF9lZjT0p2ZSdxO70Xbw8w9sPPJGfAdjK7WikEjB3fcUI/yr9maUVEdqigBjKincUYNKOmf7QBMiTf719kbrA==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.44.0.tgz",
+ "integrity": "sha512-H7LCqbZnKqkkgQHaKLGC6KUjt3pjJDx8ETDqmwncyb6PuoigYajyAwBGz08VU/l86dZWZgI4zm5k2VaKqayYyA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "5.30.6",
- "@typescript-eslint/types": "5.30.6",
- "@typescript-eslint/typescript-estree": "5.30.6",
+ "@typescript-eslint/scope-manager": "5.44.0",
+ "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/typescript-estree": "5.44.0",
"debug": "^4.3.4"
},
"engines": {
@@ -1057,13 +1076,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.6.tgz",
- "integrity": "sha512-Hkq5PhLgtVoW1obkqYH0i4iELctEKixkhWLPTYs55doGUKCASvkjOXOd/pisVeLdO24ZX9D6yymJ/twqpJiG3g==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.44.0.tgz",
+ "integrity": "sha512-2pKml57KusI0LAhgLKae9kwWeITZ7IsZs77YxyNyIVOwQ1kToyXRaJLl+uDEXzMN5hnobKUOo2gKntK9H1YL8g==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.30.6",
- "@typescript-eslint/visitor-keys": "5.30.6"
+ "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/visitor-keys": "5.44.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1074,12 +1093,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.30.6.tgz",
- "integrity": "sha512-GFVVzs2j0QPpM+NTDMXtNmJKlF842lkZKDSanIxf+ArJsGeZUIaeT4jGg+gAgHt7AcQSFwW7htzF/rbAh2jaVA==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.44.0.tgz",
+ "integrity": "sha512-A1u0Yo5wZxkXPQ7/noGkRhV4J9opcymcr31XQtOzcc5nO/IHN2E2TPMECKWYpM3e6olWEM63fq/BaL1wEYnt/w==",
"dev": true,
"dependencies": {
- "@typescript-eslint/utils": "5.30.6",
+ "@typescript-eslint/typescript-estree": "5.44.0",
+ "@typescript-eslint/utils": "5.44.0",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
@@ -1100,9 +1120,9 @@
}
},
"node_modules/@typescript-eslint/types": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.6.tgz",
- "integrity": "sha512-HdnP8HioL1F7CwVmT4RaaMX57RrfqsOMclZc08wGMiDYJBsLGBM7JwXM4cZJmbWLzIR/pXg1kkrBBVpxTOwfUg==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.44.0.tgz",
+ "integrity": "sha512-Tp+zDnHmGk4qKR1l+Y1rBvpjpm5tGXX339eAlRBDg+kgZkz9Bw+pqi4dyseOZMsGuSH69fYfPJCBKBrbPCxYFQ==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1113,13 +1133,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.6.tgz",
- "integrity": "sha512-Z7TgPoeYUm06smfEfYF0RBkpF8csMyVnqQbLYiGgmUSTaSXTP57bt8f0UFXstbGxKIreTwQCujtaH0LY9w9B+A==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.44.0.tgz",
+ "integrity": "sha512-M6Jr+RM7M5zeRj2maSfsZK2660HKAJawv4Ud0xT+yauyvgrsHu276VtXlKDFnEmhG+nVEd0fYZNXGoAgxwDWJw==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.30.6",
- "@typescript-eslint/visitor-keys": "5.30.6",
+ "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/visitor-keys": "5.44.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -1140,17 +1160,19 @@
}
},
"node_modules/@typescript-eslint/utils": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.30.6.tgz",
- "integrity": "sha512-xFBLc/esUbLOJLk9jKv0E9gD/OH966M40aY9jJ8GiqpSkP2xOV908cokJqqhVd85WoIvHVHYXxSFE4cCSDzVvA==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.44.0.tgz",
+ "integrity": "sha512-fMzA8LLQ189gaBjS0MZszw5HBdZgVwxVFShCO3QN+ws3GlPkcy9YuS3U4wkT6su0w+Byjq3mS3uamy9HE4Yfjw==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
- "@typescript-eslint/scope-manager": "5.30.6",
- "@typescript-eslint/types": "5.30.6",
- "@typescript-eslint/typescript-estree": "5.30.6",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.44.0",
+ "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/typescript-estree": "5.44.0",
"eslint-scope": "^5.1.1",
- "eslint-utils": "^3.0.0"
+ "eslint-utils": "^3.0.0",
+ "semver": "^7.3.7"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1164,12 +1186,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.6.tgz",
- "integrity": "sha512-41OiCjdL2mCaSDi2SvYbzFLlqqlm5v1ZW9Ym55wXKL/Rx6OOB1IbuFGo71Fj6Xy90gJDFTlgOS+vbmtGHPTQQA==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.44.0.tgz",
+ "integrity": "sha512-a48tLG8/4m62gPFbJ27FxwCOqPKxsb8KC3HkmYoq2As/4YyjQl1jDbRr1s63+g4FS/iIehjmN3L5UjmKva1HzQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.30.6",
+ "@typescript-eslint/types": "5.44.0",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -1180,12 +1202,6 @@
"url": "https://opencollective.com/typescript-eslint"
}
},
- "node_modules/@ungap/promise-all-settled": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
- "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
- "dev": true
- },
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
@@ -1205,9 +1221,9 @@
}
},
"node_modules/acorn": {
- "version": "8.7.1",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz",
- "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==",
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz",
+ "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==",
"dev": true,
"bin": {
"acorn": "bin/acorn"
@@ -1364,12 +1380,13 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/axios": {
- "version": "0.27.2",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
- "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz",
+ "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==",
"dependencies": {
- "follow-redirects": "^1.14.9",
- "form-data": "^4.0.0"
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
}
},
"node_modules/axios-mock-adapter": {
@@ -1441,9 +1458,9 @@
]
},
"node_modules/better-sqlite3": {
- "version": "7.6.0",
- "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.6.0.tgz",
- "integrity": "sha512-wYckL8S8RHP+KKNsZuJGZ7z/6FFmVgwd0U8jSv6t997C+EFR1yvi8p2WIpTb10jiV5rRA5VtMdgtAZFcAnK3Iw==",
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.0.1.tgz",
+ "integrity": "sha512-JhTZjpyapA1icCEjIZB4TSSgkGdFgpWZA2Wszg7Cf4JwJwKQmbvuNnJBeR+EYG/Z29OXvR4G//Rbg31BW/Z7Yg==",
"hasInstallScript": true,
"dependencies": {
"bindings": "^1.5.0",
@@ -1486,9 +1503,9 @@
}
},
"node_modules/body-parser": {
- "version": "1.20.0",
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz",
- "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==",
+ "version": "1.20.1",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
+ "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
"dependencies": {
"bytes": "3.1.2",
"content-type": "~1.0.4",
@@ -1498,7 +1515,7 @@
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
- "qs": "6.10.3",
+ "qs": "6.11.0",
"raw-body": "2.5.1",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
@@ -1789,9 +1806,9 @@
}
},
"node_modules/cluster-key-slot": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.0.tgz",
- "integrity": "sha512-2Nii8p3RwAPiFwsnZvukotvow2rIHM+yQ6ZcBXGHdniadkYGZYiGmkHJIbZPIV9nfv7m/U1IPMVVcAhoWFeklw==",
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.1.tgz",
+ "integrity": "sha512-rwHwUfXL40Chm1r08yrhU3qpUvdVlgkKNeyeGPOxnW8/SyVDvgRaed/Uz54AqWNaTCAThlj6QAs3TZcKI0xDEw==",
"engines": {
"node": ">=0.10.0"
}
@@ -1944,9 +1961,9 @@
"dev": true
},
"node_modules/cron": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/cron/-/cron-2.0.0.tgz",
- "integrity": "sha512-RPeRunBCFr/WEo7WLp8Jnm45F/ziGJiHVvVQEBSDTSGu6uHW49b2FOP2O14DcXlGJRLhwE7TIoDzHHK4KmlL6g==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cron/-/cron-2.1.0.tgz",
+ "integrity": "sha512-Hq7u3P8y7UWYvsZbSKHHJDVG0VO9O7tp2qljxzTScelcTODBfCme8AIhnZsFwmQ9NchZ3hr2uNr+s3DSms7q6w==",
"dependencies": {
"luxon": "^1.23.x"
}
@@ -2166,13 +2183,15 @@
}
},
"node_modules/eslint": {
- "version": "8.19.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.19.0.tgz",
- "integrity": "sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw==",
+ "version": "8.28.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.28.0.tgz",
+ "integrity": "sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ==",
"dev": true,
"dependencies": {
- "@eslint/eslintrc": "^1.3.0",
- "@humanwhocodes/config-array": "^0.9.2",
+ "@eslint/eslintrc": "^1.3.3",
+ "@humanwhocodes/config-array": "^0.11.6",
+ "@humanwhocodes/module-importer": "^1.0.1",
+ "@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@@ -2182,18 +2201,21 @@
"eslint-scope": "^7.1.1",
"eslint-utils": "^3.0.0",
"eslint-visitor-keys": "^3.3.0",
- "espree": "^9.3.2",
+ "espree": "^9.4.0",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
- "functional-red-black-tree": "^1.0.1",
- "glob-parent": "^6.0.1",
+ "find-up": "^5.0.0",
+ "glob-parent": "^6.0.2",
"globals": "^13.15.0",
+ "grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
+ "is-path-inside": "^3.0.3",
+ "js-sdsl": "^4.1.4",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
@@ -2204,8 +2226,7 @@
"regexpp": "^3.2.0",
"strip-ansi": "^6.0.1",
"strip-json-comments": "^3.1.0",
- "text-table": "^0.2.0",
- "v8-compile-cache": "^2.0.3"
+ "text-table": "^0.2.0"
},
"bin": {
"eslint": "bin/eslint.js"
@@ -2288,30 +2309,21 @@
"node": ">=4.0"
}
},
- "node_modules/eslint/node_modules/minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
- "dev": true,
- "dependencies": {
- "brace-expansion": "^1.1.7"
- },
- "engines": {
- "node": "*"
- }
- },
"node_modules/espree": {
- "version": "9.3.2",
- "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz",
- "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==",
+ "version": "9.4.1",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz",
+ "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==",
"dev": true,
"dependencies": {
- "acorn": "^8.7.1",
+ "acorn": "^8.8.0",
"acorn-jsx": "^5.3.2",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
}
},
"node_modules/esprima": {
@@ -2404,13 +2416,13 @@
}
},
"node_modules/express": {
- "version": "4.18.1",
- "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz",
- "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==",
+ "version": "4.18.2",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
+ "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
- "body-parser": "1.20.0",
+ "body-parser": "1.20.1",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.5.0",
@@ -2429,7 +2441,7 @@
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.7",
- "qs": "6.10.3",
+ "qs": "6.11.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "0.18.0",
@@ -2467,9 +2479,9 @@
}
},
"node_modules/express-rate-limit": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.4.0.tgz",
- "integrity": "sha512-lxQRZI4gi3qAWTf0/Uqsyugsz57h8bd7QyllXBgJvd6DJKokzW7C5DTaNvwzvAQzwHGFaItybfYGhC8gpu0V2A==",
+ "version": "6.7.0",
+ "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.7.0.tgz",
+ "integrity": "sha512-vhwIdRoqcYB/72TK3tRZI+0ttS8Ytrk24GfmsxDXK9o9IhHNO5bXRiXQSExPQ4GbaE5tvIS7j1SGrxsuWs+sGA==",
"engines": {
"node": ">= 12.9.0"
},
@@ -2516,9 +2528,9 @@
"dev": true
},
"node_modules/fast-glob": {
- "version": "3.2.11",
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
- "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
+ "version": "3.2.12",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz",
+ "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==",
"dev": true,
"dependencies": {
"@nodelib/fs.stat": "^2.0.2",
@@ -2795,16 +2807,10 @@
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
- "node_modules/functional-red-black-tree": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
- "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
- "dev": true
- },
"node_modules/generic-pool": {
- "version": "3.8.2",
- "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.8.2.tgz",
- "integrity": "sha512-nGToKy6p3PAbYQ7p1UlWl6vSPwfwU6TMSWK7TTu+WUY4ZjyZQGniGGt2oNVvyNSpyZYSB43zMXVLcBm08MTMkg==",
+ "version": "3.9.0",
+ "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.9.0.tgz",
+ "integrity": "sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==",
"engines": {
"node": ">= 4"
}
@@ -2828,9 +2834,9 @@
}
},
"node_modules/get-intrinsic": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz",
- "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==",
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
+ "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
"dependencies": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
@@ -2895,9 +2901,9 @@
}
},
"node_modules/globals": {
- "version": "13.16.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.16.0.tgz",
- "integrity": "sha512-A1lrQfpNF+McdPOnnFqY3kSN0AFTy485bTi1bkLk4mVPODIUEcSfhHgRqA+QdXPksrSTTztYXx37NFV+GpGk3Q==",
+ "version": "13.18.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
+ "integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@@ -2935,6 +2941,12 @@
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
"dev": true
},
+ "node_modules/grapheme-splitter": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz",
+ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
+ "dev": true
+ },
"node_modules/has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
@@ -3193,6 +3205,15 @@
"node": ">=0.12.0"
}
},
+ "node_modules/is-path-inside": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
+ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/is-plain-obj": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
@@ -3360,6 +3381,16 @@
"node": ">=8"
}
},
+ "node_modules/js-sdsl": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz",
+ "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==",
+ "dev": true,
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/js-sdsl"
+ }
+ },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -3403,9 +3434,9 @@
"dev": true
},
"node_modules/json5": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
- "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz",
+ "integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==",
"dev": true,
"bin": {
"json5": "lib/cli.js"
@@ -3487,9 +3518,9 @@
}
},
"node_modules/luxon": {
- "version": "1.28.0",
- "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.28.0.tgz",
- "integrity": "sha512-TfTiyvZhwBYM/7QdAVDh+7dBTBA29v4ik0Ce9zda3Mnf8on1S5KJI8P2jKFZ8+5C0jhmr0KwJEO/Wdpm0VeWJQ==",
+ "version": "1.28.1",
+ "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.28.1.tgz",
+ "integrity": "sha512-gYHAa180mKrNIUJCbwpmD0aTu9kV0dREDrwNnuyFAsO1Wt0EVYSZelPnJlbj9HplzXX/YWXHFTL45kvZ53M0pw==",
"engines": {
"node": "*"
}
@@ -3609,9 +3640,9 @@
}
},
"node_modules/minimatch": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
@@ -3631,12 +3662,11 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
"node_modules/mocha": {
- "version": "10.0.0",
- "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz",
- "integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==",
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz",
+ "integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==",
"dev": true,
"dependencies": {
- "@ungap/promise-all-settled": "1.1.2",
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
"chokidar": "3.5.3",
@@ -3770,6 +3800,12 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
+ "node_modules/natural-compare-lite": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz",
+ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==",
+ "dev": true
+ },
"node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
@@ -3779,18 +3815,36 @@
}
},
"node_modules/nise": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.1.tgz",
- "integrity": "sha512-yr5kW2THW1AkxVmCnKEh4nbYkJdB3I7LUkiUgOvEkOp414mc2UMaHMA7pjq1nYowhdoJZGwEKGaQVbxfpWj10A==",
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.2.tgz",
+ "integrity": "sha512-+gQjFi8v+tkfCuSCxfURHLhRhniE/+IaYbIphxAN2JRR9SHKhY8hgXpaXiYfHdw+gcGe4buxgbprBQFab9FkhA==",
"dev": true,
"dependencies": {
- "@sinonjs/commons": "^1.8.3",
- "@sinonjs/fake-timers": ">=5",
+ "@sinonjs/commons": "^2.0.0",
+ "@sinonjs/fake-timers": "^7.0.4",
"@sinonjs/text-encoding": "^0.7.1",
"just-extend": "^4.0.2",
"path-to-regexp": "^1.7.0"
}
},
+ "node_modules/nise/node_modules/@sinonjs/fake-timers": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz",
+ "integrity": "sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/commons": "^1.7.0"
+ }
+ },
+ "node_modules/nise/node_modules/@sinonjs/fake-timers/node_modules/@sinonjs/commons": {
+ "version": "1.8.5",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.5.tgz",
+ "integrity": "sha512-rTpCA0wG1wUxglBSFdMMY0oTrKYvgf4fNgv/sXbfCVAdf+FnPBdKJR/7XbpTCwbCrvCbdPYnlWaUUYz4V2fPDA==",
+ "dev": true,
+ "dependencies": {
+ "type-detect": "4.0.8"
+ }
+ },
"node_modules/nise/node_modules/isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
@@ -3836,16 +3890,15 @@
"dev": true
},
"node_modules/nodemon": {
- "version": "2.0.19",
- "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz",
- "integrity": "sha512-4pv1f2bMDj0Eeg/MhGqxrtveeQ5/G/UVe9iO6uTZzjnRluSA4PVWf8CW99LUPwGB3eNIA7zUFoP77YuI7hOc0A==",
+ "version": "2.0.20",
+ "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz",
+ "integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==",
"dev": true,
- "hasInstallScript": true,
"dependencies": {
"chokidar": "^3.5.2",
"debug": "^3.2.7",
"ignore-by-default": "^1.0.1",
- "minimatch": "^3.0.4",
+ "minimatch": "^3.1.2",
"pstree.remy": "^1.1.8",
"semver": "^5.7.1",
"simple-update-notifier": "^1.0.7",
@@ -4313,14 +4366,14 @@
}
},
"node_modules/pg": {
- "version": "8.7.3",
- "resolved": "https://registry.npmjs.org/pg/-/pg-8.7.3.tgz",
- "integrity": "sha512-HPmH4GH4H3AOprDJOazoIcpI49XFsHCe8xlrjHkWiapdbHK+HLtbm/GQzXYAZwmPju/kzKhjaSfMACG+8cgJcw==",
+ "version": "8.8.0",
+ "resolved": "https://registry.npmjs.org/pg/-/pg-8.8.0.tgz",
+ "integrity": "sha512-UXYN0ziKj+AeNNP7VDMwrehpACThH7LUl/p8TDFpEUuSejCUIwGSfxpHsPvtM6/WXFy6SU4E5RG4IJV/TZAGjw==",
"dependencies": {
"buffer-writer": "2.0.0",
"packet-reader": "1.0.0",
"pg-connection-string": "^2.5.0",
- "pg-pool": "^3.5.1",
+ "pg-pool": "^3.5.2",
"pg-protocol": "^1.5.0",
"pg-types": "^2.1.0",
"pgpass": "1.x"
@@ -4329,7 +4382,7 @@
"node": ">= 8.0.0"
},
"peerDependencies": {
- "pg-native": ">=2.0.0"
+ "pg-native": ">=3.0.1"
},
"peerDependenciesMeta": {
"pg-native": {
@@ -4351,9 +4404,9 @@
}
},
"node_modules/pg-pool": {
- "version": "3.5.1",
- "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.5.1.tgz",
- "integrity": "sha512-6iCR0wVrro6OOHFsyavV+i6KYL4lVNyYAB9RD18w66xSzN+d8b66HiwuP30Gp1SH5O9T82fckkzsRjlrhD0ioQ==",
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.5.2.tgz",
+ "integrity": "sha512-His3Fh17Z4eg7oANLob6ZvH8xIVen3phEZh2QuyrIl4dQSDVEabNducv6ysROKpDNPSD+12tONZVWfSgMvDD9w==",
"peerDependencies": {
"pg": ">=8.0"
}
@@ -4574,6 +4627,11 @@
"node": ">= 0.10"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+ },
"node_modules/pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
@@ -4599,9 +4657,9 @@
}
},
"node_modules/qs": {
- "version": "6.10.3",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz",
- "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==",
+ "version": "6.11.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
+ "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"dependencies": {
"side-channel": "^1.0.4"
},
@@ -4722,16 +4780,16 @@
}
},
"node_modules/redis": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/redis/-/redis-4.2.0.tgz",
- "integrity": "sha512-bCR0gKVhIXFg8zCQjXEANzgI01DDixtPZgIUZHBCmwqixnu+MK3Tb2yqGjh+HCLASQVVgApiwhNkv+FoedZOGQ==",
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/redis/-/redis-4.5.0.tgz",
+ "integrity": "sha512-oZGAmOKG+RPnHo0UxM5GGjJ0dBd/Vi4fs3MYwM1p2baDoXC0wpm0yOdpxVS9K+0hM84ycdysp2eHg2xGoQ4FEw==",
"dependencies": {
- "@redis/bloom": "1.0.2",
- "@redis/client": "1.2.0",
- "@redis/graph": "1.0.1",
- "@redis/json": "1.0.3",
- "@redis/search": "1.0.6",
- "@redis/time-series": "1.0.3"
+ "@redis/bloom": "1.1.0",
+ "@redis/client": "1.4.0",
+ "@redis/graph": "1.1.0",
+ "@redis/json": "1.0.4",
+ "@redis/search": "1.1.0",
+ "@redis/time-series": "1.0.4"
}
},
"node_modules/regenerator-runtime": {
@@ -5050,16 +5108,16 @@
}
},
"node_modules/sinon": {
- "version": "14.0.0",
- "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.0.tgz",
- "integrity": "sha512-ugA6BFmE+WrJdh0owRZHToLd32Uw3Lxq6E6LtNRU+xTVBefx632h03Q7apXWRsRdZAJ41LB8aUfn2+O4jsDNMw==",
+ "version": "14.0.2",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.2.tgz",
+ "integrity": "sha512-PDpV0ZI3ZCS3pEqx0vpNp6kzPhHrLx72wA0G+ZLaaJjLIYeE0n8INlgaohKuGy7hP0as5tbUd23QWu5U233t+w==",
"dev": true,
"dependencies": {
- "@sinonjs/commons": "^1.8.3",
+ "@sinonjs/commons": "^2.0.0",
"@sinonjs/fake-timers": "^9.1.2",
- "@sinonjs/samsam": "^6.1.1",
+ "@sinonjs/samsam": "^7.0.1",
"diff": "^5.0.0",
- "nise": "^5.1.1",
+ "nise": "^5.1.2",
"supports-color": "^7.2.0"
},
"funding": {
@@ -5312,9 +5370,9 @@
}
},
"node_modules/ts-node": {
- "version": "10.8.2",
- "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.2.tgz",
- "integrity": "sha512-LYdGnoGddf1D6v8REPtIH+5iq/gTDuZqv2/UJUU7tKjuEU8xVZorBM+buCGNjj+pGEud+sOoM4CX3/YzINpENA==",
+ "version": "10.9.1",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
+ "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
"dev": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
@@ -5455,9 +5513,9 @@
}
},
"node_modules/typescript": {
- "version": "4.7.4",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
- "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
+ "version": "4.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz",
+ "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -5538,12 +5596,6 @@
"uuid": "dist/bin/uuid"
}
},
- "node_modules/v8-compile-cache": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
- "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
- "dev": true
- },
"node_modules/v8-compile-cache-lib": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
@@ -6096,44 +6148,39 @@
}
},
"@eslint/eslintrc": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz",
- "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==",
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
+ "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
- "espree": "^9.3.2",
+ "espree": "^9.4.0",
"globals": "^13.15.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
"js-yaml": "^4.1.0",
"minimatch": "^3.1.2",
"strip-json-comments": "^3.1.1"
- },
- "dependencies": {
- "minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
- "dev": true,
- "requires": {
- "brace-expansion": "^1.1.7"
- }
- }
}
},
"@humanwhocodes/config-array": {
- "version": "0.9.5",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz",
- "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==",
+ "version": "0.11.7",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz",
+ "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==",
"dev": true,
"requires": {
"@humanwhocodes/object-schema": "^1.2.1",
"debug": "^4.1.1",
- "minimatch": "^3.0.4"
+ "minimatch": "^3.0.5"
}
},
+ "@humanwhocodes/module-importer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
+ "dev": true
+ },
"@humanwhocodes/object-schema": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
@@ -6303,49 +6350,49 @@
}
},
"@redis/bloom": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.0.2.tgz",
- "integrity": "sha512-EBw7Ag1hPgFzdznK2PBblc1kdlj5B5Cw3XwI9/oG7tSn85/HKy3X9xHy/8tm/eNXJYHLXHJL/pkwBpFMVVefkw==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.1.0.tgz",
+ "integrity": "sha512-9QovlxmpRtvxVbN0UBcv8WfdSMudNZZTFqCsnBszcQXqaZb/TVe30ScgGEO7u1EAIacTPAo7/oCYjYAxiHLanQ==",
"requires": {}
},
"@redis/client": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.2.0.tgz",
- "integrity": "sha512-a8Nlw5fv2EIAFJxTDSSDVUT7yfBGpZO96ybZXzQpgkyLg/dxtQ1uiwTc0EGfzg1mrPjZokeBSEGTbGXekqTNOg==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.4.0.tgz",
+ "integrity": "sha512-1gEj1AkyXPlkcC/9/T5xpDcQF8ntERURjLBgEWMTdUZqe181zfI9BY3jc2OzjTLkvZh5GV7VT4ktoJG2fV2ufw==",
"requires": {
- "cluster-key-slot": "1.1.0",
- "generic-pool": "3.8.2",
+ "cluster-key-slot": "1.1.1",
+ "generic-pool": "3.9.0",
"yallist": "4.0.0"
}
},
"@redis/graph": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/@redis/graph/-/graph-1.0.1.tgz",
- "integrity": "sha512-oDE4myMCJOCVKYMygEMWuriBgqlS5FqdWerikMoJxzmmTUErnTRRgmIDa2VcgytACZMFqpAOWDzops4DOlnkfQ==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@redis/graph/-/graph-1.1.0.tgz",
+ "integrity": "sha512-16yZWngxyXPd+MJxeSr0dqh2AIOi8j9yXKcKCwVaKDbH3HTuETpDVPcLujhFYVPtYrngSco31BUcSa9TH31Gqg==",
"requires": {}
},
"@redis/json": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/@redis/json/-/json-1.0.3.tgz",
- "integrity": "sha512-4X0Qv0BzD9Zlb0edkUoau5c1bInWSICqXAGrpwEltkncUwcxJIGEcVryZhLgb0p/3PkKaLIWkjhHRtLe9yiA7Q==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@redis/json/-/json-1.0.4.tgz",
+ "integrity": "sha512-LUZE2Gdrhg0Rx7AN+cZkb1e6HjoSKaeeW8rYnt89Tly13GBI5eP4CwDVr+MY8BAYfCg4/N15OUrtLoona9uSgw==",
"requires": {}
},
"@redis/search": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/@redis/search/-/search-1.0.6.tgz",
- "integrity": "sha512-pP+ZQRis5P21SD6fjyCeLcQdps+LuTzp2wdUbzxEmNhleighDDTD5ck8+cYof+WLec4csZX7ks+BuoMw0RaZrA==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@redis/search/-/search-1.1.0.tgz",
+ "integrity": "sha512-NyFZEVnxIJEybpy+YskjgOJRNsfTYqaPbK/Buv6W2kmFNaRk85JiqjJZA5QkRmWvGbyQYwoO5QfDi2wHskKrQQ==",
"requires": {}
},
"@redis/time-series": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.0.3.tgz",
- "integrity": "sha512-OFp0q4SGrTH0Mruf6oFsHGea58u8vS/iI5+NpYdicaM+7BgqBZH8FFvNZ8rYYLrUO/QRqMq72NpXmxLVNcdmjA==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.0.4.tgz",
+ "integrity": "sha512-ThUIgo2U/g7cCuZavucQTQzA9g9JbDDY2f64u3AbAoz/8vE2lt2U37LamDUVChhaDA3IRT9R6VvJwqnUfTJzng==",
"requires": {}
},
"@sinonjs/commons": {
- "version": "1.8.3",
- "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz",
- "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz",
+ "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==",
"dev": true,
"requires": {
"type-detect": "4.0.8"
@@ -6358,23 +6405,34 @@
"dev": true,
"requires": {
"@sinonjs/commons": "^1.7.0"
+ },
+ "dependencies": {
+ "@sinonjs/commons": {
+ "version": "1.8.5",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.5.tgz",
+ "integrity": "sha512-rTpCA0wG1wUxglBSFdMMY0oTrKYvgf4fNgv/sXbfCVAdf+FnPBdKJR/7XbpTCwbCrvCbdPYnlWaUUYz4V2fPDA==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ }
}
},
"@sinonjs/samsam": {
- "version": "6.1.1",
- "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.1.tgz",
- "integrity": "sha512-cZ7rKJTLiE7u7Wi/v9Hc2fs3Ucc3jrWeMgPHbbTCeVAB2S0wOBbYlkJVeNSL04i7fdhT8wIbDq1zhC/PXTD2SA==",
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-7.0.1.tgz",
+ "integrity": "sha512-zsAk2Jkiq89mhZovB2LLOdTCxJF4hqqTToGP0ASWlhp4I1hqOjcfmZGafXntCN7MDC6yySH0mFHrYtHceOeLmw==",
"dev": true,
"requires": {
- "@sinonjs/commons": "^1.6.0",
+ "@sinonjs/commons": "^2.0.0",
"lodash.get": "^4.4.2",
"type-detect": "^4.0.8"
}
},
"@sinonjs/text-encoding": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
- "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz",
+ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
"dev": true
},
"@tsconfig/node10": {
@@ -6402,9 +6460,9 @@
"dev": true
},
"@types/better-sqlite3": {
- "version": "7.5.0",
- "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.5.0.tgz",
- "integrity": "sha512-G9ZbMjydW2yj1AgiPlUtdgF3a1qNpLJLudc9ynJCeJByS3XFWpmT9LT+VSHrKHFbxb31CvtYwetLTOvG9zdxdg==",
+ "version": "7.6.2",
+ "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.2.tgz",
+ "integrity": "sha512-RgmaapusqTq6IMAr4McMyAsC6RshYTCjXCnzwVV59WctUxC8bNPyUfT9t5F81lKcU41lLurhjqjoMHfauzfqGg==",
"dev": true,
"requires": {
"@types/node": "*"
@@ -6440,9 +6498,9 @@
}
},
"@types/express": {
- "version": "4.17.13",
- "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
- "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==",
+ "version": "4.17.14",
+ "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz",
+ "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==",
"devOptional": true,
"requires": {
"@types/body-parser": "*",
@@ -6469,9 +6527,9 @@
"dev": true
},
"@types/lodash": {
- "version": "4.14.182",
- "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz",
- "integrity": "sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==",
+ "version": "4.14.189",
+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.189.tgz",
+ "integrity": "sha512-kb9/98N6X8gyME9Cf7YaqIMvYGnBSWqEci6tiettE6iJWH1XdJz/PO8LB0GtLCG7x8dU3KWhZT+lA1a35127tA==",
"dev": true
},
"@types/luxon": {
@@ -6487,15 +6545,15 @@
"devOptional": true
},
"@types/mocha": {
- "version": "9.1.1",
- "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz",
- "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==",
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.0.tgz",
+ "integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==",
"dev": true
},
"@types/node": {
- "version": "18.0.3",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.3.tgz",
- "integrity": "sha512-HzNRZtp4eepNitP+BD6k2L6DROIDG4Q0fm4x+dwfsr6LGmROENnok75VGw40628xf+iR24WeMFcHuuBDUAzzsQ==",
+ "version": "18.11.9",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
+ "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
"devOptional": true
},
"@types/pg": {
@@ -6521,6 +6579,12 @@
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
"devOptional": true
},
+ "@types/semver": {
+ "version": "7.3.13",
+ "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
+ "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==",
+ "dev": true
+ },
"@types/serve-static": {
"version": "1.13.10",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz",
@@ -6547,69 +6611,70 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.6.tgz",
- "integrity": "sha512-J4zYMIhgrx4MgnZrSDD7sEnQp7FmhKNOaqaOpaoQ/SfdMfRB/0yvK74hTnvH+VQxndZynqs5/Hn4t+2/j9bADg==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.44.0.tgz",
+ "integrity": "sha512-j5ULd7FmmekcyWeArx+i8x7sdRHzAtXTkmDPthE4amxZOWKFK7bomoJ4r7PJ8K7PoMzD16U8MmuZFAonr1ERvw==",
"dev": true,
"requires": {
- "@typescript-eslint/scope-manager": "5.30.6",
- "@typescript-eslint/type-utils": "5.30.6",
- "@typescript-eslint/utils": "5.30.6",
+ "@typescript-eslint/scope-manager": "5.44.0",
+ "@typescript-eslint/type-utils": "5.44.0",
+ "@typescript-eslint/utils": "5.44.0",
"debug": "^4.3.4",
- "functional-red-black-tree": "^1.0.1",
"ignore": "^5.2.0",
+ "natural-compare-lite": "^1.4.0",
"regexpp": "^3.2.0",
"semver": "^7.3.7",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/parser": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.30.6.tgz",
- "integrity": "sha512-gfF9lZjT0p2ZSdxO70Xbw8w9sPPJGfAdjK7WikEjB3fcUI/yr9maUVEdqigBjKincUYNKOmf7QBMiTf719kbrA==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.44.0.tgz",
+ "integrity": "sha512-H7LCqbZnKqkkgQHaKLGC6KUjt3pjJDx8ETDqmwncyb6PuoigYajyAwBGz08VU/l86dZWZgI4zm5k2VaKqayYyA==",
"dev": true,
"requires": {
- "@typescript-eslint/scope-manager": "5.30.6",
- "@typescript-eslint/types": "5.30.6",
- "@typescript-eslint/typescript-estree": "5.30.6",
+ "@typescript-eslint/scope-manager": "5.44.0",
+ "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/typescript-estree": "5.44.0",
"debug": "^4.3.4"
}
},
"@typescript-eslint/scope-manager": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.6.tgz",
- "integrity": "sha512-Hkq5PhLgtVoW1obkqYH0i4iELctEKixkhWLPTYs55doGUKCASvkjOXOd/pisVeLdO24ZX9D6yymJ/twqpJiG3g==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.44.0.tgz",
+ "integrity": "sha512-2pKml57KusI0LAhgLKae9kwWeITZ7IsZs77YxyNyIVOwQ1kToyXRaJLl+uDEXzMN5hnobKUOo2gKntK9H1YL8g==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.30.6",
- "@typescript-eslint/visitor-keys": "5.30.6"
+ "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/visitor-keys": "5.44.0"
}
},
"@typescript-eslint/type-utils": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.30.6.tgz",
- "integrity": "sha512-GFVVzs2j0QPpM+NTDMXtNmJKlF842lkZKDSanIxf+ArJsGeZUIaeT4jGg+gAgHt7AcQSFwW7htzF/rbAh2jaVA==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.44.0.tgz",
+ "integrity": "sha512-A1u0Yo5wZxkXPQ7/noGkRhV4J9opcymcr31XQtOzcc5nO/IHN2E2TPMECKWYpM3e6olWEM63fq/BaL1wEYnt/w==",
"dev": true,
"requires": {
- "@typescript-eslint/utils": "5.30.6",
+ "@typescript-eslint/typescript-estree": "5.44.0",
+ "@typescript-eslint/utils": "5.44.0",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/types": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.6.tgz",
- "integrity": "sha512-HdnP8HioL1F7CwVmT4RaaMX57RrfqsOMclZc08wGMiDYJBsLGBM7JwXM4cZJmbWLzIR/pXg1kkrBBVpxTOwfUg==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.44.0.tgz",
+ "integrity": "sha512-Tp+zDnHmGk4qKR1l+Y1rBvpjpm5tGXX339eAlRBDg+kgZkz9Bw+pqi4dyseOZMsGuSH69fYfPJCBKBrbPCxYFQ==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.6.tgz",
- "integrity": "sha512-Z7TgPoeYUm06smfEfYF0RBkpF8csMyVnqQbLYiGgmUSTaSXTP57bt8f0UFXstbGxKIreTwQCujtaH0LY9w9B+A==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.44.0.tgz",
+ "integrity": "sha512-M6Jr+RM7M5zeRj2maSfsZK2660HKAJawv4Ud0xT+yauyvgrsHu276VtXlKDFnEmhG+nVEd0fYZNXGoAgxwDWJw==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.30.6",
- "@typescript-eslint/visitor-keys": "5.30.6",
+ "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/visitor-keys": "5.44.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -6618,35 +6683,31 @@
}
},
"@typescript-eslint/utils": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.30.6.tgz",
- "integrity": "sha512-xFBLc/esUbLOJLk9jKv0E9gD/OH966M40aY9jJ8GiqpSkP2xOV908cokJqqhVd85WoIvHVHYXxSFE4cCSDzVvA==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.44.0.tgz",
+ "integrity": "sha512-fMzA8LLQ189gaBjS0MZszw5HBdZgVwxVFShCO3QN+ws3GlPkcy9YuS3U4wkT6su0w+Byjq3mS3uamy9HE4Yfjw==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.9",
- "@typescript-eslint/scope-manager": "5.30.6",
- "@typescript-eslint/types": "5.30.6",
- "@typescript-eslint/typescript-estree": "5.30.6",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.44.0",
+ "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/typescript-estree": "5.44.0",
"eslint-scope": "^5.1.1",
- "eslint-utils": "^3.0.0"
+ "eslint-utils": "^3.0.0",
+ "semver": "^7.3.7"
}
},
"@typescript-eslint/visitor-keys": {
- "version": "5.30.6",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.6.tgz",
- "integrity": "sha512-41OiCjdL2mCaSDi2SvYbzFLlqqlm5v1ZW9Ym55wXKL/Rx6OOB1IbuFGo71Fj6Xy90gJDFTlgOS+vbmtGHPTQQA==",
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.44.0.tgz",
+ "integrity": "sha512-a48tLG8/4m62gPFbJ27FxwCOqPKxsb8KC3HkmYoq2As/4YyjQl1jDbRr1s63+g4FS/iIehjmN3L5UjmKva1HzQ==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.30.6",
+ "@typescript-eslint/types": "5.44.0",
"eslint-visitor-keys": "^3.3.0"
}
},
- "@ungap/promise-all-settled": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
- "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
- "dev": true
- },
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
@@ -6663,9 +6724,9 @@
}
},
"acorn": {
- "version": "8.7.1",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz",
- "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==",
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz",
+ "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==",
"dev": true
},
"acorn-jsx": {
@@ -6783,12 +6844,13 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"axios": {
- "version": "0.27.2",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
- "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz",
+ "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==",
"requires": {
- "follow-redirects": "^1.14.9",
- "form-data": "^4.0.0"
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
}
},
"axios-mock-adapter": {
@@ -6845,9 +6907,9 @@
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
},
"better-sqlite3": {
- "version": "7.6.0",
- "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.6.0.tgz",
- "integrity": "sha512-wYckL8S8RHP+KKNsZuJGZ7z/6FFmVgwd0U8jSv6t997C+EFR1yvi8p2WIpTb10jiV5rRA5VtMdgtAZFcAnK3Iw==",
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.0.1.tgz",
+ "integrity": "sha512-JhTZjpyapA1icCEjIZB4TSSgkGdFgpWZA2Wszg7Cf4JwJwKQmbvuNnJBeR+EYG/Z29OXvR4G//Rbg31BW/Z7Yg==",
"requires": {
"bindings": "^1.5.0",
"prebuild-install": "^7.1.0"
@@ -6883,9 +6945,9 @@
}
},
"body-parser": {
- "version": "1.20.0",
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz",
- "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==",
+ "version": "1.20.1",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
+ "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
"requires": {
"bytes": "3.1.2",
"content-type": "~1.0.4",
@@ -6895,7 +6957,7 @@
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
- "qs": "6.10.3",
+ "qs": "6.11.0",
"raw-body": "2.5.1",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
@@ -7095,9 +7157,9 @@
}
},
"cluster-key-slot": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.0.tgz",
- "integrity": "sha512-2Nii8p3RwAPiFwsnZvukotvow2rIHM+yQ6ZcBXGHdniadkYGZYiGmkHJIbZPIV9nfv7m/U1IPMVVcAhoWFeklw=="
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.1.tgz",
+ "integrity": "sha512-rwHwUfXL40Chm1r08yrhU3qpUvdVlgkKNeyeGPOxnW8/SyVDvgRaed/Uz54AqWNaTCAThlj6QAs3TZcKI0xDEw=="
},
"color-convert": {
"version": "2.0.1",
@@ -7217,9 +7279,9 @@
"dev": true
},
"cron": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/cron/-/cron-2.0.0.tgz",
- "integrity": "sha512-RPeRunBCFr/WEo7WLp8Jnm45F/ziGJiHVvVQEBSDTSGu6uHW49b2FOP2O14DcXlGJRLhwE7TIoDzHHK4KmlL6g==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cron/-/cron-2.1.0.tgz",
+ "integrity": "sha512-Hq7u3P8y7UWYvsZbSKHHJDVG0VO9O7tp2qljxzTScelcTODBfCme8AIhnZsFwmQ9NchZ3hr2uNr+s3DSms7q6w==",
"requires": {
"luxon": "^1.23.x"
}
@@ -7376,13 +7438,15 @@
"dev": true
},
"eslint": {
- "version": "8.19.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.19.0.tgz",
- "integrity": "sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw==",
+ "version": "8.28.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.28.0.tgz",
+ "integrity": "sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ==",
"dev": true,
"requires": {
- "@eslint/eslintrc": "^1.3.0",
- "@humanwhocodes/config-array": "^0.9.2",
+ "@eslint/eslintrc": "^1.3.3",
+ "@humanwhocodes/config-array": "^0.11.6",
+ "@humanwhocodes/module-importer": "^1.0.1",
+ "@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@@ -7392,18 +7456,21 @@
"eslint-scope": "^7.1.1",
"eslint-utils": "^3.0.0",
"eslint-visitor-keys": "^3.3.0",
- "espree": "^9.3.2",
+ "espree": "^9.4.0",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
- "functional-red-black-tree": "^1.0.1",
- "glob-parent": "^6.0.1",
+ "find-up": "^5.0.0",
+ "glob-parent": "^6.0.2",
"globals": "^13.15.0",
+ "grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
+ "is-path-inside": "^3.0.3",
+ "js-sdsl": "^4.1.4",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
@@ -7414,8 +7481,7 @@
"regexpp": "^3.2.0",
"strip-ansi": "^6.0.1",
"strip-json-comments": "^3.1.0",
- "text-table": "^0.2.0",
- "v8-compile-cache": "^2.0.3"
+ "text-table": "^0.2.0"
},
"dependencies": {
"eslint-scope": {
@@ -7433,15 +7499,6 @@
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"dev": true
- },
- "minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
- "dev": true,
- "requires": {
- "brace-expansion": "^1.1.7"
- }
}
}
},
@@ -7479,12 +7536,12 @@
"dev": true
},
"espree": {
- "version": "9.3.2",
- "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz",
- "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==",
+ "version": "9.4.1",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz",
+ "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==",
"dev": true,
"requires": {
- "acorn": "^8.7.1",
+ "acorn": "^8.8.0",
"acorn-jsx": "^5.3.2",
"eslint-visitor-keys": "^3.3.0"
}
@@ -7552,13 +7609,13 @@
"integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="
},
"express": {
- "version": "4.18.1",
- "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz",
- "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==",
+ "version": "4.18.2",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
+ "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
"requires": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
- "body-parser": "1.20.0",
+ "body-parser": "1.20.1",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.5.0",
@@ -7577,7 +7634,7 @@
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.7",
- "qs": "6.10.3",
+ "qs": "6.11.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "0.18.0",
@@ -7620,9 +7677,9 @@
}
},
"express-rate-limit": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.4.0.tgz",
- "integrity": "sha512-lxQRZI4gi3qAWTf0/Uqsyugsz57h8bd7QyllXBgJvd6DJKokzW7C5DTaNvwzvAQzwHGFaItybfYGhC8gpu0V2A==",
+ "version": "6.7.0",
+ "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.7.0.tgz",
+ "integrity": "sha512-vhwIdRoqcYB/72TK3tRZI+0ttS8Ytrk24GfmsxDXK9o9IhHNO5bXRiXQSExPQ4GbaE5tvIS7j1SGrxsuWs+sGA==",
"requires": {}
},
"fast-deep-equal": {
@@ -7632,9 +7689,9 @@
"dev": true
},
"fast-glob": {
- "version": "3.2.11",
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
- "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
+ "version": "3.2.12",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz",
+ "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==",
"dev": true,
"requires": {
"@nodelib/fs.stat": "^2.0.2",
@@ -7835,16 +7892,10 @@
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
- "functional-red-black-tree": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
- "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
- "dev": true
- },
"generic-pool": {
- "version": "3.8.2",
- "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.8.2.tgz",
- "integrity": "sha512-nGToKy6p3PAbYQ7p1UlWl6vSPwfwU6TMSWK7TTu+WUY4ZjyZQGniGGt2oNVvyNSpyZYSB43zMXVLcBm08MTMkg=="
+ "version": "3.9.0",
+ "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.9.0.tgz",
+ "integrity": "sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g=="
},
"gensync": {
"version": "1.0.0-beta.2",
@@ -7859,9 +7910,9 @@
"dev": true
},
"get-intrinsic": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz",
- "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==",
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
+ "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
@@ -7908,9 +7959,9 @@
}
},
"globals": {
- "version": "13.16.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.16.0.tgz",
- "integrity": "sha512-A1lrQfpNF+McdPOnnFqY3kSN0AFTy485bTi1bkLk4mVPODIUEcSfhHgRqA+QdXPksrSTTztYXx37NFV+GpGk3Q==",
+ "version": "13.18.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
+ "integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
"dev": true,
"requires": {
"type-fest": "^0.20.2"
@@ -7936,6 +7987,12 @@
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
"dev": true
},
+ "grapheme-splitter": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz",
+ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
+ "dev": true
+ },
"has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
@@ -8105,6 +8162,12 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
+ "is-path-inside": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
+ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
+ "dev": true
+ },
"is-plain-obj": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
@@ -8232,6 +8295,12 @@
"istanbul-lib-report": "^3.0.0"
}
},
+ "js-sdsl": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz",
+ "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==",
+ "dev": true
+ },
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -8266,9 +8335,9 @@
"dev": true
},
"json5": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
- "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz",
+ "integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==",
"dev": true
},
"just-extend": {
@@ -8329,9 +8398,9 @@
}
},
"luxon": {
- "version": "1.28.0",
- "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.28.0.tgz",
- "integrity": "sha512-TfTiyvZhwBYM/7QdAVDh+7dBTBA29v4ik0Ce9zda3Mnf8on1S5KJI8P2jKFZ8+5C0jhmr0KwJEO/Wdpm0VeWJQ=="
+ "version": "1.28.1",
+ "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.28.1.tgz",
+ "integrity": "sha512-gYHAa180mKrNIUJCbwpmD0aTu9kV0dREDrwNnuyFAsO1Wt0EVYSZelPnJlbj9HplzXX/YWXHFTL45kvZ53M0pw=="
},
"make-dir": {
"version": "3.1.0",
@@ -8411,9 +8480,9 @@
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="
},
"minimatch": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
@@ -8430,12 +8499,11 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
"mocha": {
- "version": "10.0.0",
- "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz",
- "integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==",
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz",
+ "integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==",
"dev": true,
"requires": {
- "@ungap/promise-all-settled": "1.1.2",
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
"chokidar": "3.5.3",
@@ -8544,24 +8612,50 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
+ "natural-compare-lite": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz",
+ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==",
+ "dev": true
+ },
"negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="
},
"nise": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.1.tgz",
- "integrity": "sha512-yr5kW2THW1AkxVmCnKEh4nbYkJdB3I7LUkiUgOvEkOp414mc2UMaHMA7pjq1nYowhdoJZGwEKGaQVbxfpWj10A==",
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.2.tgz",
+ "integrity": "sha512-+gQjFi8v+tkfCuSCxfURHLhRhniE/+IaYbIphxAN2JRR9SHKhY8hgXpaXiYfHdw+gcGe4buxgbprBQFab9FkhA==",
"dev": true,
"requires": {
- "@sinonjs/commons": "^1.8.3",
- "@sinonjs/fake-timers": ">=5",
+ "@sinonjs/commons": "^2.0.0",
+ "@sinonjs/fake-timers": "^7.0.4",
"@sinonjs/text-encoding": "^0.7.1",
"just-extend": "^4.0.2",
"path-to-regexp": "^1.7.0"
},
"dependencies": {
+ "@sinonjs/fake-timers": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz",
+ "integrity": "sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.7.0"
+ },
+ "dependencies": {
+ "@sinonjs/commons": {
+ "version": "1.8.5",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.5.tgz",
+ "integrity": "sha512-rTpCA0wG1wUxglBSFdMMY0oTrKYvgf4fNgv/sXbfCVAdf+FnPBdKJR/7XbpTCwbCrvCbdPYnlWaUUYz4V2fPDA==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ }
+ }
+ },
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
@@ -8603,15 +8697,15 @@
"dev": true
},
"nodemon": {
- "version": "2.0.19",
- "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz",
- "integrity": "sha512-4pv1f2bMDj0Eeg/MhGqxrtveeQ5/G/UVe9iO6uTZzjnRluSA4PVWf8CW99LUPwGB3eNIA7zUFoP77YuI7hOc0A==",
+ "version": "2.0.20",
+ "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz",
+ "integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==",
"dev": true,
"requires": {
"chokidar": "^3.5.2",
"debug": "^3.2.7",
"ignore-by-default": "^1.0.1",
- "minimatch": "^3.0.4",
+ "minimatch": "^3.1.2",
"pstree.remy": "^1.1.8",
"semver": "^5.7.1",
"simple-update-notifier": "^1.0.7",
@@ -8962,14 +9056,14 @@
"dev": true
},
"pg": {
- "version": "8.7.3",
- "resolved": "https://registry.npmjs.org/pg/-/pg-8.7.3.tgz",
- "integrity": "sha512-HPmH4GH4H3AOprDJOazoIcpI49XFsHCe8xlrjHkWiapdbHK+HLtbm/GQzXYAZwmPju/kzKhjaSfMACG+8cgJcw==",
+ "version": "8.8.0",
+ "resolved": "https://registry.npmjs.org/pg/-/pg-8.8.0.tgz",
+ "integrity": "sha512-UXYN0ziKj+AeNNP7VDMwrehpACThH7LUl/p8TDFpEUuSejCUIwGSfxpHsPvtM6/WXFy6SU4E5RG4IJV/TZAGjw==",
"requires": {
"buffer-writer": "2.0.0",
"packet-reader": "1.0.0",
"pg-connection-string": "^2.5.0",
- "pg-pool": "^3.5.1",
+ "pg-pool": "^3.5.2",
"pg-protocol": "^1.5.0",
"pg-types": "^2.1.0",
"pgpass": "1.x"
@@ -8986,9 +9080,9 @@
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="
},
"pg-pool": {
- "version": "3.5.1",
- "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.5.1.tgz",
- "integrity": "sha512-6iCR0wVrro6OOHFsyavV+i6KYL4lVNyYAB9RD18w66xSzN+d8b66HiwuP30Gp1SH5O9T82fckkzsRjlrhD0ioQ==",
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.5.2.tgz",
+ "integrity": "sha512-His3Fh17Z4eg7oANLob6ZvH8xIVen3phEZh2QuyrIl4dQSDVEabNducv6ysROKpDNPSD+12tONZVWfSgMvDD9w==",
"requires": {}
},
"pg-protocol": {
@@ -9155,6 +9249,11 @@
"ipaddr.js": "1.9.1"
}
},
+ "proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+ },
"pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
@@ -9177,9 +9276,9 @@
"dev": true
},
"qs": {
- "version": "6.10.3",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz",
- "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==",
+ "version": "6.11.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
+ "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"requires": {
"side-channel": "^1.0.4"
}
@@ -9259,16 +9358,16 @@
}
},
"redis": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/redis/-/redis-4.2.0.tgz",
- "integrity": "sha512-bCR0gKVhIXFg8zCQjXEANzgI01DDixtPZgIUZHBCmwqixnu+MK3Tb2yqGjh+HCLASQVVgApiwhNkv+FoedZOGQ==",
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/redis/-/redis-4.5.0.tgz",
+ "integrity": "sha512-oZGAmOKG+RPnHo0UxM5GGjJ0dBd/Vi4fs3MYwM1p2baDoXC0wpm0yOdpxVS9K+0hM84ycdysp2eHg2xGoQ4FEw==",
"requires": {
- "@redis/bloom": "1.0.2",
- "@redis/client": "1.2.0",
- "@redis/graph": "1.0.1",
- "@redis/json": "1.0.3",
- "@redis/search": "1.0.6",
- "@redis/time-series": "1.0.3"
+ "@redis/bloom": "1.1.0",
+ "@redis/client": "1.4.0",
+ "@redis/graph": "1.1.0",
+ "@redis/json": "1.0.4",
+ "@redis/search": "1.1.0",
+ "@redis/time-series": "1.0.4"
}
},
"regenerator-runtime": {
@@ -9498,16 +9597,16 @@
}
},
"sinon": {
- "version": "14.0.0",
- "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.0.tgz",
- "integrity": "sha512-ugA6BFmE+WrJdh0owRZHToLd32Uw3Lxq6E6LtNRU+xTVBefx632h03Q7apXWRsRdZAJ41LB8aUfn2+O4jsDNMw==",
+ "version": "14.0.2",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.2.tgz",
+ "integrity": "sha512-PDpV0ZI3ZCS3pEqx0vpNp6kzPhHrLx72wA0G+ZLaaJjLIYeE0n8INlgaohKuGy7hP0as5tbUd23QWu5U233t+w==",
"dev": true,
"requires": {
- "@sinonjs/commons": "^1.8.3",
+ "@sinonjs/commons": "^2.0.0",
"@sinonjs/fake-timers": "^9.1.2",
- "@sinonjs/samsam": "^6.1.1",
+ "@sinonjs/samsam": "^7.0.1",
"diff": "^5.0.0",
- "nise": "^5.1.1",
+ "nise": "^5.1.2",
"supports-color": "^7.2.0"
}
},
@@ -9705,9 +9804,9 @@
"requires": {}
},
"ts-node": {
- "version": "10.8.2",
- "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.2.tgz",
- "integrity": "sha512-LYdGnoGddf1D6v8REPtIH+5iq/gTDuZqv2/UJUU7tKjuEU8xVZorBM+buCGNjj+pGEud+sOoM4CX3/YzINpENA==",
+ "version": "10.9.1",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
+ "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
"dev": true,
"requires": {
"@cspotcode/source-map-support": "^0.8.0",
@@ -9801,9 +9900,9 @@
}
},
"typescript": {
- "version": "4.7.4",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
- "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
+ "version": "4.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz",
+ "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==",
"dev": true
},
"undefsafe": {
@@ -9852,12 +9951,6 @@
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"dev": true
},
- "v8-compile-cache": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
- "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
- "dev": true
- },
"v8-compile-cache-lib": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
diff --git a/package.json b/package.json
index 1c8077cbc..c47f3490d 100644
--- a/package.json
+++ b/package.json
@@ -9,52 +9,52 @@
"cover:report": "nyc report",
"dev": "nodemon",
"dev:bash": "nodemon -x 'npm test ; npm start'",
- "postgres:docker": "docker run --rm -p 5432:5432 -e POSTGRES_USER=ci_db_user -e POSTGRES_PASSWORD=ci_db_pass postgres:alpine",
- "redis:docker": "docker run --rm -p 6379:6379 redis:alpine",
+ "postgres:docker": "docker run --rm -p 5432:5432 -e POSTGRES_USER=ci_db_user -e POSTGRES_PASSWORD=ci_db_pass postgres:14-alpine",
+ "redis:docker": "docker run --rm -p 6379:6379 redis:7-alpine --save '' --appendonly no",
"start": "ts-node src/index.ts",
"tsc": "tsc -p tsconfig.json",
"lint": "eslint src test",
"lint:fix": "eslint src test --fix"
},
"author": "Ajay Ramachandran",
- "license": "MIT",
+ "license": "AGPL-3.0-only",
"dependencies": {
- "axios": "^0.27.2",
- "better-sqlite3": "^7.6.0",
- "cron": "^2.0.0",
- "express": "^4.18.1",
+ "axios": "^1.1.3",
+ "better-sqlite3": "^8.0.1",
+ "cron": "^2.1.0",
+ "express": "^4.18.2",
"express-promise-router": "^4.1.1",
- "express-rate-limit": "^6.4.0",
+ "express-rate-limit": "^6.7.0",
"form-data": "^4.0.0",
"lodash": "^4.17.21",
- "pg": "^8.7.3",
+ "pg": "^8.8.0",
"rate-limit-redis": "^3.0.1",
- "redis": "^4.2.0",
+ "redis": "^4.5.0",
"sync-mysql": "^3.0.1"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
- "@types/better-sqlite3": "^7.5.0",
+ "@types/better-sqlite3": "^7.6.2",
"@types/cron": "^2.0.0",
- "@types/express": "^4.17.13",
- "@types/lodash": "^4.14.182",
- "@types/mocha": "^9.1.1",
- "@types/node": "^18.0.3",
+ "@types/express": "^4.17.14",
+ "@types/lodash": "^4.14.189",
+ "@types/mocha": "^10.0.0",
+ "@types/node": "^18.11.9",
"@types/pg": "^8.6.5",
"@types/sinon": "^10.0.13",
- "@typescript-eslint/eslint-plugin": "^5.30.6",
- "@typescript-eslint/parser": "^5.30.6",
+ "@typescript-eslint/eslint-plugin": "^5.44.0",
+ "@typescript-eslint/parser": "^5.44.0",
"axios-mock-adapter": "^1.21.2",
- "eslint": "^8.19.0",
- "mocha": "^10.0.0",
- "nodemon": "^2.0.19",
+ "eslint": "^8.28.0",
+ "mocha": "^10.1.0",
+ "nodemon": "^2.0.20",
"nyc": "^15.1.0",
- "sinon": "^14.0.0",
+ "sinon": "^14.0.2",
"ts-mock-imports": "^1.3.8",
- "ts-node": "^10.8.2",
- "typescript": "^4.7.4"
+ "ts-node": "^10.9.1",
+ "typescript": "^4.9.3"
},
"engines": {
- "node": ">=16"
+ "node": ">=18"
}
}
diff --git a/src/app.ts b/src/app.ts
index caee4fab3..b2f44927e 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -1,7 +1,6 @@
import express, { Request, RequestHandler, Response, Router } from "express";
import { config } from "./config";
import { oldSubmitSponsorTimes } from "./routes/oldSubmitSponsorTimes";
-import { oldGetVideoSponsorTimes } from "./routes/oldGetVideoSponsorTimes";
import { postSegmentShift } from "./routes/postSegmentShift";
import { postWarning } from "./routes/postWarning";
import { getIsUserVIP } from "./routes/getIsUserVIP";
@@ -21,13 +20,13 @@ import { viewedVideoSponsorTime } from "./routes/viewedVideoSponsorTime";
import { voteOnSponsorTime, getUserID as voteGetUserID } from "./routes/voteOnSponsorTime";
import { getSkipSegmentsByHash } from "./routes/getSkipSegmentsByHash";
import { postSkipSegments } from "./routes/postSkipSegments";
-import { endpoint as getSkipSegments } from "./routes/getSkipSegments";
+import { getSkipSegments, oldGetVideoSponsorTimes } from "./routes/getSkipSegments";
import { userCounter } from "./middleware/userCounter";
import { loggerMiddleware } from "./middleware/logger";
import { corsMiddleware } from "./middleware/cors";
import { apiCspMiddleware } from "./middleware/apiCsp";
import { rateLimitMiddleware } from "./middleware/requestRateLimit";
-import dumpDatabase, { appExportPath, downloadFile } from "./routes/dumpDatabase";
+import dumpDatabase from "./routes/dumpDatabase";
import { endpoint as getSegmentInfo } from "./routes/getSegmentInfo";
import { postClearCache } from "./routes/postClearCache";
import { addUnlistedVideo } from "./routes/addUnlistedVideo";
@@ -45,9 +44,12 @@ import { youtubeApiProxy } from "./routes/youtubeApiProxy";
import { getChapterNames } from "./routes/getChapterNames";
import { getTopCategoryUsers } from "./routes/getTopCategoryUsers";
import { addUserAsTempVIP } from "./routes/addUserAsTempVIP";
+import { endpoint as getVideoLabels } from "./routes/getVideoLabel";
+import { getVideoLabelsByHash } from "./routes/getVideoLabelByHash";
import { addFeature } from "./routes/addFeature";
import { generateTokenRequest } from "./routes/generateToken";
import { verifyTokenRequest } from "./routes/verifyToken";
+import { cacheMiddlware } from "./middleware/etag";
export function createServer(callback: () => void): Server {
// Create a service (the app object is just a callback).
@@ -55,11 +57,13 @@ export function createServer(callback: () => void): Server {
const router = ExpressPromiseRouter();
app.use(router);
+ app.set("etag", false); // disable built in etag
//setup CORS correctly
router.use(corsMiddleware);
router.use(loggerMiddleware);
router.use("/api/", apiCspMiddleware);
+ router.use(cacheMiddlware);
router.use(express.json());
if (config.userCounterURL) router.use(userCounter);
@@ -80,7 +84,7 @@ function setupRoutes(router: Router) {
// Rate limit endpoint lists
const voteEndpoints: RequestHandler[] = [voteOnSponsorTime];
const viewEndpoints: RequestHandler[] = [viewedVideoSponsorTime];
- if (config.rateLimit) {
+ if (config.rateLimit && config.redisRateLimit) {
if (config.rateLimit.vote) voteEndpoints.unshift(rateLimitMiddleware(config.rateLimit.vote, voteGetUserID));
if (config.rateLimit.view) viewEndpoints.unshift(rateLimitMiddleware(config.rateLimit.view));
}
@@ -200,16 +204,20 @@ function setupRoutes(router: Router) {
router.get("/api/generateToken/:type", generateTokenRequest);
router.get("/api/verifyToken", verifyTokenRequest);
+ // labels
+ router.get("/api/videoLabels", getVideoLabels);
+ router.get("/api/videoLabels/:prefix", getVideoLabelsByHash);
+
/* istanbul ignore next */
if (config.postgres?.enabled) {
router.get("/database", (req, res) => dumpDatabase(req, res, true));
router.get("/database.json", (req, res) => dumpDatabase(req, res, false));
- router.get("/database/*", downloadFile);
- router.use("/download", express.static(appExportPath));
+ router.get("/database/*", (req, res) => res.status(404).send("CSV downloads disabled. Please use sb-mirror rsync"));
+ router.use("/download", (req, res) => res.status(404).send("CSV downloads disabled. Please use sb-mirror rsync"));
} else {
router.get("/database.db", function (req: Request, res: Response) {
res.sendFile("./databases/sponsorTimes.db", { root: "./" });
});
}
}
-/* eslint-enable @typescript-eslint/no-misused-promises */
\ No newline at end of file
+/* eslint-enable @typescript-eslint/no-misused-promises */
diff --git a/src/config.ts b/src/config.ts
index 70e1fc384..53e86f6cf 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -65,6 +65,7 @@ addDefaults(config, {
}
},
userCounterURL: null,
+ userCounterRatio: 10,
newLeafURLs: null,
maxRewardTimePerSegmentInSeconds: 600,
poiMinimumStartTime: 2,
@@ -77,7 +78,9 @@ addDefaults(config, {
max: 10,
idleTimeoutMillis: 10000,
maxTries: 3,
- maxConcurrentRequests: 3500
+ maxActiveRequests: 0,
+ timeout: 60000,
+ highLoadThreshold: 10
},
postgresReadOnly: {
enabled: false,
@@ -91,7 +94,7 @@ addDefaults(config, {
idleTimeoutMillis: 10000,
maxTries: 3,
fallbackOnFail: true,
- maxConcurrentRequests: 3500
+ stopRetryThreshold: 800
},
dumpDatabase: {
enabled: false,
@@ -137,8 +140,24 @@ addDefaults(config, {
},
disableOfflineQueue: true,
expiryTime: 24 * 60 * 60,
- getTimeout: 40
+ getTimeout: 40,
+ maxConnections: 15000,
+ maxWriteConnections: 1000,
+ commandsQueueMaxLength: 3000,
+ stopWritingAfterResponseTime: 50,
+ responseTimePause: 1000,
+ disableHashCache: false
},
+ redisRead: {
+ enabled: false,
+ socket: {
+ host: "",
+ port: 0
+ },
+ disableOfflineQueue: true,
+ weight: 1
+ },
+ redisRateLimit: true,
patreon: {
clientId: "",
clientSecret: "",
@@ -147,7 +166,8 @@ addDefaults(config, {
},
gumroad: {
productPermalinks: ["sponsorblock"]
- }
+ },
+ minUserIDLength: 30
});
loadFromEnv(config);
migrate(config);
diff --git a/src/databases/IDatabase.ts b/src/databases/IDatabase.ts
index 9cc82d4d4..717c700ed 100644
--- a/src/databases/IDatabase.ts
+++ b/src/databases/IDatabase.ts
@@ -7,6 +7,8 @@ export interface IDatabase {
init(): Promise;
prepare(type: QueryType, query: string, params?: any[], options?: QueryOption): Promise;
+
+ highLoad(): boolean;
}
export type QueryType = "get" | "all" | "run";
\ No newline at end of file
diff --git a/src/databases/Mysql.ts b/src/databases/Mysql.ts
index d15b692ba..a68a12c91 100644
--- a/src/databases/Mysql.ts
+++ b/src/databases/Mysql.ts
@@ -32,4 +32,8 @@ export class Mysql implements IDatabase {
}
}
+ highLoad() {
+ return false;
+ }
+
}
diff --git a/src/databases/Postgres.ts b/src/databases/Postgres.ts
index 01f59b1b3..aa13f9c7b 100644
--- a/src/databases/Postgres.ts
+++ b/src/databases/Postgres.ts
@@ -3,7 +3,7 @@ import { IDatabase, QueryOption, QueryType } from "./IDatabase";
import { Client, Pool, QueryResult, types } from "pg";
import fs from "fs";
-import { CustomPostgresConfig, CustomPostgresReadOnlyConfig } from "../types/config.model";
+import { CustomPostgresReadOnlyConfig, CustomWritePostgresConfig } from "../types/config.model";
import { timeoutPomise, PromiseWithState, savePromiseState, nextFulfilment } from "../utils/promise";
// return numeric (pg_type oid=1700) as float
@@ -16,13 +16,20 @@ types.setTypeParser(20, function(val) {
return parseInt(val, 10);
});
+interface PostgresStats {
+ activeRequests: number;
+ avgReadTime: number;
+ avgWriteTime: number;
+ avgFailedTime: number;
+}
+
export interface DatabaseConfig {
dbSchemaFileName: string,
dbSchemaFolder: string,
fileNamePrefix: string,
readOnly: boolean,
createDbIfNotExists: boolean,
- postgres: CustomPostgresConfig,
+ postgres: CustomWritePostgresConfig,
postgresReadOnly: CustomPostgresReadOnlyConfig
}
@@ -33,8 +40,11 @@ export class Postgres implements IDatabase {
private poolRead: Pool;
private lastPoolReadFail = 0;
- private concurrentRequests = 0;
- private concurrentReadRequests = 0;
+ activePostgresRequests = 0;
+ readResponseTime: number[] = [];
+ writeResponseTime: number[] = [];
+ failedResponseTime: number[] = [];
+ maxStoredTimes = 200;
constructor(private config: DatabaseConfig) {}
@@ -54,19 +64,23 @@ export class Postgres implements IDatabase {
});
if (this.config.postgresReadOnly && this.config.postgresReadOnly.enabled) {
- this.poolRead = new Pool({
- ...this.config.postgresReadOnly
- });
- this.poolRead.on("error", (err, client) => {
- Logger.error(err.stack);
- this.lastPoolReadFail = Date.now();
-
- try {
- client.release(true);
- } catch (err) {
- Logger.error(`poolRead (postgres): ${err}`);
- }
- });
+ try {
+ this.poolRead = new Pool({
+ ...this.config.postgresReadOnly
+ });
+ this.poolRead.on("error", (err, client) => {
+ Logger.error(err.stack);
+ this.lastPoolReadFail = Date.now();
+
+ try {
+ client.release(true);
+ } catch (err) {
+ Logger.error(`poolRead (postgres): ${err}`);
+ }
+ });
+ } catch (e) {
+ Logger.error(`poolRead (postgres): ${e}`);
+ }
}
if (!this.config.readOnly) {
@@ -102,22 +116,12 @@ export class Postgres implements IDatabase {
Logger.debug(`prepare (postgres): type: ${type}, query: ${query}, params: ${params}`);
- if (this.config.readOnly) {
- if (this.concurrentReadRequests > this.config.postgresReadOnly?.maxConcurrentRequests) {
- Logger.error(`prepare (postgres): cancelling read query because too many concurrent requests, query: ${query}`);
- throw new Error("Too many concurrent requests");
- }
-
- this.concurrentReadRequests++;
- } else {
- if (this.concurrentRequests > this.config.postgres.maxConcurrentRequests) {
- Logger.error(`prepare (postgres): cancelling query because too many concurrent requests, query: ${query}`);
- throw new Error("Too many concurrent requests");
- }
-
- this.concurrentRequests++;
+ if (this.config.postgres.maxActiveRequests && this.isReadQuery(type)
+ && this.activePostgresRequests > this.config.postgres.maxActiveRequests) {
+ throw new Error("Too many active postgres requests");
}
+ const start = Date.now();
const pendingQueries: PromiseWithState>[] = [];
let tries = 0;
let lastPool: Pool = null;
@@ -127,19 +131,18 @@ export class Postgres implements IDatabase {
tries++;
try {
+ this.activePostgresRequests++;
lastPool = this.getPool(type, options);
pendingQueries.push(savePromiseState(lastPool.query({ text: query, values: params })));
const currentPromises = [...pendingQueries];
if (options.useReplica && maxTries() - tries > 1) currentPromises.push(savePromiseState(timeoutPomise(this.config.postgresReadOnly.readTimeout)));
+ else if (this.config.postgres.timeout) currentPromises.push(savePromiseState(timeoutPomise(this.config.postgres.timeout)));
const queryResult = await nextFulfilment(currentPromises);
- if (this.config.readOnly) {
- this.concurrentReadRequests--;
- } else {
- this.concurrentRequests--;
- }
+ this.updateResponseTime(type, start);
+ this.activePostgresRequests--;
switch (type) {
case "get": {
const value = queryResult.rows[0];
@@ -159,30 +162,31 @@ export class Postgres implements IDatabase {
if (lastPool === this.pool) {
// Only applies if it is get or all request
options.forceReplica = true;
- } else if (lastPool === this.poolRead && maxTries() - tries <= 1) {
- options.useReplica = false;
+ } else if (lastPool === this.poolRead) {
+ this.lastPoolReadFail = Date.now();
+
+ if (maxTries() - tries <= 1) {
+ options.useReplica = false;
+ }
}
+ this.updateResponseTime(type, start, this.failedResponseTime);
+ this.activePostgresRequests--;
Logger.error(`prepare (postgres) try ${tries}: ${err}`);
}
- } while (this.isReadQuery(type) && tries < maxTries());
-
- if (this.config.readOnly) {
- this.concurrentReadRequests--;
- } else {
- this.concurrentRequests--;
- }
+ } while (this.isReadQuery(type) && tries < maxTries()
+ && this.activePostgresRequests < this.config.postgresReadOnly.stopRetryThreshold);
throw new Error(`prepare (postgres): ${type} ${query} failed after ${tries} tries`);
}
private getPool(type: string, options: QueryOption): Pool {
const readAvailable = this.poolRead && options.useReplica && this.isReadQuery(type);
- const ignroreReadDueToFailure = this.config.postgresReadOnly.fallbackOnFail
+ const ignoreReadDueToFailure = this.config.postgresReadOnly.fallbackOnFail
&& this.lastPoolReadFail > Date.now() - 1000 * 30;
const readDueToFailure = this.config.postgresReadOnly.fallbackOnFail
&& this.lastPoolFail > Date.now() - 1000 * 30;
- if (readAvailable && !ignroreReadDueToFailure && (options.forceReplica || readDueToFailure ||
+ if (readAvailable && !ignoreReadDueToFailure && (options.forceReplica || readDueToFailure ||
Math.random() > 1 / (this.config.postgresReadOnly.weight + 1))) {
return this.poolRead;
} else {
@@ -246,4 +250,27 @@ export class Postgres implements IDatabase {
return result;
}
+
+ private updateResponseTime(type: string, start: number, customArray?: number[]): void {
+ const responseTime = Date.now() - start;
+
+ const array = customArray ?? (this.isReadQuery(type) ?
+ this.readResponseTime : this.writeResponseTime);
+
+ array.push(responseTime);
+ if (array.length > this.maxStoredTimes) array.shift();
+ }
+
+ getStats(): PostgresStats {
+ return {
+ activeRequests: this.activePostgresRequests,
+ avgReadTime: this.readResponseTime.length > 0 ? this.readResponseTime.reduce((a, b) => a + b, 0) / this.readResponseTime.length : 0,
+ avgWriteTime: this.writeResponseTime.length > 0 ? this.writeResponseTime.reduce((a, b) => a + b, 0) / this.writeResponseTime.length : 0,
+ avgFailedTime: this.failedResponseTime.length > 0 ? this.failedResponseTime.reduce((a, b) => a + b, 0) / this.failedResponseTime.length : 0
+ };
+ }
+
+ highLoad() {
+ return this.activePostgresRequests > this.config.postgres.highLoadThreshold;
+ }
}
diff --git a/src/databases/Sqlite.ts b/src/databases/Sqlite.ts
index f5dd371d9..ac037533c 100644
--- a/src/databases/Sqlite.ts
+++ b/src/databases/Sqlite.ts
@@ -95,6 +95,10 @@ export class Sqlite implements IDatabase {
private static processUpgradeQuery(query: string): string {
return query.replace(/^.*--!sqlite-ignore/gm, "");
}
+
+ highLoad() {
+ return false;
+ }
}
export interface SqliteConfig {
diff --git a/src/index.ts b/src/index.ts
index e34882a72..ec44960d5 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -4,6 +4,7 @@ import { createServer } from "./app";
import { Logger } from "./utils/logger";
import { startAllCrons } from "./cronjob";
import { getCommit } from "./utils/getCommit";
+import { connectionPromise } from "./utils/redis";
async function init() {
process.on("unhandledRejection", (error: any) => {
@@ -12,7 +13,14 @@ async function init() {
process.exit(1);
});
- await initDb();
+ try {
+ await initDb();
+ await connectionPromise;
+ } catch (e) {
+ Logger.error(`Init Db: ${e}`);
+ process.exit(1);
+ }
+
// edge case clause for creating compatible .db files, do not enable
if (config.mode === "init-db-and-exit") process.exit(0);
// do not enable init-db-only mode for usage.
@@ -27,4 +35,4 @@ async function init() {
}).setTimeout(15000);
}
-init().catch((err) => Logger.error(err));
\ No newline at end of file
+init().catch((err) => Logger.error(`Index.js: ${err}`));
\ No newline at end of file
diff --git a/src/middleware/cors.ts b/src/middleware/cors.ts
index e3b71ab56..6e5f2c2c0 100644
--- a/src/middleware/cors.ts
+++ b/src/middleware/cors.ts
@@ -3,6 +3,6 @@ import { NextFunction, Request, Response } from "express";
export function corsMiddleware(req: Request, res: Response, next: NextFunction): void {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS, DELETE");
- res.header("Access-Control-Allow-Headers", "Content-Type");
+ res.header("Access-Control-Allow-Headers", "Content-Type, If-None-Match");
next();
}
diff --git a/src/middleware/etag.ts b/src/middleware/etag.ts
new file mode 100644
index 000000000..826c30521
--- /dev/null
+++ b/src/middleware/etag.ts
@@ -0,0 +1,49 @@
+import { NextFunction, Request, Response } from "express";
+import { VideoID, VideoIDHash, Service } from "../types/segments.model";
+import { QueryCacher } from "../utils/queryCacher";
+import { skipSegmentsHashKey, skipSegmentsKey, videoLabelsHashKey, videoLabelsKey } from "../utils/redisKeys";
+
+type hashType = "skipSegments" | "skipSegmentsHash" | "videoLabel" | "videoLabelHash";
+type ETag = `${hashType};${VideoIDHash};${Service};${number}`;
+type hashKey = string | VideoID | VideoIDHash;
+
+export function cacheMiddlware(req: Request, res: Response, next: NextFunction): void {
+ const reqEtag = req.get("If-None-Match") as string;
+ // if weak etag, do not handle
+ if (!reqEtag || reqEtag.startsWith("W/")) return next();
+ // split into components
+ const [hashType, hashKey, service, lastModified] = reqEtag.split(";");
+ // fetch last-modified
+ getLastModified(hashType as hashType, hashKey as VideoIDHash, service as Service)
+ .then(redisLastModified => {
+ if (redisLastModified <= new Date(Number(lastModified) + 1000)) {
+ // match cache, generate etag
+ const etag = `${hashType};${hashKey};${service};${redisLastModified.getTime()}` as ETag;
+ res.status(304).set("etag", etag).send();
+ }
+ else next();
+ })
+ .catch(next);
+}
+
+function getLastModified(hashType: hashType, hashKey: hashKey, service: Service): Promise {
+ let redisKey: string | null;
+ if (hashType === "skipSegments") redisKey = skipSegmentsKey(hashKey as VideoID, service);
+ else if (hashType === "skipSegmentsHash") redisKey = skipSegmentsHashKey(hashKey as VideoIDHash, service);
+ else if (hashType === "videoLabel") redisKey = videoLabelsKey(hashKey as VideoID, service);
+ else if (hashType === "videoLabelHash") redisKey = videoLabelsHashKey(hashKey as VideoIDHash, service);
+ else return Promise.reject();
+ return QueryCacher.getKeyLastModified(redisKey);
+}
+
+export async function getEtag(hashType: hashType, hashKey: hashKey, service: Service): Promise {
+ const lastModified = await getLastModified(hashType, hashKey, service);
+ return `${hashType};${hashKey};${service};${lastModified.getTime()}` as ETag;
+}
+
+/* example usage
+import { getEtag } from "../middleware/etag";
+await getEtag(hashType, hashPrefix, service)
+ .then(etag => res.set("ETag", etag))
+ .catch(() => null);
+*/
\ No newline at end of file
diff --git a/src/middleware/userCounter.ts b/src/middleware/userCounter.ts
index 958f67ea2..dff3ab53d 100644
--- a/src/middleware/userCounter.ts
+++ b/src/middleware/userCounter.ts
@@ -2,13 +2,20 @@ import axios from "axios";
import { Logger } from "../utils/logger";
import { config } from "../config";
import { getIP } from "../utils/getIP";
-import { getHash } from "../utils/getHash";
import { NextFunction, Request, Response } from "express";
+import { Agent } from "http";
+
+const httpAgent = new Agent({ keepAlive: true });
export function userCounter(req: Request, res: Response, next: NextFunction): void {
if (req.method !== "OPTIONS") {
- axios.post(`${config.userCounterURL}/api/v1/addIP?hashedIP=${getHash(getIP(req), 1)}`)
- .catch(() => Logger.debug(`Failing to connect to user counter at: ${config.userCounterURL}`));
+ if (Math.random() < 1 / config.userCounterRatio) {
+ axios({
+ method: "post",
+ url: `${config.userCounterURL}/api/v1/addIP?hashedIP=${getIP(req)}`,
+ httpAgent
+ }).catch(() => Logger.debug(`Failing to connect to user counter at: ${config.userCounterURL}`));
+ }
}
next();
diff --git a/src/routes/dumpDatabase.ts b/src/routes/dumpDatabase.ts
index c3dc2ba0a..10e21d6dd 100644
--- a/src/routes/dumpDatabase.ts
+++ b/src/routes/dumpDatabase.ts
@@ -124,7 +124,7 @@ export default async function dumpDatabase(req: Request, res: Response, showPage
if (showPage) {
res.send(`${styleHeader}
SponsorBlock database dumps
${licenseHeader}
- How this works
+ How this works
Send a request to https://sponsor.ajay.app/database.json
, or visit this page to get a list of urls and the update status database dump to run.
Then, you can download the csv files below, or use the links returned from the JSON request.
@@ -135,6 +135,11 @@ export default async function dumpDatabase(req: Request, res: Response, showPage
If you want a live dump, please do not continually fetch this url.
Please instead use the sb-mirror project.
This can automatically fetch new data and will not require a redownload each time, saving bandwidth.
+
+
+ Please use sb-mirror
+
+ For bandwidth reasons, CSV downloads have been disabled. Please use the sb-mirror project.
Links
diff --git a/src/routes/generateToken.ts b/src/routes/generateToken.ts
index cc889927d..d617eccd3 100644
--- a/src/routes/generateToken.ts
+++ b/src/routes/generateToken.ts
@@ -1,7 +1,7 @@
import { Request, Response } from "express";
import { config } from "../config";
import { createAndSaveToken, TokenType } from "../utils/tokenUtils";
-
+import { getHashCache } from "../utils/getHashCache";
interface GenerateTokenRequest extends Request {
query: {
@@ -15,12 +15,13 @@ interface GenerateTokenRequest extends Request {
export async function generateTokenRequest(req: GenerateTokenRequest, res: Response): Promise {
const { query: { code, adminUserID }, params: { type } } = req;
+ const adminUserIDHash = adminUserID ? (await getHashCache(adminUserID)) : null;
if (!code || !type) {
return res.status(400).send("Invalid request");
}
- if (type === TokenType.patreon || (type === TokenType.local && adminUserID === config.adminUserID)) {
+ if (type === TokenType.patreon || (type === TokenType.local && adminUserIDHash === config.adminUserID)) {
const licenseKey = await createAndSaveToken(type, code);
/* istanbul ignore else */
diff --git a/src/routes/getSearchSegments.ts b/src/routes/getSearchSegments.ts
index 9dec9df79..31b2c9325 100644
--- a/src/routes/getSearchSegments.ts
+++ b/src/routes/getSearchSegments.ts
@@ -14,7 +14,7 @@ type searchSegmentResponse = {
function getSegmentsFromDBByVideoID(videoID: VideoID, service: Service): Promise {
return db.prepare(
"all",
- `SELECT "UUID", "timeSubmitted", "startTime", "endTime", "category", "actionType", "votes", "views", "locked", "hidden", "shadowHidden", "userID" FROM "sponsorTimes"
+ `SELECT "UUID", "timeSubmitted", "startTime", "endTime", "category", "actionType", "votes", "views", "locked", "hidden", "shadowHidden", "userID", "description" FROM "sponsorTimes"
WHERE "videoID" = ? AND "service" = ? ORDER BY "timeSubmitted"`,
[videoID, service]
) as Promise;
diff --git a/src/routes/getSkipSegments.ts b/src/routes/getSkipSegments.ts
index 6c938225f..2a72dca06 100644
--- a/src/routes/getSkipSegments.ts
+++ b/src/routes/getSkipSegments.ts
@@ -12,7 +12,8 @@ import { QueryCacher } from "../utils/queryCacher";
import { getReputation } from "../utils/reputation";
import { getService } from "../utils/getService";
import { promiseOrTimeout } from "../utils/promise";
-
+import { parseSkipSegments } from "../utils/parseSkipSegments";
+import { getEtag } from "../middleware/etag";
async function prepareCategorySegments(req: Request, videoID: VideoID, service: Service, segments: DBSegment[], cache: SegmentCache = { shadowHiddenSegmentIPs: {} }, useCache: boolean): Promise {
const shouldFilter: boolean[] = await Promise.all(segments.map(async (segment) => {
@@ -86,9 +87,6 @@ async function getSegmentsByVideoID(req: Request, videoID: VideoID, categories:
}
try {
- categories = categories.filter((category) => !/[^a-z|_|-]/.test(category));
- if (categories.length === 0) return null;
-
const segments: DBSegment[] = (await getSegmentsFromDBByVideoID(videoID, service))
.map((segment: DBSegment) => {
if (filterRequiredSegments(segment.UUID, requiredSegments)) segment.required = true;
@@ -97,7 +95,17 @@ async function getSegmentsByVideoID(req: Request, videoID: VideoID, categories:
const canUseCache = requiredSegments.length === 0;
let processedSegments: Segment[] = (await prepareCategorySegments(req, videoID, service, segments, cache, canUseCache))
- .filter((segment: Segment) => categories.includes(segment?.category) && (actionTypes.includes(segment?.actionType)));
+ .filter((segment: Segment) => categories.includes(segment?.category) && (actionTypes.includes(segment?.actionType)))
+ .map((segment: Segment) => ({
+ category: segment.category,
+ actionType: segment.actionType,
+ segment: segment.segment,
+ UUID: segment.UUID,
+ videoDuration: segment.videoDuration,
+ locked: segment.locked,
+ votes: segment.votes,
+ description: segment.description
+ }));
if (forcePoiAsSkip) {
processedSegments = processedSegments.map((segment) => ({
@@ -127,15 +135,11 @@ async function getSegmentsByHash(req: Request, hashedVideoIDPrefix: VideoIDHash,
}
try {
- type SegmentWithHashPerVideoID = SBRecord;
+ type SegmentPerVideoID = SBRecord;
- categories = categories.filter((category) => !(/[^a-z|_|-]/.test(category)));
- if (categories.length === 0) return null;
-
- const segmentPerVideoID: SegmentWithHashPerVideoID = (await getSegmentsFromDBByHash(hashedVideoIDPrefix, service))
- .reduce((acc: SegmentWithHashPerVideoID, segment: DBSegment) => {
+ const segmentPerVideoID: SegmentPerVideoID = (await getSegmentsFromDBByHash(hashedVideoIDPrefix, service))
+ .reduce((acc: SegmentPerVideoID, segment: DBSegment) => {
acc[segment.videoID] = acc[segment.videoID] || {
- hash: segment.hashedVideoID,
segments: []
};
if (filterRequiredSegments(segment.UUID, requiredSegments)) segment.required = true;
@@ -148,13 +152,22 @@ async function getSegmentsByHash(req: Request, hashedVideoIDPrefix: VideoIDHash,
await Promise.all(Object.entries(segmentPerVideoID).map(async ([videoID, videoData]) => {
const data: VideoData = {
- hash: videoData.hash,
segments: [],
};
const canUseCache = requiredSegments.length === 0;
data.segments = (await prepareCategorySegments(req, videoID as VideoID, service, videoData.segments, cache, canUseCache))
- .filter((segment: Segment) => categories.includes(segment?.category) && actionTypes.includes(segment?.actionType));
+ .filter((segment: Segment) => categories.includes(segment?.category) && actionTypes.includes(segment?.actionType))
+ .map((segment) => ({
+ category: segment.category,
+ actionType: segment.actionType,
+ segment: segment.segment,
+ UUID: segment.UUID,
+ videoDuration: segment.videoDuration,
+ locked: segment.locked,
+ votes: segment.votes,
+ description: segment.description
+ }));
if (forcePoiAsSkip) {
data.segments = data.segments.map((segment) => ({
@@ -291,7 +304,7 @@ async function chooseSegments(videoID: VideoID, service: Service, segments: DBSe
//Segments with less than -1 votes are already ignored before this function is called
async function buildSegmentGroups(segments: DBSegment[]): Promise {
const reputationPromises = segments.map(segment =>
- segment.userID ? getReputation(segment.userID).catch((e) => Logger.error(e)) : null);
+ segment.userID && !db.highLoad() ? getReputation(segment.userID).catch((e) => Logger.error(e)) : null);
//Create groups of segments that are similar to eachother
//Segments must be sorted by their startTime so that we can build groups chronologically:
@@ -378,75 +391,59 @@ function splitPercentOverlap(groups: OverlappingSegmentGroup[]): OverlappingSegm
});
}
-/**
- *
- * Returns what would be sent to the client.
- * Will respond with errors if required. Returns false if it errors.
- *
- * @param req
- * @param res
- *
- * @returns
- */
-async function handleGetSegments(req: Request, res: Response): Promise {
+async function getSkipSegments(req: Request, res: Response): Promise {
const videoID = req.query.videoID as VideoID;
if (!videoID) {
- res.status(400).send("videoID not specified");
- return false;
- }
- // Default to sponsor
- // If using params instead of JSON, only one category can be pulled
- const categories: Category[] = req.query.categories
- ? JSON.parse(req.query.categories as string)
- : req.query.category
- ? Array.isArray(req.query.category)
- ? req.query.category
- : [req.query.category]
- : ["sponsor"];
- if (!Array.isArray(categories)) {
- res.status(400).send("Categories parameter does not match format requirements.");
- return false;
+ return res.status(400).send("videoID not specified");
}
- const actionTypes: ActionType[] = req.query.actionTypes
- ? JSON.parse(req.query.actionTypes as string)
- : req.query.actionType
- ? Array.isArray(req.query.actionType)
- ? req.query.actionType
- : [req.query.actionType]
- : [ActionType.Skip];
- if (!Array.isArray(actionTypes)) {
- res.status(400).send("actionTypes parameter does not match format requirements.");
- return false;
+ const parseResult = parseSkipSegments(req);
+ if (parseResult.errors.length > 0) {
+ return res.status(400).send(parseResult.errors);
}
- const requiredSegments: SegmentUUID[] = req.query.requiredSegments
- ? JSON.parse(req.query.requiredSegments as string)
- : req.query.requiredSegment
- ? Array.isArray(req.query.requiredSegment)
- ? req.query.requiredSegment
- : [req.query.requiredSegment]
- : [];
- if (!Array.isArray(requiredSegments)) {
- res.status(400).send("requiredSegments parameter does not match format requirements.");
- return false;
+ const { categories, actionTypes, requiredSegments, service } = parseResult;
+ const segments = await getSegmentsByVideoID(req, videoID, categories, actionTypes, requiredSegments, service);
+
+ if (segments === null || segments === undefined) {
+ return res.sendStatus(500);
+ } else if (segments.length === 0) {
+ return res.sendStatus(404);
}
- const service = getService(req.query.service, req.body.service);
+ await getEtag("skipSegments", (videoID as string), service)
+ .then(etag => res.set("ETag", etag))
+ .catch(() => null);
+ return res.send(segments);
+}
- const segments = await getSegmentsByVideoID(req, videoID, categories, actionTypes, requiredSegments, service);
+async function oldGetVideoSponsorTimes(req: Request, res: Response): Promise {
+ const videoID = req.query.videoID as VideoID;
+ if (!videoID) {
+ return res.status(400).send("videoID not specified");
+ }
+
+ const segments = await getSegmentsByVideoID(req, videoID, ["sponsor"] as Category[], [ActionType.Skip], [], Service.YouTube);
if (segments === null || segments === undefined) {
- res.sendStatus(500);
- return false;
+ return res.sendStatus(500);
+ } else if (segments.length === 0) {
+ return res.sendStatus(404);
}
- if (segments.length === 0) {
- res.sendStatus(404);
- return false;
+ // Convert to old outputs
+ const sponsorTimes = [];
+ const UUIDs = [];
+
+ for (const segment of segments) {
+ sponsorTimes.push(segment.segment);
+ UUIDs.push(segment.UUID);
}
- return segments;
+ return res.send({
+ sponsorTimes,
+ UUIDs,
+ });
}
const filterRequiredSegments = (UUID: SegmentUUID, requiredSegments: SegmentUUID[]): boolean => {
@@ -456,25 +453,9 @@ const filterRequiredSegments = (UUID: SegmentUUID, requiredSegments: SegmentUUID
return false;
};
-async function endpoint(req: Request, res: Response): Promise {
- try {
- const segments = await handleGetSegments(req, res);
-
- // If false, res.send has already been called
- if (segments) {
- //send result
- return res.send(segments);
- }
- } catch (err) /* istanbul ignore next */ {
- if (err instanceof SyntaxError) {
- return res.status(400).send("Categories parameter does not match format requirements.");
- } else return res.sendStatus(500);
- }
-}
-
export {
getSegmentsByVideoID,
getSegmentsByHash,
- endpoint,
- handleGetSegments
+ getSkipSegments,
+ oldGetVideoSponsorTimes
};
diff --git a/src/routes/getSkipSegmentsByHash.ts b/src/routes/getSkipSegmentsByHash.ts
index 454f23298..eaf7f97a1 100644
--- a/src/routes/getSkipSegmentsByHash.ts
+++ b/src/routes/getSkipSegmentsByHash.ts
@@ -1,8 +1,10 @@
import { hashPrefixTester } from "../utils/hashPrefixTester";
import { getSegmentsByHash } from "./getSkipSegments";
import { Request, Response } from "express";
-import { ActionType, Category, SegmentUUID, VideoIDHash, Service } from "../types/segments.model";
-import { getService } from "../utils/getService";
+import { VideoIDHash } from "../types/segments.model";
+import { Logger } from "../utils/logger";
+import { parseSkipSegments } from "../utils/parseSkipSegments";
+import { getEtag } from "../middleware/etag";
export async function getSkipSegmentsByHash(req: Request, res: Response): Promise {
let hashPrefix = req.params.prefix as VideoIDHash;
@@ -11,66 +13,27 @@ export async function getSkipSegmentsByHash(req: Request, res: Response): Promis
}
hashPrefix = hashPrefix.toLowerCase() as VideoIDHash;
- let categories: Category[] = [];
- try {
- categories = req.query.categories
- ? JSON.parse(req.query.categories as string)
- : req.query.category
- ? Array.isArray(req.query.category)
- ? req.query.category
- : [req.query.category]
- : ["sponsor"];
- if (!Array.isArray(categories)) {
- return res.status(400).send("Categories parameter does not match format requirements.");
- }
- } catch(error) {
- return res.status(400).send("Bad parameter: categories (invalid JSON)");
- }
-
- let actionTypes: ActionType[] = [];
- try {
- actionTypes = req.query.actionTypes
- ? JSON.parse(req.query.actionTypes as string)
- : req.query.actionType
- ? Array.isArray(req.query.actionType)
- ? req.query.actionType
- : [req.query.actionType]
- : [ActionType.Skip];
- if (!Array.isArray(actionTypes)) {
- return res.status(400).send("actionTypes parameter does not match format requirements.");
- }
- } catch(error) {
- return res.status(400).send("Bad parameter: actionTypes (invalid JSON)");
+ const parseResult = parseSkipSegments(req);
+ if (parseResult.errors.length > 0) {
+ return res.status(400).send(parseResult.errors);
}
-
- let requiredSegments: SegmentUUID[] = [];
- try {
- requiredSegments = req.query.requiredSegments
- ? JSON.parse(req.query.requiredSegments as string)
- : req.query.requiredSegment
- ? Array.isArray(req.query.requiredSegment)
- ? req.query.requiredSegment
- : [req.query.requiredSegment]
- : [];
- if (!Array.isArray(requiredSegments)) {
- return res.status(400).send("requiredSegments parameter does not match format requirements.");
- }
- } catch(error) {
- return res.status(400).send("Bad parameter: requiredSegments (invalid JSON)");
- }
-
- const service: Service = getService(req.query.service, req.body.service);
-
- // filter out none string elements, only flat array with strings is valid
- categories = categories.filter((item: any) => typeof item === "string");
+ const { categories, actionTypes, requiredSegments, service } = parseResult;
// Get all video id's that match hash prefix
const segments = await getSegmentsByHash(req, hashPrefix, categories, actionTypes, requiredSegments, service);
- const output = Object.entries(segments).map(([videoID, data]) => ({
- videoID,
- hash: data.hash,
- segments: data.segments,
- }));
- return res.status(output.length === 0 ? 404 : 200).json(output);
+ try {
+ await getEtag("skipSegmentsHash", hashPrefix, service)
+ .then(etag => res.set("ETag", etag))
+ .catch(() => null);
+ const output = Object.entries(segments).map(([videoID, data]) => ({
+ videoID,
+ segments: data.segments,
+ }));
+ return res.status(output.length === 0 ? 404 : 200).json(output);
+ } catch(e) {
+ Logger.error(`skip segments by hash error: ${e}`);
+
+ return res.status(500).send("Internal server error");
+ }
}
diff --git a/src/routes/getStatus.ts b/src/routes/getStatus.ts
index c7413ff9c..34abd8cce 100644
--- a/src/routes/getStatus.ts
+++ b/src/routes/getStatus.ts
@@ -2,8 +2,9 @@ import { db } from "../databases/databases";
import { Logger } from "../utils/logger";
import { Request, Response } from "express";
import os from "os";
-import redis from "../utils/redis";
+import redis, { getRedisStats } from "../utils/redis";
import { promiseOrTimeout } from "../utils/promise";
+import { Postgres } from "../databases/Postgres";
export async function getStatus(req: Request, res: Response): Promise {
const startTime = Date.now();
@@ -11,9 +12,10 @@ export async function getStatus(req: Request, res: Response): Promise
value = Array.isArray(value) ? value[0] : value;
let processTime, redisProcessTime = -1;
try {
+ const dbStartTime = Date.now();
const dbVersion = await promiseOrTimeout(db.prepare("get", "SELECT key, value FROM config where key = ?", ["version"]), 5000)
.then(e => {
- processTime = Date.now() - startTime;
+ processTime = Date.now() - dbStartTime;
return e.value;
})
.catch(e => /* istanbul ignore next */ {
@@ -21,9 +23,10 @@ export async function getStatus(req: Request, res: Response): Promise
return -1;
});
let statusRequests: unknown = 0;
+ const redisStartTime = Date.now();
const numberRequests = await promiseOrTimeout(redis.increment("statusRequest"), 5000)
.then(e => {
- redisProcessTime = Date.now() - startTime;
+ redisProcessTime = Date.now() - redisStartTime;
return e;
}).catch(e => /* istanbul ignore next */ {
Logger.error(`status: redis increment timed out ${e}`);
@@ -40,7 +43,9 @@ export async function getStatus(req: Request, res: Response): Promise
redisProcessTime,
loadavg: os.loadavg().slice(1), // only return 5 & 15 minute load average
statusRequests,
- hostname: os.hostname()
+ hostname: os.hostname(),
+ postgresStats: (db as Postgres)?.getStats?.(),
+ redisStats: getRedisStats(),
};
return value ? res.send(JSON.stringify(statusValues[value])) : res.send(statusValues);
} catch (err) /* istanbul ignore next */ {
diff --git a/src/routes/getTopCategoryUsers.ts b/src/routes/getTopCategoryUsers.ts
index 1197e6a23..74853b342 100644
--- a/src/routes/getTopCategoryUsers.ts
+++ b/src/routes/getTopCategoryUsers.ts
@@ -26,7 +26,7 @@ async function generateTopCategoryUsersStats(sortBy: string, category: string) {
SUM("votes") as "userVotes", COALESCE("userNames"."userName", "sponsorTimes"."userID") as "userName" FROM "sponsorTimes" LEFT JOIN "userNames" ON "sponsorTimes"."userID"="userNames"."userID"
LEFT JOIN "shadowBannedUsers" ON "sponsorTimes"."userID"="shadowBannedUsers"."userID"
WHERE "sponsorTimes"."category" = ? AND "sponsorTimes"."votes" > -1 AND "sponsorTimes"."shadowHidden" != 1 AND "shadowBannedUsers"."userID" IS NULL
- GROUP BY COALESCE("userName", "sponsorTimes"."userID") HAVING SUM("votes") > 20
+ GROUP BY COALESCE("userName", "sponsorTimes"."userID") HAVING SUM("votes") > 2
ORDER BY "${sortBy}" DESC LIMIT 100`, [maxRewardTimePerSegmentInSeconds, maxRewardTimePerSegmentInSeconds, category]);
if (rows) {
@@ -34,7 +34,7 @@ async function generateTopCategoryUsersStats(sortBy: string, category: string) {
userNames.push(row.userName);
viewCounts.push(row.viewCount);
totalSubmissions.push(row.totalSubmissions);
- minutesSaved.push(row.minutesSaved);
+ minutesSaved.push(category === "chapter" ? 0 : row.minutesSaved);
}
}
@@ -56,6 +56,10 @@ export async function getTopCategoryUsers(req: Request, res: Response): Promise<
return res.sendStatus(400);
}
+ if (db.highLoad()) {
+ return res.status(503).send("Disabled for load reasons");
+ }
+
//setup which sort type to use
let sortBy = "";
if (sortType == 0) {
diff --git a/src/routes/getTopUsers.ts b/src/routes/getTopUsers.ts
index b4b83a389..f77bc8b4b 100644
--- a/src/routes/getTopUsers.ts
+++ b/src/routes/getTopUsers.ts
@@ -28,14 +28,15 @@ async function generateTopUsersStats(sortBy: string, categoryStatsEnabled = fals
SUM(CASE WHEN category = 'poi_highlight' THEN 1 ELSE 0 END) as "categorySumHighlight",
SUM(CASE WHEN category = 'filler' THEN 1 ELSE 0 END) as "categorySumFiller",
SUM(CASE WHEN category = 'exclusive_access' THEN 1 ELSE 0 END) as "categorySumExclusiveAccess",
+ SUM(CASE WHEN category = 'chapter' THEN 1 ELSE 0 END) as "categorySumChapter",
`;
}
const rows = await db.prepare("all", `SELECT COUNT(*) as "totalSubmissions", SUM(views) as "viewCount",
- SUM(((CASE WHEN "sponsorTimes"."endTime" - "sponsorTimes"."startTime" > ? THEN ? ELSE "sponsorTimes"."endTime" - "sponsorTimes"."startTime" END) / 60) * "sponsorTimes"."views") as "minutesSaved",
+ SUM(CASE WHEN "sponsorTimes"."actionType" = 'chapter' THEN 0 ELSE ((CASE WHEN "sponsorTimes"."endTime" - "sponsorTimes"."startTime" > ? THEN ? ELSE "sponsorTimes"."endTime" - "sponsorTimes"."startTime" END) / 60) * "sponsorTimes"."views" END) as "minutesSaved",
SUM("votes") as "userVotes", ${additionalFields} COALESCE("userNames"."userName", "sponsorTimes"."userID") as "userName" FROM "sponsorTimes" LEFT JOIN "userNames" ON "sponsorTimes"."userID"="userNames"."userID"
LEFT JOIN "shadowBannedUsers" ON "sponsorTimes"."userID"="shadowBannedUsers"."userID"
- WHERE "sponsorTimes"."votes" > -1 AND "sponsorTimes"."shadowHidden" != 1 AND "sponsorTimes"."actionType" != 'chapter' AND "shadowBannedUsers"."userID" IS NULL
+ WHERE "sponsorTimes"."votes" > -1 AND "sponsorTimes"."shadowHidden" != 1 AND "shadowBannedUsers"."userID" IS NULL
GROUP BY COALESCE("userName", "sponsorTimes"."userID") HAVING SUM("votes") > 20
ORDER BY "${sortBy}" DESC LIMIT 100`, [maxRewardTimePerSegmentInSeconds, maxRewardTimePerSegmentInSeconds]);
@@ -55,7 +56,8 @@ async function generateTopUsersStats(sortBy: string, categoryStatsEnabled = fals
row.categorySumPreview,
row.categorySumHighlight,
row.categorySumFiller,
- row.categorySumExclusiveAccess
+ row.categorySumExclusiveAccess,
+ row.categorySumChapter
]);
}
}
@@ -86,6 +88,10 @@ export async function getTopUsers(req: Request, res: Response): Promise {
- const userCountQuery = `(SELECT COUNT(*) FROM (SELECT DISTINCT "userID" from "sponsorTimes") t) "userCount",`;
- const row = await db.prepare("get", `SELECT ${req.query.countContributingUsers ? userCountQuery : ""} COUNT(*) as "totalSubmissions",
- SUM("views") as "viewCount", SUM(("endTime" - "startTime") / 60 * "views") as "minutesSaved" FROM "sponsorTimes" WHERE "shadowHidden" != 1 AND "votes" >= 0 AND "actionType" != 'chapter'`, []);
+ const row = await getStats(!!req.query.countContributingUsers);
+ lastFetch = row;
if (row !== undefined) {
const extensionUsers = chromeUsersCache + firefoxUsersCache;
@@ -43,6 +56,18 @@ export async function getTotalStats(req: Request, res: Response): Promise
}
}
+function getStats(countContributingUsers: boolean): Promise {
+ if (db.highLoad()) {
+ return Promise.resolve(lastFetch);
+ } else {
+ const userCountQuery = `(SELECT COUNT(*) FROM (SELECT DISTINCT "userID" from "sponsorTimes") t) "userCount",`;
+
+ return db.prepare("get", `SELECT ${countContributingUsers ? userCountQuery : ""} COUNT(*) as "totalSubmissions",
+ SUM("views") as "viewCount", SUM(("endTime" - "startTime") / 60 * "views") as "minutesSaved" FROM "sponsorTimes" WHERE "shadowHidden" != 1 AND "votes" >= 0 AND "actionType" != 'chapter'`, []);
+ }
+}
+
+
function updateExtensionUsers() {
if (config.userCounterURL) {
axios.get(`${config.userCounterURL}/api/v1/userCount`)
@@ -68,7 +93,7 @@ function updateExtensionUsers() {
const userDownloadsStartIndex = body.indexOf(matchingString);
if (userDownloadsStartIndex >= 0) {
const closingQuoteIndex = body.indexOf('"', userDownloadsStartIndex + matchingStringLen);
- const userDownloadsStr = body.substr(userDownloadsStartIndex + matchingStringLen, closingQuoteIndex - userDownloadsStartIndex).replace(",","").replace(".","");
+ const userDownloadsStr = body.substr(userDownloadsStartIndex + matchingStringLen, closingQuoteIndex - userDownloadsStartIndex).replace(",", "").replace(".", "");
chromeUsersCache = parseInt(userDownloadsStr);
}
else {
diff --git a/src/routes/getUserInfo.ts b/src/routes/getUserInfo.ts
index b8913ef9d..70f346417 100644
--- a/src/routes/getUserInfo.ts
+++ b/src/routes/getUserInfo.ts
@@ -118,8 +118,7 @@ async function getPermissions(userID: HashedUserID): Promise {
return await oneOf([isUserVIP(userID),
- (async () => !!(await db.prepare("get", `SELECT "timeSubmitted" FROM "sponsorTimes" WHERE "reputation" > 0 AND "timeSubmitted" < 1663872563000 AND "userID" = ? LIMIT 1`, [userID], { useReplica: true })))(),
- (async () => !!(await db.prepare("get", `SELECT "timeSubmitted" FROM "sponsorTimes" WHERE "timeSubmitted" < 1590969600000 AND "userID" = ? LIMIT 1`, [userID], { useReplica: true })))()
+ (async () => !!(await db.prepare("get", `SELECT "timeSubmitted" FROM "sponsorTimes" WHERE "timeSubmitted" < 1666126187000 AND "userID" = ? LIMIT 1`, [userID], { useReplica: true })))()
]);
}
diff --git a/src/routes/getVideoLabel.ts b/src/routes/getVideoLabel.ts
new file mode 100644
index 000000000..ccd17f533
--- /dev/null
+++ b/src/routes/getVideoLabel.ts
@@ -0,0 +1,166 @@
+import { Request, Response } from "express";
+import { db } from "../databases/databases";
+import { videoLabelsHashKey, videoLabelsKey } from "../utils/redisKeys";
+import { SBRecord } from "../types/lib.model";
+import { DBSegment, Segment, Service, VideoData, VideoID, VideoIDHash } from "../types/segments.model";
+import { Logger } from "../utils/logger";
+import { QueryCacher } from "../utils/queryCacher";
+import { getService } from "../utils/getService";
+
+function transformDBSegments(segments: DBSegment[]): Segment[] {
+ return segments.map((chosenSegment) => ({
+ category: chosenSegment.category,
+ actionType: chosenSegment.actionType,
+ segment: [chosenSegment.startTime, chosenSegment.endTime],
+ UUID: chosenSegment.UUID,
+ locked: chosenSegment.locked,
+ votes: chosenSegment.votes,
+ videoDuration: chosenSegment.videoDuration,
+ userID: chosenSegment.userID,
+ description: chosenSegment.description
+ }));
+}
+
+async function getLabelsByVideoID(videoID: VideoID, service: Service): Promise {
+ try {
+ const segments: DBSegment[] = await getSegmentsFromDBByVideoID(videoID, service);
+ return chooseSegment(segments);
+ } catch (err) {
+ if (err) {
+ Logger.error(err as string);
+ return null;
+ }
+ }
+}
+
+async function getLabelsByHash(hashedVideoIDPrefix: VideoIDHash, service: Service): Promise> {
+ const segments: SBRecord = {};
+
+ try {
+ type SegmentWithHashPerVideoID = SBRecord;
+
+ const segmentPerVideoID: SegmentWithHashPerVideoID = (await getSegmentsFromDBByHash(hashedVideoIDPrefix, service))
+ .reduce((acc: SegmentWithHashPerVideoID, segment: DBSegment) => {
+ acc[segment.videoID] = acc[segment.videoID] || {
+ hash: segment.hashedVideoID,
+ segments: []
+ };
+
+ acc[segment.videoID].segments ??= [];
+ acc[segment.videoID].segments.push(segment);
+
+ return acc;
+ }, {});
+
+ for (const [videoID, videoData] of Object.entries(segmentPerVideoID)) {
+ const data: VideoData = {
+ segments: chooseSegment(videoData.segments),
+ };
+
+ if (data.segments.length > 0) {
+ segments[videoID] = data;
+ }
+ }
+
+ return segments;
+ } catch (err) {
+ Logger.error(err as string);
+ return null;
+ }
+}
+
+async function getSegmentsFromDBByHash(hashedVideoIDPrefix: VideoIDHash, service: Service): Promise {
+ const fetchFromDB = () => db
+ .prepare(
+ "all",
+ `SELECT "startTime", "endTime", "videoID", "votes", "locked", "UUID", "userID", "category", "actionType", "hashedVideoID", "description" FROM "sponsorTimes"
+ WHERE "hashedVideoID" LIKE ? AND "service" = ? AND "actionType" = 'full' AND "hidden" = 0 AND "shadowHidden" = 0`,
+ [`${hashedVideoIDPrefix}%`, service]
+ ) as Promise;
+
+ if (hashedVideoIDPrefix.length === 4) {
+ return await QueryCacher.get(fetchFromDB, videoLabelsHashKey(hashedVideoIDPrefix, service));
+ }
+
+ return await fetchFromDB();
+}
+
+async function getSegmentsFromDBByVideoID(videoID: VideoID, service: Service): Promise {
+ const fetchFromDB = () => db
+ .prepare(
+ "all",
+ `SELECT "startTime", "endTime", "votes", "locked", "UUID", "userID", "category", "actionType", "description" FROM "sponsorTimes"
+ WHERE "videoID" = ? AND "service" = ? AND "actionType" = 'full' AND "hidden" = 0 AND "shadowHidden" = 0`,
+ [videoID, service]
+ ) as Promise;
+
+ return await QueryCacher.get(fetchFromDB, videoLabelsKey(videoID, service));
+}
+
+function chooseSegment(choices: T[]): Segment[] {
+ // filter out -2 segments
+ choices = choices.filter((segment) => segment.votes > -2);
+ const results = [];
+ // trivial decisions
+ if (choices.length === 0) {
+ return [];
+ } else if (choices.length === 1) {
+ return transformDBSegments(choices);
+ }
+ // if locked, only choose from locked
+ const locked = choices.filter((segment) => segment.locked);
+ if (locked.length > 0) {
+ choices = locked;
+ }
+ //no need to filter, just one label
+ if (choices.length === 1) {
+ return transformDBSegments(choices);
+ }
+ // sponsor > exclusive > selfpromo
+ const findCategory = (category: string) => choices.find((segment) => segment.category === category);
+
+ const categoryResult = findCategory("sponsor") ?? findCategory("exclusive_access") ?? findCategory("selfpromo");
+ if (categoryResult) results.push(categoryResult);
+
+ return transformDBSegments(results);
+}
+
+async function handleGetLabel(req: Request, res: Response): Promise {
+ const videoID = req.query.videoID as VideoID;
+ if (!videoID) {
+ res.status(400).send("videoID not specified");
+ return false;
+ }
+
+ const service = getService(req.query.service, req.body.service);
+ const segments = await getLabelsByVideoID(videoID, service);
+
+ if (!segments || segments.length === 0) {
+ res.sendStatus(404);
+ return false;
+ }
+
+ return segments;
+}
+
+async function endpoint(req: Request, res: Response): Promise {
+ try {
+ const segments = await handleGetLabel(req, res);
+
+ // If false, res.send has already been called
+ if (segments) {
+ //send result
+ return res.send(segments);
+ }
+ } catch (err) {
+ if (err instanceof SyntaxError) {
+ return res.status(400).send("Categories parameter does not match format requirements.");
+ } else return res.sendStatus(500);
+ }
+}
+
+export {
+ getLabelsByVideoID,
+ getLabelsByHash,
+ endpoint
+};
diff --git a/src/routes/getVideoLabelByHash.ts b/src/routes/getVideoLabelByHash.ts
new file mode 100644
index 000000000..23ba053c9
--- /dev/null
+++ b/src/routes/getVideoLabelByHash.ts
@@ -0,0 +1,26 @@
+import { hashPrefixTester } from "../utils/hashPrefixTester";
+import { getLabelsByHash } from "./getVideoLabel";
+import { Request, Response } from "express";
+import { VideoIDHash, Service } from "../types/segments.model";
+import { getService } from "../utils/getService";
+
+export async function getVideoLabelsByHash(req: Request, res: Response): Promise {
+ let hashPrefix = req.params.prefix as VideoIDHash;
+ if (!req.params.prefix || !hashPrefixTester(req.params.prefix)) {
+ return res.status(400).send("Hash prefix does not match format requirements."); // Exit early on faulty prefix
+ }
+ hashPrefix = hashPrefix.toLowerCase() as VideoIDHash;
+
+ const service: Service = getService(req.query.service, req.body.service);
+
+ // Get all video id's that match hash prefix
+ const segments = await getLabelsByHash(hashPrefix, service);
+
+ if (!segments) return res.status(404).json([]);
+
+ const output = Object.entries(segments).map(([videoID, data]) => ({
+ videoID,
+ segments: data.segments,
+ }));
+ return res.status(output.length === 0 ? 404 : 200).json(output);
+}
diff --git a/src/routes/oldGetVideoSponsorTimes.ts b/src/routes/oldGetVideoSponsorTimes.ts
deleted file mode 100644
index 90a58ae62..000000000
--- a/src/routes/oldGetVideoSponsorTimes.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { handleGetSegments } from "./getSkipSegments";
-import { Request, Response } from "express";
-
-export async function oldGetVideoSponsorTimes(req: Request, res: Response): Promise {
- const segments = await handleGetSegments(req, res);
-
- if (segments) {
- // Convert to old outputs
- const sponsorTimes = [];
- const UUIDs = [];
-
- for (const segment of segments) {
- sponsorTimes.push(segment.segment);
- UUIDs.push(segment.UUID);
- }
-
- return res.send({
- sponsorTimes,
- UUIDs,
- });
- }
-
- // Error has already been handled in the other method
-}
diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts
index 70c043d15..58d57c963 100644
--- a/src/routes/postSkipSegments.ts
+++ b/src/routes/postSkipSegments.ts
@@ -22,6 +22,7 @@ import axios from "axios";
import { vote } from "./voteOnSponsorTime";
import { canSubmit } from "../utils/permissions";
import { getVideoDetails, videoDetails } from "../utils/getVideoDetails";
+import * as youtubeID from "../utils/youtubeID";
type CheckResult = {
pass: boolean,
@@ -189,15 +190,23 @@ async function checkUserActiveWarning(userID: string): Promise {
}
async function checkInvalidFields(videoID: VideoID, userID: UserID, hashedUserID: HashedUserID
- , segments: IncomingSegment[], videoDurationParam: number, userAgent: string): Promise {
+ , segments: IncomingSegment[], videoDurationParam: number, userAgent: string, service: Service): Promise {
const invalidFields = [];
const errors = [];
if (typeof videoID !== "string" || videoID?.length == 0) {
invalidFields.push("videoID");
}
- if (typeof userID !== "string" || userID?.length < 30) {
+ if (service === Service.YouTube && config.mode !== "test") {
+ const sanitizedVideoID = youtubeID.validate(videoID) ? videoID : youtubeID.sanitize(videoID);
+ if (!youtubeID.validate(sanitizedVideoID)) {
+ invalidFields.push("videoID");
+ errors.push("YouTube videoID could not be extracted");
+ }
+ }
+ const minLength = config.minUserIDLength;
+ if (typeof userID !== "string" || userID?.length < minLength) {
invalidFields.push("userID");
- if (userID?.length < 30) errors.push(`userID must be at least 30 characters long`);
+ if (userID?.length < minLength) errors.push(`userID must be at least ${minLength} characters long`);
}
if (!Array.isArray(segments) || segments.length == 0) {
invalidFields.push("segments");
@@ -270,9 +279,10 @@ async function checkEachSegmentValid(rawIP: IPAddress, paramUserID: UserID, user
pass: false,
errorCode: 403,
errorMessage:
- `Users have voted that new segments aren't needed for the following category: ` +
+ `Users have voted that all the segments required for this video have already been submitted for the following category: ` +
`'${segments[i].category}'\n` +
- `${lockedCategoryList[lockIndex].reason?.length !== 0 ? `\nReason: '${lockedCategoryList[lockIndex].reason}'` : ""}\n` +
+ `${lockedCategoryList[lockIndex].reason?.length !== 0 ? `\nReason: '${lockedCategoryList[lockIndex].reason}\n'` : ""}` +
+ `You may need to refresh if you don't see the segments.\n` +
`${(segments[i].category === "sponsor" ? "\nMaybe the segment you are submitting is a different category that you have not enabled and is not a sponsor. " +
"Categories that aren't sponsor, such as self-promotion can be enabled in the options.\n" : "")}` +
`\nIf you believe this is incorrect, please contact someone on chat.sponsor.ajay.app, discord.gg/SponsorBlock or matrix.to/#/#sponsor:ajay.app`
@@ -338,7 +348,7 @@ async function checkByAutoModerator(videoID: any, userID: any, segments: Array {
+ const userIDHash = await getHashCache(userID);
+ const userNameHash = await getHashCache(username);
+ if (userIDHash == userNameHash) return false;
+ const sponsorTimeRow = await db.prepare("get", `SELECT "userID" FROM "sponsorTimes" WHERE "userID" = ? LIMIT 1`, [userNameHash]);
+ const userNameRow = await db.prepare("get", `SELECT "userID" FROM "userNames" WHERE "userID" = ? LIMIT 1`, [userNameHash]);
+ if ((sponsorTimeRow || userNameRow)?.userID) return false;
+ return true;
+}
\ No newline at end of file
diff --git a/src/routes/verifyToken.ts b/src/routes/verifyToken.ts
index dfbb0163a..f696da036 100644
--- a/src/routes/verifyToken.ts
+++ b/src/routes/verifyToken.ts
@@ -11,7 +11,7 @@ interface VerifyTokenRequest extends Request {
}
}
-export const validatelicenseKeyRegex = (token: string) =>
+export const validateLicenseKeyRegex = (token: string) =>
new RegExp(/[A-Za-z0-9]{40}|[A-Za-z0-9-]{35}/).test(token);
export async function verifyTokenRequest(req: VerifyTokenRequest, res: Response): Promise {
@@ -19,7 +19,7 @@ export async function verifyTokenRequest(req: VerifyTokenRequest, res: Response)
if (!licenseKey) {
return res.status(400).send("Invalid request");
- } else if (!validatelicenseKeyRegex(licenseKey)) {
+ } else if (!validateLicenseKeyRegex(licenseKey)) {
// fast check for invalid licence key
return res.status(200).send({
allowed: false
@@ -67,7 +67,7 @@ export async function verifyTokenRequest(req: VerifyTokenRequest, res: Response)
async function checkAllGumroadProducts(licenseKey: string): Promise {
for (const link of config.gumroad.productPermalinks) {
try {
- const result = await axios.post("https://api.gumroad.com/v2/licenses/verify", {
+ const result = await axios.post("https://api.gumroad.com/v2/licenses/verify", null, {
params: { product_permalink: link, license_key: licenseKey }
});
diff --git a/src/routes/viewedVideoSponsorTime.ts b/src/routes/viewedVideoSponsorTime.ts
index f111cab13..168a92dc4 100644
--- a/src/routes/viewedVideoSponsorTime.ts
+++ b/src/routes/viewedVideoSponsorTime.ts
@@ -2,9 +2,9 @@ import { db } from "../databases/databases";
import { Request, Response } from "express";
export async function viewedVideoSponsorTime(req: Request, res: Response): Promise {
- const UUID = req.query.UUID;
+ const UUID = req.query?.UUID;
- if (UUID == undefined) {
+ if (!UUID) {
//invalid request
return res.sendStatus(400);
}
diff --git a/src/routes/voteOnSponsorTime.ts b/src/routes/voteOnSponsorTime.ts
index b7dc63366..dafc3c356 100644
--- a/src/routes/voteOnSponsorTime.ts
+++ b/src/routes/voteOnSponsorTime.ts
@@ -14,6 +14,7 @@ import { DBSegment, Category, HashedIP, IPAddress, SegmentUUID, Service, VideoID
import { QueryCacher } from "../utils/queryCacher";
import axios from "axios";
import { getVideoDetails, videoDetails } from "../utils/getVideoDetails";
+import { deleteLockCategories } from "./deleteLockCategories";
const voteTypes = {
normal: 0,
@@ -59,7 +60,7 @@ async function updateSegmentVideoDuration(UUID: SegmentUUID) {
let apiVideoDetails: videoDetails = null;
if (service == Service.YouTube) {
// don't use cache since we have no information about the video length
- apiVideoDetails = await getVideoDetails(videoID);
+ apiVideoDetails = await getVideoDetails(videoID, true);
}
const apiVideoDuration = apiVideoDetails?.duration as VideoDuration;
if (videoDurationChanged(videoDuration, apiVideoDuration)) {
@@ -95,6 +96,7 @@ async function checkVideoDuration(UUID: SegmentUUID) {
AND "hidden" = 0 AND "shadowHidden" = 0 AND
"actionType" != 'full' AND "votes" > -2`,
[videoID, service, latestSubmission.timeSubmitted]);
+ deleteLockCategories(videoID, null, null, service).catch(Logger.error);
}
}
@@ -305,7 +307,7 @@ export async function vote(ip: IPAddress, UUID: SegmentUUID, paramUserID: UserID
return { status: 400 };
}
// Ignore this vote, invalid
- if (paramUserID.length < 30 && config.mode !== "test") {
+ if (paramUserID.length < config.minUserIDLength) {
return { status: 200 };
}
diff --git a/src/types/config.model.ts b/src/types/config.model.ts
index 406643c71..058048ec2 100644
--- a/src/types/config.model.ts
+++ b/src/types/config.model.ts
@@ -5,18 +5,34 @@ interface RedisConfig extends redis.RedisClientOptions {
enabled: boolean;
expiryTime: number;
getTimeout: number;
+ maxConnections: number;
+ maxWriteConnections: number;
+ stopWritingAfterResponseTime: number;
+ responseTimePause: number;
+ disableHashCache: boolean;
+}
+
+interface RedisReadOnlyConfig extends redis.RedisClientOptions {
+ enabled: boolean;
+ weight: number;
}
export interface CustomPostgresConfig extends PoolConfig {
enabled: boolean;
maxTries: number;
- maxConcurrentRequests: number;
+}
+
+export interface CustomWritePostgresConfig extends CustomPostgresConfig {
+ maxActiveRequests: number;
+ timeout: number;
+ highLoadThreshold: number;
}
export interface CustomPostgresReadOnlyConfig extends CustomPostgresConfig {
weight: number;
readTimeout: number;
fallbackOnFail: boolean;
+ stopRetryThreshold: number;
}
export interface SBSConfig {
@@ -36,6 +52,7 @@ export interface SBSConfig {
minReputationToSubmitChapter: number;
minReputationToSubmitFiller: number;
userCounterURL?: string;
+ userCounterRatio: number;
proxySubmission?: string;
behindProxy: string | boolean;
db: string;
@@ -61,8 +78,10 @@ export interface SBSConfig {
minimumPrefix?: string;
maximumPrefix?: string;
redis?: RedisConfig;
+ redisRead?: RedisReadOnlyConfig;
+ redisRateLimit: boolean;
maxRewardTimePerSegmentInSeconds?: number;
- postgres?: CustomPostgresConfig;
+ postgres?: CustomWritePostgresConfig;
postgresReadOnly?: CustomPostgresReadOnlyConfig;
dumpDatabase?: DumpDatabase;
diskCacheURL: string;
@@ -75,7 +94,8 @@ export interface SBSConfig {
}
gumroad: {
productPermalinks: string[],
- }
+ },
+ minUserIDLength: number
}
export interface WebhookConfig {
diff --git a/src/types/innerTubeApi.model.ts b/src/types/innerTubeApi.model.ts
index 28e46c826..04c102882 100644
--- a/src/types/innerTubeApi.model.ts
+++ b/src/types/innerTubeApi.model.ts
@@ -1,7 +1,7 @@
export interface innerTubeVideoDetails {
"videoId": string,
"title": string,
- "lengthSeconds": string, // yes, don't ask.
+ "lengthSeconds"?: string, // yes, don't ask.
"channelId": string,
"isOwnerViewing": boolean,
"shortDescription": string,
diff --git a/src/types/segments.model.ts b/src/types/segments.model.ts
index 841bb99c7..8e7a785b4 100644
--- a/src/types/segments.model.ts
+++ b/src/types/segments.model.ts
@@ -5,7 +5,7 @@ import { HashedUserID, UserID } from "./user.model";
export type SegmentUUID = string & { __segmentUUIDBrand: unknown };
export type VideoID = string & { __videoIDBrand: unknown };
export type VideoDuration = number & { __videoDurationBrand: unknown };
-export type Category = ("sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler" | "poi_highlight" | "chapter") & { __categoryBrand: unknown };
+export type Category = ("sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "poi_highlight" | "chapter" | "filler" | "exclusive_access") & { __categoryBrand: unknown };
export type VideoIDHash = VideoID & HashedValue;
export type IPAddress = string & { __ipAddressBrand: unknown };
export type HashedIP = IPAddress & HashedValue;
@@ -45,6 +45,9 @@ export interface Segment {
segment: number[];
UUID: SegmentUUID;
videoDuration: VideoDuration;
+ locked: boolean;
+ votes: number;
+ description: string;
}
export enum Visibility {
@@ -94,7 +97,6 @@ export interface VotableObjectWithWeight extends VotableObject {
}
export interface VideoData {
- hash: VideoIDHash;
segments: Segment[];
}
diff --git a/src/utils/diskCache.ts b/src/utils/diskCache.ts
index c03c7506a..798f4d95c 100644
--- a/src/utils/diskCache.ts
+++ b/src/utils/diskCache.ts
@@ -1,15 +1,23 @@
import axios, { AxiosError } from "axios";
+import { Agent } from "http";
import { config } from "../config";
import { Logger } from "./logger";
+const httpAgent = new Agent({ keepAlive: true });
+
class DiskCache {
async set(key: string, value: unknown): Promise {
if (!config.diskCacheURL) return false;
try {
- const result = await axios.post(`${config.diskCacheURL}/api/v1/item`, {
- key,
- value
+ const result = await axios({
+ method: "post",
+ url: `${config.diskCacheURL}/api/v1/item`,
+ data: {
+ key,
+ value
+ },
+ httpAgent
});
return result.status === 200;
diff --git a/src/utils/getHashCache.ts b/src/utils/getHashCache.ts
index 7ff0ef0aa..0c15cc0a6 100644
--- a/src/utils/getHashCache.ts
+++ b/src/utils/getHashCache.ts
@@ -3,6 +3,7 @@ import { shaHashKey } from "../utils/redisKeys";
import { HashedValue } from "../types/hash.model";
import { Logger } from "../utils/logger";
import { getHash } from "../utils/getHash";
+import { config } from "../config";
const defaultedHashTimes = 5000;
const cachedHashTimes = defaultedHashTimes - 1;
@@ -19,20 +20,25 @@ export async function getHashCache(value: T, times = defaulted
async function getFromRedis(key: HashedValue): Promise {
const redisKey = shaHashKey(key);
- try {
- const reply = await redis.get(redisKey);
+ if (!config.redis?.disableHashCache) {
+ try {
+ const reply = await redis.get(redisKey);
- if (reply) {
- Logger.debug(`Got data from redis: ${reply}`);
- return reply as T & HashedValue;
+ if (reply) {
+ Logger.debug(`Got data from redis: ${reply}`);
+ return reply as T & HashedValue;
+ }
+ } catch (err) {
+ Logger.error(err as string);
}
- } catch (err) {
- Logger.error(err as string);
}
// Otherwise, calculate it
const data = getHash(key, cachedHashTimes);
- redis.set(redisKey, data).catch((err) => Logger.error(err));
+
+ if (!config.redis?.disableHashCache) {
+ redis.set(redisKey, data).catch((err) => Logger.error(err));
+ }
return data as T & HashedValue;
}
\ No newline at end of file
diff --git a/src/utils/getSubmissionUUID.ts b/src/utils/getSubmissionUUID.ts
index 89a525c92..aafec8055 100644
--- a/src/utils/getSubmissionUUID.ts
+++ b/src/utils/getSubmissionUUID.ts
@@ -7,10 +7,11 @@ export function getSubmissionUUID(
videoID: VideoID,
category: Category,
actionType: ActionType,
+ description: string,
userID: UserID,
startTime: number,
endTime: number,
service: Service
) : HashedValue {
- return `${getHash(`${videoID}${startTime}${endTime}${userID}${category}${actionType}${service}`, 1)}6` as HashedValue;
+ return `${getHash(`${videoID}${startTime}${endTime}${userID}${description}${category}${actionType}${service}`, 1)}7` as HashedValue;
}
diff --git a/src/utils/innerTubeAPI.ts b/src/utils/innerTubeAPI.ts
index 475cda93d..dbdd728fc 100644
--- a/src/utils/innerTubeAPI.ts
+++ b/src/utils/innerTubeAPI.ts
@@ -3,6 +3,30 @@ import { Logger } from "./logger";
import { innerTubeVideoDetails } from "../types/innerTubeApi.model";
import DiskCache from "./diskCache";
+const privateResponse = (videoId: string): innerTubeVideoDetails => ({
+ videoId,
+ title: "",
+ channelId: "",
+ // exclude video duration
+ isOwnerViewing: false,
+ shortDescription: "",
+ isCrawlable: false,
+ thumbnail: {
+ thumbnails: [{
+ url: "https://s.ytimg.com/yts/img/meh7-vflGevej7.png",
+ width: 140,
+ height: 100
+ }]
+ },
+ allowRatings: false,
+ viewCount: "0", // yes, don't ask
+ author: "",
+ isPrivate: true,
+ isUnpluggedCorpus: true,
+ isLiveContent: false,
+ publishDate: ""
+});
+
async function getFromITube (videoID: string): Promise {
// start subrequest
const url = "https://www.youtube.com/youtubei/v1/player";
@@ -10,7 +34,7 @@ async function getFromITube (videoID: string): Promise {
context: {
client: {
clientName: "WEB",
- clientVersion: "2.20211129.09.00"
+ clientVersion: "2.20221215.04.01"
}
},
videoId: videoID
@@ -20,9 +44,9 @@ async function getFromITube (videoID: string): Promise {
});
/* istanbul ignore else */
if (result.status === 200) {
- return result.data.videoDetails;
+ return result.data?.videoDetails ?? privateResponse(videoID);
} else {
- return Promise.reject(result.status);
+ return Promise.reject(`Innertube returned non-200 response: ${result.status}`);
}
}
diff --git a/src/utils/parseSkipSegments.ts b/src/utils/parseSkipSegments.ts
new file mode 100644
index 000000000..f9e5b96fb
--- /dev/null
+++ b/src/utils/parseSkipSegments.ts
@@ -0,0 +1,75 @@
+import { Request } from "express";
+import { ActionType, SegmentUUID, Category, Service } from "../types/segments.model";
+import { getService } from "./getService";
+
+type fn = (req: Request) => any[];
+
+const syntaxErrorWrapper = (fn: fn, req: Request) => {
+ try { return fn(req); }
+ catch (e) { return undefined; }
+};
+
+// Default to sponsor
+const getCategories = (req: Request): Category[] =>
+ req.query.categories
+ ? JSON.parse(req.query.categories as string)
+ : req.query.category
+ ? Array.isArray(req.query.category)
+ ? req.query.category
+ : [req.query.category]
+ : ["sponsor"];
+
+// Default to skip
+const getActionTypes = (req: Request): ActionType[] =>
+ req.query.actionTypes
+ ? JSON.parse(req.query.actionTypes as string)
+ : req.query.actionType
+ ? Array.isArray(req.query.actionType)
+ ? req.query.actionType
+ : [req.query.actionType]
+ : [ActionType.Skip];
+
+// Default to empty array
+const getRequiredSegments = (req: Request): SegmentUUID[] =>
+ req.query.requiredSegments
+ ? JSON.parse(req.query.requiredSegments as string)
+ : req.query.requiredSegment
+ ? Array.isArray(req.query.requiredSegment)
+ ? req.query.requiredSegment
+ : [req.query.requiredSegment]
+ : [];
+
+const errorMessage = (parameter: string) => `${parameter} parameter does not match format requirements.`;
+
+export function parseSkipSegments(req: Request): {
+ categories: Category[];
+ actionTypes: ActionType[];
+ requiredSegments: SegmentUUID[];
+ service: Service;
+ errors: string[];
+} {
+ let categories: Category[] = syntaxErrorWrapper(getCategories, req);
+ const actionTypes: ActionType[] = syntaxErrorWrapper(getActionTypes, req);
+ const requiredSegments: SegmentUUID[] = syntaxErrorWrapper(getRequiredSegments, req);
+ const service: Service = getService(req.query.service, req.body.services);
+ const errors: string[] = [];
+ if (!Array.isArray(categories)) errors.push(errorMessage("categories"));
+ else {
+ // check category names for invalid characters
+ // and none string elements
+ categories = categories
+ .filter((item: any) => typeof item === "string")
+ .filter((category) => !(/[^a-z|_|-]/.test(category)));
+ if (categories.length === 0) errors.push("No valid categories provided.");
+ }
+ if (!Array.isArray(actionTypes)) errors.push(errorMessage("actionTypes"));
+ if (!Array.isArray(requiredSegments)) errors.push(errorMessage("requiredSegments"));
+ // finished parsing
+ return {
+ categories,
+ actionTypes,
+ requiredSegments,
+ service,
+ errors
+ };
+}
\ No newline at end of file
diff --git a/src/utils/permissions.ts b/src/utils/permissions.ts
index f64000d59..b981883a9 100644
--- a/src/utils/permissions.ts
+++ b/src/utils/permissions.ts
@@ -9,7 +9,7 @@ import { getReputation } from "./reputation";
interface CanSubmitResult {
canSubmit: boolean;
- reason?: string;
+ reason: string;
}
async function lowDownvotes(userID: HashedUserID): Promise {
@@ -27,11 +27,13 @@ export async function canSubmit(userID: HashedUserID, category: Category): Promi
lowDownvotes(userID),
(async () => (await getReputation(userID)) > config.minReputationToSubmitChapter)(),
hasFeature(userID, Feature.ChapterSubmitter)
- ])
+ ]),
+ reason: "Submitting chapters requires a minimum reputation. You can ask on Discord/Matrix to get permission with less reputation."
};
default:
return {
- canSubmit: true
+ canSubmit: true,
+ reason: ""
};
}
}
\ No newline at end of file
diff --git a/src/utils/queryCacher.ts b/src/utils/queryCacher.ts
index cb1faebd9..6b0226826 100644
--- a/src/utils/queryCacher.ts
+++ b/src/utils/queryCacher.ts
@@ -1,6 +1,6 @@
import redis from "../utils/redis";
import { Logger } from "../utils/logger";
-import { skipSegmentsHashKey, skipSegmentsKey, reputationKey, ratingHashKey, skipSegmentGroupsKey, userFeatureKey } from "./redisKeys";
+import { skipSegmentsHashKey, skipSegmentsKey, reputationKey, ratingHashKey, skipSegmentGroupsKey, userFeatureKey, videoLabelsKey, videoLabelsHashKey } from "./redisKeys";
import { Service, VideoID, VideoIDHash } from "../types/segments.model";
import { Feature, HashedUserID, UserID } from "../types/user.model";
import { config } from "../config";
@@ -81,10 +81,23 @@ function clearSegmentCache(videoInfo: { videoID: VideoID; hashedVideoID: VideoID
redis.del(skipSegmentsKey(videoInfo.videoID, videoInfo.service)).catch((err) => Logger.error(err));
redis.del(skipSegmentGroupsKey(videoInfo.videoID, videoInfo.service)).catch((err) => Logger.error(err));
redis.del(skipSegmentsHashKey(videoInfo.hashedVideoID, videoInfo.service)).catch((err) => Logger.error(err));
+ redis.del(videoLabelsKey(videoInfo.hashedVideoID, videoInfo.service)).catch((err) => Logger.error(err));
+ redis.del(videoLabelsHashKey(videoInfo.hashedVideoID, videoInfo.service)).catch((err) => Logger.error(err));
if (videoInfo.userID) redis.del(reputationKey(videoInfo.userID)).catch((err) => Logger.error(err));
}
}
+async function getKeyLastModified(key: string): Promise {
+ if (!config.redis?.enabled) return Promise.reject("ETag - Redis not enabled");
+ return await redis.ttl(key)
+ .then(ttl => {
+ const sinceLive = config.redis?.expiryTime - ttl;
+ const now = Math.floor(Date.now() / 1000);
+ return new Date((now-sinceLive) * 1000);
+ })
+ .catch(() => Promise.reject("ETag - Redis error"));
+}
+
function clearRatingCache(videoInfo: { hashedVideoID: VideoIDHash; service: Service;}): void {
if (videoInfo) {
redis.del(ratingHashKey(videoInfo.hashedVideoID, videoInfo.service)).catch((err) => Logger.error(err));
@@ -99,6 +112,7 @@ export const QueryCacher = {
get,
getAndSplit,
clearSegmentCache,
+ getKeyLastModified,
clearRatingCache,
- clearFeatureCache
+ clearFeatureCache,
};
\ No newline at end of file
diff --git a/src/utils/redis.ts b/src/utils/redis.ts
index 8e8c6d013..ef55906f9 100644
--- a/src/utils/redis.ts
+++ b/src/utils/redis.ts
@@ -5,6 +5,13 @@ import { RedisCommandArgument, RedisCommandArguments, RedisCommandRawReply } fro
import { RedisClientOptions } from "@redis/client/dist/lib/client";
import { RedisReply } from "rate-limit-redis";
+export interface RedisStats {
+ activeRequests: number;
+ writeRequests: number;
+ avgReadTime: number;
+ avgWriteTime: number;
+}
+
interface RedisSB {
get(key: RedisCommandArgument): Promise;
set(key: RedisCommandArgument, value: RedisCommandArgument): Promise;
@@ -12,6 +19,7 @@ interface RedisSB {
del(...keys: [RedisCommandArgument]): Promise;
increment?(key: RedisCommandArgument): Promise;
sendCommand(args: RedisCommandArguments, options?: RedisClientOptions): Promise;
+ ttl(key: RedisCommandArgument): Promise;
quit(): Promise;
}
@@ -23,22 +31,99 @@ let exportClient: RedisSB = {
increment: () => new Promise((resolve) => resolve(null)),
sendCommand: () => new Promise((resolve) => resolve(null)),
quit: () => new Promise((resolve) => resolve(null)),
+ ttl: () => new Promise((resolve) => resolve(null)),
};
+let lastClientFail = 0;
+let lastReadFail = 0;
+let activeRequests = 0;
+let writeRequests = 0;
+
+const readResponseTime: number[] = [];
+const writeResponseTime: number[] = [];
+let lastResponseTimeLimit = 0;
+const maxStoredTimes = 200;
+
+export let connectionPromise = Promise.resolve();
+
if (config.redis?.enabled) {
Logger.info("Connected to redis");
const client = createClient(config.redis);
- void client.connect(); // void as we don't care about the promise
+ const readClient = config.redisRead?.enabled ? createClient(config.redisRead) : null;
+ connectionPromise = client.connect();
+ void readClient?.connect(); // void as we don't care about the promise
exportClient = client as RedisSB;
+
const get = client.get.bind(client);
+ const getRead = readClient?.get?.bind(readClient);
exportClient.get = (key) => new Promise((resolve, reject) => {
+ if (config.redis.maxConnections && activeRequests > config.redis.maxConnections) {
+ reject("Too many active requests");
+ return;
+ }
+
+ const start = Date.now();
+ activeRequests++;
+
const timeout = config.redis.getTimeout ? setTimeout(() => reject(), config.redis.getTimeout) : null;
- get(key).then((reply) => {
+ const chosenGet = pickChoice(get, getRead);
+ chosenGet(key).then((reply) => {
if (timeout !== null) clearTimeout(timeout);
+
+ activeRequests--;
resolve(reply);
- }).catch((err) => reject(err));
+
+ const responseTime = Date.now() - start;
+ readResponseTime.push(responseTime);
+ if (readResponseTime.length > maxStoredTimes) readResponseTime.shift();
+ if (config.redis.stopWritingAfterResponseTime
+ && responseTime > config.redis.stopWritingAfterResponseTime) {
+ lastResponseTimeLimit = Date.now();
+ }
+ }).catch((err) => {
+ if (chosenGet === get) {
+ lastClientFail = Date.now();
+ } else {
+ lastReadFail = Date.now();
+ }
+
+ activeRequests--;
+ reject(err);
+ });
});
+
+ const setFun = >(func: (...args: T) => Promise, params: T): Promise =>
+ new Promise((resolve, reject) => {
+ if ((config.redis.maxWriteConnections && activeRequests > config.redis.maxWriteConnections)
+ || (config.redis.responseTimePause
+ && Date.now() - lastResponseTimeLimit < config.redis.responseTimePause)) {
+ reject("Too many active requests to write");
+ return;
+ }
+
+ const start = Date.now();
+ activeRequests++;
+ writeRequests++;
+
+ func(...params).then((reply) => {
+ activeRequests--;
+ writeRequests--;
+ resolve(reply);
+
+ writeResponseTime.push(Date.now() - start);
+ if (writeResponseTime.length > maxStoredTimes) writeResponseTime.shift();
+ }).catch((err) => {
+ activeRequests--;
+ writeRequests--;
+ reject(err);
+ });
+ });
+
+ const set = client.set.bind(client);
+ const setEx = client.setEx.bind(client);
+ exportClient.set = (key, value) => setFun(set, [key, value]);
+ exportClient.setEx = (key, seconds, value) => setFun(setEx, [key, seconds, value]);
exportClient.increment = (key) => new Promise((resolve, reject) =>
void client.multi()
.incr(key)
@@ -48,11 +133,40 @@ if (config.redis?.enabled) {
.catch((err) => reject(err))
);
client.on("error", function(error) {
+ lastClientFail = Date.now();
Logger.error(`Redis Error: ${error}`);
});
client.on("reconnect", () => {
Logger.info("Redis: trying to reconnect");
});
+ readClient?.on("error", function(error) {
+ lastReadFail = Date.now();
+ Logger.error(`Redis Read-Only Error: ${error}`);
+ });
+ readClient?.on("reconnect", () => {
+ Logger.info("Redis Read-Only: trying to reconnect");
+ });
+}
+
+function pickChoice(client: T, readClient: T): T {
+ const readAvailable = !!readClient;
+ const ignoreReadDueToFailure = lastReadFail > Date.now() - 1000 * 30;
+ const readDueToFailure = lastClientFail > Date.now() - 1000 * 30;
+ if (readAvailable && !ignoreReadDueToFailure && (readDueToFailure ||
+ Math.random() > 1 / (config.redisRead?.weight + 1))) {
+ return readClient;
+ } else {
+ return client;
+ }
+}
+
+export function getRedisStats(): RedisStats {
+ return {
+ activeRequests,
+ writeRequests,
+ avgReadTime: readResponseTime.length > 0 ? readResponseTime.reduce((a, b) => a + b, 0) / readResponseTime.length : 0,
+ avgWriteTime: writeResponseTime.length > 0 ? writeResponseTime.reduce((a, b) => a + b, 0) / writeResponseTime.length : 0,
+ };
}
export default exportClient;
diff --git a/src/utils/redisKeys.ts b/src/utils/redisKeys.ts
index 86cfcefad..e482e10e6 100644
--- a/src/utils/redisKeys.ts
+++ b/src/utils/redisKeys.ts
@@ -38,6 +38,16 @@ export function shaHashKey(singleIter: HashedValue): string {
export const tempVIPKey = (userID: HashedUserID): string =>
`vip.temp.${userID}`;
+export const videoLabelsKey = (videoID: VideoID, service: Service): string =>
+ `labels.v1.${service}.videoID.${videoID}`;
+
+export function videoLabelsHashKey(hashedVideoIDPrefix: VideoIDHash, service: Service): string {
+ hashedVideoIDPrefix = hashedVideoIDPrefix.substring(0, 4) as VideoIDHash;
+ if (hashedVideoIDPrefix.length !== 4) Logger.warn(`Redis skip segment hash-prefix key is not length 4! ${hashedVideoIDPrefix}`);
+
+ return `labels.v1.${service}.${hashedVideoIDPrefix}`;
+}
+
export function userFeatureKey (userID: HashedUserID, feature: Feature): string {
return `user.${userID}.feature.${feature}`;
}
\ No newline at end of file
diff --git a/src/utils/tokenUtils.ts b/src/utils/tokenUtils.ts
index 7c5ad3c05..e936b4556 100644
--- a/src/utils/tokenUtils.ts
+++ b/src/utils/tokenUtils.ts
@@ -58,12 +58,11 @@ export async function createAndSaveToken(type: TokenType, code?: string): Promis
return licenseKey;
}
- } catch (e) {
+ break;
+ } catch (e) /* istanbul ignore next */ {
Logger.error(`token creation: ${e}`);
return null;
}
-
- break;
}
case TokenType.local: {
const licenseKey = generateToken();
@@ -74,7 +73,6 @@ export async function createAndSaveToken(type: TokenType, code?: string): Promis
return licenseKey;
}
}
-
return null;
}
@@ -102,15 +100,12 @@ export async function refreshToken(type: TokenType, licenseKey: string, refreshT
return true;
}
- } catch (e) {
+ } catch (e) /* istanbul ignore next */ {
Logger.error(`token refresh: ${e}`);
return false;
}
-
- break;
}
}
-
return false;
}
@@ -136,9 +131,8 @@ export async function getPatreonIdentity(accessToken: string): Promise?(?:\\s|$)`);
+const negateIdRegex = new RegExp(/(?:[^0-9A-Za-z_-]*?)/);
+const looseEndsRegex = new RegExp(`${negateIdRegex.source}${idRegex.source}${negateIdRegex.source}`);
+
+export const validate = (id: string): boolean => exclusiveIdegex.test(id);
+
+export const sanitize = (id: string): VideoID | null => {
+ // first decode URI
+ id = decodeURIComponent(id);
+ // strict matching
+ const strictMatch = id.match(exclusiveIdegex)?.[1];
+ const urlMatch = id.match(urlRegex)?.[1];
+ // return match, if not negative, return looseMatch
+ const looseMatch = id.match(looseEndsRegex)?.[1];
+ return strictMatch ? (strictMatch as VideoID)
+ : negativeRegex.test(id) ? null
+ : urlMatch ? (urlMatch as VideoID)
+ : looseMatch ? (looseMatch as VideoID)
+ : null;
+};
\ No newline at end of file
diff --git a/test.json b/test.json
index 16ace5c69..fef80529a 100644
--- a/test.json
+++ b/test.json
@@ -64,5 +64,6 @@
"clientSecret": "testClientSecret",
"redirectUri": "http://127.0.0.1/fake/callback"
},
- "minReputationToSubmitFiller": -1
+ "minReputationToSubmitFiller": -1,
+ "minUserIDLength": 0
}
diff --git a/test/cases/environment.ts b/test/cases/environment.ts
new file mode 100644
index 000000000..a0a6d884e
--- /dev/null
+++ b/test/cases/environment.ts
@@ -0,0 +1,12 @@
+import assert from "assert";
+import { config } from "../../src/config";
+
+describe("environment", () => {
+ it("minUserIDLength should be < 10", () => {
+ assert(config.minUserIDLength < 10);
+ });
+ it("nodeJS major version should be >= 16", () => {
+ const [major] = process.versions.node.split(".").map(i => parseInt(i));
+ assert(major >= 16);
+ });
+});
diff --git a/test/cases/generateVerifyToken.ts b/test/cases/generateVerifyToken.ts
index ef02a5fc9..6ca5ad18f 100644
--- a/test/cases/generateVerifyToken.ts
+++ b/test/cases/generateVerifyToken.ts
@@ -7,7 +7,7 @@ let mock: MockAdapter;
import * as patreon from "../mocks/patreonMock";
import * as gumroad from "../mocks/gumroadMock";
import { client } from "../utils/httpClient";
-import { validatelicenseKeyRegex } from "../../src/routes/verifyToken";
+import { validateLicenseKeyRegex } from "../../src/routes/verifyToken";
const generateEndpoint = "/api/generateToken";
const getGenerateToken = (type: string, code: string | null, adminUserID: string | null) => client({
@@ -48,7 +48,7 @@ describe("generateToken test", function() {
if (!config?.patreon) this.skip();
getGenerateToken("patreon", "patreon_code", "").then(res => {
patreonLicense = extractLicenseKey(res.data);
- assert.ok(validatelicenseKeyRegex(patreonLicense));
+ assert.ok(validateLicenseKeyRegex(patreonLicense));
done();
}).catch(err => done(err));
});
@@ -58,14 +58,14 @@ describe("generateToken test", function() {
if (!config?.patreon) this.skip();
getGenerateToken("patreon", "patreon_code", "").then(res => {
patreonLicense = extractLicenseKey(res.data);
- assert.ok(validatelicenseKeyRegex(patreonLicense));
+ assert.ok(validateLicenseKeyRegex(patreonLicense));
done();
}).catch(err => done(err));
});
it("Should be able to create new local token", function (done) {
createAndSaveToken(TokenType.local).then((licenseKey) => {
- assert.ok(validatelicenseKeyRegex(licenseKey));
+ assert.ok(validateLicenseKeyRegex(licenseKey));
localLicense = licenseKey;
done();
}).catch(err => done(err));
diff --git a/test/cases/getSearchSegments.ts b/test/cases/getSearchSegments.ts
index c18bef21b..6dbef4f5a 100644
--- a/test/cases/getSearchSegments.ts
+++ b/test/cases/getSearchSegments.ts
@@ -335,7 +335,8 @@ describe("getSearchSegments", () => {
locked: 1,
hidden: 0,
shadowHidden: 0,
- userID: "searchTestUser"
+ userID: "searchTestUser",
+ description: ""
};
assert.deepStrictEqual(segment0, expected);
done();
diff --git a/test/cases/getSkipSegments.ts b/test/cases/getSkipSegments.ts
index b252f114f..f89b77814 100644
--- a/test/cases/getSkipSegments.ts
+++ b/test/cases/getSkipSegments.ts
@@ -46,7 +46,6 @@ describe("getSkipSegments", () => {
assert.strictEqual(data[0].votes, 1);
assert.strictEqual(data[0].locked, 0);
assert.strictEqual(data[0].videoDuration, 100);
- assert.strictEqual(data[0].userID, "testman");
done();
})
.catch(err => done(err));
diff --git a/test/cases/getSubmissionUUID.ts b/test/cases/getSubmissionUUID.ts
index e15044f3d..93d6ae3ea 100644
--- a/test/cases/getSubmissionUUID.ts
+++ b/test/cases/getSubmissionUUID.ts
@@ -6,7 +6,7 @@ import { UserID } from "../../src/types/user.model";
describe("getSubmissionUUID", () => {
it("Should return the hashed value", () => {
assert.strictEqual(
- getSubmissionUUID("video001" as VideoID, "sponsor" as Category, "skip" as ActionType, "testuser001" as UserID, 13.33337, 42.000001, Service.YouTube),
- "2a473bca993dd84d8c2f6a4785989b20948dfe0c12c00f6f143bbda9ed561dca6");
+ getSubmissionUUID("video001" as VideoID, "sponsor" as Category, "skip" as ActionType, "", "testuser001" as UserID, 13.33337, 42.000001, Service.YouTube),
+ "2a473bca993dd84d8c2f6a4785989b20948dfe0c12c00f6f143bbda9ed561dca7");
});
});
diff --git a/test/cases/getUserInfoFree.ts b/test/cases/getUserInfoFree.ts
index fd32d6a30..847a59a05 100644
--- a/test/cases/getUserInfoFree.ts
+++ b/test/cases/getUserInfoFree.ts
@@ -6,25 +6,26 @@ import { client } from "../utils/httpClient";
describe("getUserInfo Free Chapters", () => {
const endpoint = "/api/userInfo";
- const noQualifyUserID = "getUserInfo-Free-noQualify";
+ const newQualifyUserID = "getUserInfo-Free-newQualify";
const vipQualifyUserID = "getUserInfo-Free-VIP";
const repQualifyUserID = "getUserInfo-Free-RepQualify";
const oldQualifyUserID = "getUserInfo-Free-OldQualify";
+ const newNoQualityUserID = "getUserInfo-Free-newNoQualify";
const postOldQualify = 1600000000000;
before(async () => {
const sponsorTimesQuery = 'INSERT INTO "sponsorTimes" ("videoID", "startTime", "endTime", "votes", "UUID", "userID", "timeSubmitted", views, category, "actionType", "reputation", "shadowHidden") VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
await db.prepare("run", sponsorTimesQuery, ["getUserInfoFree", 1, 2, 0, "uuid-guif-0", getHash(repQualifyUserID), postOldQualify, 0, "sponsor", "skip", 20, 0]);
await db.prepare("run", sponsorTimesQuery, ["getUserInfoFree", 1, 2, 0, "uuid-guif-1", getHash(oldQualifyUserID), 0, 0, "sponsor", "skip", 0, 0]); // submit at epoch
- await db.prepare("run", sponsorTimesQuery, ["getUserInfoFree", 1, 2, 0, "uuid-guif-2", getHash(noQualifyUserID), postOldQualify, 0, "sponsor", "skip", 0, 0]);
+ await db.prepare("run", sponsorTimesQuery, ["getUserInfoFree", 1, 2, 0, "uuid-guif-2", getHash(newQualifyUserID), postOldQualify, 0, "sponsor", "skip", 0, 0]);
await db.prepare("run", `INSERT INTO "vipUsers" ("userID") VALUES (?)`, [getHash(vipQualifyUserID)]);
});
const getUserInfo = (userID: string) => client.get(endpoint, { params: { userID, value: "freeChaptersAccess" } });
- it("Should not get free access (noQuality)", (done) => {
- getUserInfo(noQualifyUserID)
+ it("Should not get free access under new rule (newNoQualify)", (done) => {
+ getUserInfo(newNoQualityUserID)
.then(res => {
assert.strictEqual(res.status, 200);
assert.strictEqual(res.data.freeChaptersAccess, false);
@@ -33,6 +34,16 @@ describe("getUserInfo Free Chapters", () => {
.catch(err => done(err));
});
+ it("Should get free access under new rule (newQualify)", (done) => {
+ getUserInfo(newQualifyUserID)
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ assert.strictEqual(res.data.freeChaptersAccess, true);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
it("Should get free access (VIP)", (done) => {
getUserInfo(vipQualifyUserID)
.then(res => {
diff --git a/test/cases/getVideoLabelByHash.ts b/test/cases/getVideoLabelByHash.ts
new file mode 100644
index 000000000..650867ecd
--- /dev/null
+++ b/test/cases/getVideoLabelByHash.ts
@@ -0,0 +1,184 @@
+import { db } from "../../src/databases/databases";
+import assert from "assert";
+import { client } from "../utils/httpClient";
+import { getHash } from "../../src/utils/getHash";
+
+describe("getVideoLabelHash", () => {
+ const endpoint = "/api/videoLabels";
+ before(async () => {
+ const query = 'INSERT INTO "sponsorTimes" ("videoID", "hashedVideoID", "votes", "locked", "UUID", "userID", "timeSubmitted", "category", "actionType", "hidden", "shadowHidden", "startTime", "endTime", "views") VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, 0, 0)';
+ await db.prepare("run", query, ["getLabelHashSponsor" , getHash("getLabelHashSponsor", 1) , 2, 0, "labelhash01", "labeluser", 0, "sponsor", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashEA" , getHash("getLabelHashEA", 1) , 2, 0, "labelhash02", "labeluser", 0, "exclusive_access", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashSelfpromo" , getHash("getLabelHashSelfpromo", 1) , 2, 0, "labelhash03", "labeluser", 0, "selfpromo", "full", 0, 0]);
+ // priority override
+ await db.prepare("run", query, ["getLabelHashPriority" , getHash("getLabelHashPriority", 1) , 2, 0, "labelhash04", "labeluser", 0, "sponsor", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashPriority" , getHash("getLabelHashPriority", 1) , 2, 0, "labelhash05", "labeluser", 0, "exclusive_access", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashPriority" , getHash("getLabelHashPriority", 1) , 2, 0, "labelhash06", "labeluser", 0, "selfpromo", "full", 0, 0]);
+ // locked only
+ await db.prepare("run", query, ["getLabelHashLocked" , getHash("getLabelHashLocked", 1) , 2, 0, "labelhash07", "labeluser", 0, "sponsor", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashLocked" , getHash("getLabelHashLocked", 1) , 2, 0, "labelhash08", "labeluser", 0, "exclusive_access", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashLocked" , getHash("getLabelHashLocked", 1) , 2, 1, "labelhash09", "labeluser", 0, "selfpromo", "full", 0, 0]);
+ // hidden segments
+ await db.prepare("run", query, ["getLabelHashDownvote" , getHash("getLabelHashDownvote", 1) , -2, 0, "labelhash10", "labeluser", 0, "selfpromo", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashHidden" , getHash("getLabelHashHidden", 1) , 2, 0, "labelhash11", "labeluser", 0, "selfpromo", "full", 1, 0]);
+ await db.prepare("run", query, ["getLabelHashShHidden" , getHash("getLabelHashShHidden", 1) , 2, 0, "labelhash12", "labeluser", 0, "selfpromo", "full", 0, 1]);
+ // priority override2
+ await db.prepare("run", query, ["getLabelHashPriority2" , getHash("getLabelHashPriority2", 1) , -2, 0, "labelhash13", "labeluser", 0, "sponsor", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashPriority2" , getHash("getLabelHashPriority2", 1) , 2, 0, "labelhash14", "labeluser", 0, "exclusive_access", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHashPriority2" , getHash("getLabelHashPriority2", 1) , 2, 0, "labelhash15", "labeluser", 0, "selfpromo", "full", 0, 0]);
+
+ return;
+ });
+
+ function validateLabel(data: any, videoID: string) {
+ assert.strictEqual(data[0].videoID, videoID);
+ assert.strictEqual(data[0].segments.length, 1);
+ assert.strictEqual(data[0].segments[0].segment[0], 0);
+ assert.strictEqual(data[0].segments[0].segment[1], 0);
+ assert.strictEqual(data[0].segments[0].actionType, "full");
+ assert.strictEqual(data[0].segments[0].userID, "labeluser");
+ }
+
+ const get = (videoID: string) => client.get(`${endpoint}/${getHash(videoID, 1).substring(0, 4)}`);
+
+ it("Should be able to get sponsor only label", (done) => {
+ const videoID = "getLabelHashSponsor";
+ get(videoID)
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data, videoID);
+ const result = data[0].segments[0];
+ assert.strictEqual(result.category, "sponsor");
+ assert.strictEqual(result.UUID, "labelhash01");
+ assert.strictEqual(result.locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should be able to get exclusive access only label", (done) => {
+ const videoID = "getLabelHashEA";
+ get(videoID)
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data, videoID);
+ const result = data[0].segments[0];
+ assert.strictEqual(result.category, "exclusive_access");
+ assert.strictEqual(result.UUID, "labelhash02");
+ assert.strictEqual(result.locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should be able to get selfpromo only label", (done) => {
+ const videoID = "getLabelHashSelfpromo";
+ get(videoID)
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data, videoID);
+ const result = data[0].segments[0];
+ assert.strictEqual(result.category, "selfpromo");
+ assert.strictEqual(result.UUID, "labelhash03");
+ assert.strictEqual(result.locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should get only sponsor if multiple segments exist", (done) => {
+ const videoID = "getLabelHashPriority";
+ get(videoID)
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data, videoID);
+ const result = data[0].segments[0];
+ assert.strictEqual(result.category, "sponsor");
+ assert.strictEqual(result.UUID, "labelhash04");
+ assert.strictEqual(result.locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should override priority if locked", (done) => {
+ const videoID = "getLabelHashLocked";
+ get(videoID)
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data, videoID);
+ const result = data[0].segments[0];
+ assert.strictEqual(result.category, "selfpromo");
+ assert.strictEqual(result.UUID, "labelhash09");
+ assert.strictEqual(result.locked, 1);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should get highest priority category", (done) => {
+ const videoID = "getLabelHashPriority2";
+ get(videoID)
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data, videoID);
+ const result = data[0].segments[0];
+ assert.strictEqual(result.category, "exclusive_access");
+ assert.strictEqual(result.UUID, "labelhash14");
+ assert.strictEqual(result.locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should return 404 if all submissions are downvoted", (done) => {
+ get("getLabelHashDownvote")
+ .then(res => {
+ assert.strictEqual(res.status, 404);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should return 404 if all submissions are hidden", (done) => {
+ get("getLabelHashHidden")
+ .then(res => {
+ assert.strictEqual(res.status, 404);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should return 404 if all submissions are shadowhidden", (done) => {
+ get("getLabelHashShHidden")
+ .then(res => {
+ assert.strictEqual(res.status, 404);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should return 404 if no segment found", (done) => {
+ get("notarealvideo")
+ .then(res => {
+ assert.strictEqual(res.status, 404);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should get 400 if no videoID passed in", (done) => {
+ client.get(endpoint)
+ .then(res => {
+ assert.strictEqual(res.status, 400);
+ done();
+ })
+ .catch(err => done(err));
+ });
+});
diff --git a/test/cases/getVideoLabels.ts b/test/cases/getVideoLabels.ts
new file mode 100644
index 000000000..7202d2cd9
--- /dev/null
+++ b/test/cases/getVideoLabels.ts
@@ -0,0 +1,170 @@
+import { db } from "../../src/databases/databases";
+import assert from "assert";
+import { client } from "../utils/httpClient";
+
+describe("getVideoLabels", () => {
+ const endpoint = "/api/videoLabels";
+ before(async () => {
+ const query = 'INSERT INTO "sponsorTimes" ("videoID", "votes", "locked", "UUID", "userID", "timeSubmitted", "category", "actionType", "hidden", "shadowHidden", "startTime", "endTime", "views") VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, 0, 0)';
+ await db.prepare("run", query, ["getLabelSponsor" , 2, 0, "label01", "labeluser", 0, "sponsor", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelEA" , 2, 0, "label02", "labeluser", 0, "exclusive_access", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelSelfpromo" , 2, 0, "label03", "labeluser", 0, "selfpromo", "full", 0, 0]);
+ // priority override
+ await db.prepare("run", query, ["getLabelPriority" , 2, 0, "label04", "labeluser", 0, "sponsor", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelPriority" , 2, 0, "label05", "labeluser", 0, "exclusive_access", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelPriority" , 2, 0, "label06", "labeluser", 0, "selfpromo", "full", 0, 0]);
+ // locked only
+ await db.prepare("run", query, ["getLabelLocked" , 2, 0, "label07", "labeluser", 0, "sponsor", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelLocked" , 2, 0, "label08", "labeluser", 0, "exclusive_access", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelLocked" , 2, 1, "label09", "labeluser", 0, "selfpromo", "full", 0, 0]);
+ // hidden segments
+ await db.prepare("run", query, ["getLabelDownvote" ,-2, 0, "label10", "labeluser", 0, "selfpromo", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelHidden" ,2, 0, "label11", "labeluser", 0, "selfpromo", "full", 1, 0]);
+ await db.prepare("run", query, ["getLabelShadowHidden",2, 0, "label12", "labeluser", 0, "selfpromo", "full", 0, 1]);
+ // priority override2
+ await db.prepare("run", query, ["getLabelPriority2" , -2, 0, "label13", "labeluser", 0, "sponsor", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelPriority2" , 2, 0, "label14", "labeluser", 0, "exclusive_access", "full", 0, 0]);
+ await db.prepare("run", query, ["getLabelPriority2" , 2, 0, "label15", "labeluser", 0, "selfpromo", "full", 0, 0]);
+
+ return;
+ });
+
+ function validateLabel(result: any) {
+ assert.strictEqual(result.length, 1);
+ assert.strictEqual(result[0].segment[0], 0);
+ assert.strictEqual(result[0].segment[1], 0);
+ assert.strictEqual(result[0].actionType, "full");
+ assert.strictEqual(result[0].userID, "labeluser");
+ }
+
+ const get = (videoID: string) => client.get(endpoint, { params: { videoID } });
+
+ it("Should be able to get sponsor only label", (done) => {
+ get("getLabelSponsor")
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data);
+ assert.strictEqual(data[0].category, "sponsor");
+ assert.strictEqual(data[0].UUID, "label01");
+ assert.strictEqual(data[0].locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should be able to get exclusive access only label", (done) => {
+ get("getLabelEA")
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data);
+ assert.strictEqual(data[0].category, "exclusive_access");
+ assert.strictEqual(data[0].UUID, "label02");
+ assert.strictEqual(data[0].locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should be able to get selfpromo only label", (done) => {
+ get("getLabelSelfpromo")
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data);
+ assert.strictEqual(data[0].category, "selfpromo");
+ assert.strictEqual(data[0].UUID, "label03");
+ assert.strictEqual(data[0].locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should get only sponsor if multiple segments exist", (done) => {
+ get("getLabelPriority")
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data);
+ assert.strictEqual(data[0].category, "sponsor");
+ assert.strictEqual(data[0].UUID, "label04");
+ assert.strictEqual(data[0].locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should override priority if locked", (done) => {
+ get("getLabelLocked")
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data);
+ assert.strictEqual(data[0].category, "selfpromo");
+ assert.strictEqual(data[0].UUID, "label09");
+ assert.strictEqual(data[0].locked, 1);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should get highest priority category", (done) => {
+ get("getLabelPriority2")
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ const data = res.data;
+ validateLabel(data);
+ assert.strictEqual(data[0].category, "exclusive_access");
+ assert.strictEqual(data[0].UUID, "label14");
+ assert.strictEqual(data[0].locked, 0);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should return 404 if all submissions are downvoted", (done) => {
+ get("getLabelDownvote")
+ .then(res => {
+ assert.strictEqual(res.status, 404);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should return 404 if all submissions are hidden", (done) => {
+ get("getLabelHidden")
+ .then(res => {
+ assert.strictEqual(res.status, 404);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should return 404 if all submissions are shadowhidden", (done) => {
+ get("getLabelShadowHidden")
+ .then(res => {
+ assert.strictEqual(res.status, 404);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should return 404 if no segment found", (done) => {
+ get("notarealvideo")
+ .then(res => {
+ assert.strictEqual(res.status, 404);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it("Should get 400 if no videoID passed in", (done) => {
+ client.get(endpoint)
+ .then(res => {
+ assert.strictEqual(res.status, 400);
+ done();
+ })
+ .catch(err => done(err));
+ });
+});
diff --git a/test/cases/innerTubeApi.ts b/test/cases/innerTubeApi.ts
index 0c9864229..d65b5cc42 100644
--- a/test/cases/innerTubeApi.ts
+++ b/test/cases/innerTubeApi.ts
@@ -46,4 +46,9 @@ describe("innertube API test", function() {
const videoDetail = await getVideoDetails(videoID);
assert.ok(videoDetail);
});
+ it("Should not fail when getting data for private video", async function () {
+ const privateVideoId = "ZuibAax0VD8";
+ const videoDetail = await getVideoDetails(privateVideoId);
+ assert.ok(videoDetail);
+ });
});
\ No newline at end of file
diff --git a/test/cases/postSkipSegments.ts b/test/cases/postSkipSegments.ts
index 57ebeb8af..233f511f4 100644
--- a/test/cases/postSkipSegments.ts
+++ b/test/cases/postSkipSegments.ts
@@ -1292,4 +1292,20 @@ describe("postSkipSegments", () => {
})
.catch(err => done(err));
});
+
+ it("Should successfully submit if video is private", (done) => {
+ const videoID = "private-video";
+ postSkipSegmentParam({
+ videoID,
+ startTime: 1,
+ endTime: 5,
+ category: "sponsor",
+ userID: submitUserTwo
+ })
+ .then(res => {
+ assert.strictEqual(res.status, 200);
+ done();
+ })
+ .catch(err => done(err));
+ });
});
diff --git a/test/cases/setUsername.ts b/test/cases/setUsername.ts
index 39a518b34..a3da56c47 100644
--- a/test/cases/setUsername.ts
+++ b/test/cases/setUsername.ts
@@ -22,12 +22,22 @@ const user07PrivateUserID = "setUsername_07";
const username07 = "Username 07";
const user08PrivateUserID = "setUsername_08";
+// private = public cases
+// user09 - username === privateID
+const user09PrivateUserID = "setUsername_09";
+// user 10/11 - user 11 username === user 10 privateID
+const user10PrivateUserID = "setUsername_10_collision";
+const username10 = "setUsername_10";
+const user11PrivateUserID = "setUsername_11";
+const user12PrivateUserID = "setUsername_12";
+const username12 = "Username 12";
+
async function addUsername(userID: string, userName: string, locked = 0) {
await db.prepare("run", 'INSERT INTO "userNames" ("userID", "userName", "locked") VALUES(?, ?, ?)', [userID, userName, locked]);
await addLogUserNameChange(userID, userName);
}
-async function getUsernameInfo(userID: string): Promise<{ userName: string, locked: string }> {
+async function getUsernameInfo(userID: string): Promise<{ userName: string, locked: string}> {
const row = await db.prepare("get", 'SELECT "userName", "locked" FROM "userNames" WHERE "userID" = ?', [userID]);
if (!row) {
return null;
@@ -88,6 +98,9 @@ describe("setUsername", () => {
await addUsername(getHash(user05PrivateUserID), username05, 0);
await addUsername(getHash(user06PrivateUserID), username06, 0);
await addUsername(getHash(user07PrivateUserID), username07, 1);
+ await addUsername(getHash(user10PrivateUserID), username10, 0);
+ // user11 skipped
+ await addUsername(getHash(user12PrivateUserID), username12, 0);
});
it("Should be able to set username that has never been set", (done) => {
@@ -240,6 +253,44 @@ describe("setUsername", () => {
const usernameInfo = await getUsernameInfo(getHash(user08PrivateUserID));
assert.strictEqual(usernameInfo, null);
done();
- });
+ })
+ .catch((err) => done(err));
+ });
+
+ it("Should return error if trying to set username to privateID", (done) => {
+ const privateID = user09PrivateUserID;
+ postSetUserName(privateID, privateID)
+ .then(async (res) => {
+ assert.strictEqual(res.status, 400);
+ const usernameInfo = await getUsernameInfo(getHash(privateID));
+ assert.strictEqual(usernameInfo, null);
+ done();
+ })
+ .catch((err) => done(err));
+ });
+
+ it("Should return error if trying to set username to someone else's privateID", (done) => {
+ const privateID = user11PrivateUserID;
+ postSetUserName(privateID, user10PrivateUserID)
+ .then(async (res) => {
+ assert.strictEqual(res.status, 400);
+ const usernameInfo = await getUsernameInfo(getHash(privateID)); // user 10's privateID
+ assert.strictEqual(usernameInfo, null);
+ done();
+ })
+ .catch((err) => done(err));
+ });
+
+ it("Should not return error if trying to set username to someone else's publicID", (done) => {
+ const privateID = user12PrivateUserID;
+ const user10PublicID = getHash(user10PrivateUserID);
+ postSetUserName(privateID, user10PublicID)
+ .then(async (res) => {
+ assert.strictEqual(res.status, 200);
+ const usernameInfo = await getUsernameInfo(getHash(privateID)); // user 10's publicID
+ assert.strictEqual(usernameInfo.userName, user10PublicID);
+ done();
+ })
+ .catch((err) => done(err));
});
});
diff --git a/test/cases/tokenUtils.ts b/test/cases/tokenUtils.ts
index 4b3890eba..742bf48ba 100644
--- a/test/cases/tokenUtils.ts
+++ b/test/cases/tokenUtils.ts
@@ -3,11 +3,11 @@ import { config } from "../../src/config";
import axios from "axios";
import * as tokenUtils from "../../src/utils/tokenUtils";
import MockAdapter from "axios-mock-adapter";
-import { validatelicenseKeyRegex } from "../../src/routes/verifyToken";
+import { validateLicenseKeyRegex } from "../../src/routes/verifyToken";
let mock: MockAdapter;
import * as patreon from "../mocks/patreonMock";
-const validateToken = validatelicenseKeyRegex;
+const validateToken = validateLicenseKeyRegex;
describe("tokenUtils test", function() {
before(function() {
diff --git a/test/cases/validateVideoIDs.ts b/test/cases/validateVideoIDs.ts
new file mode 100644
index 000000000..dc1c62ddf
--- /dev/null
+++ b/test/cases/validateVideoIDs.ts
@@ -0,0 +1,125 @@
+import assert from "assert";
+import { client } from "../utils/httpClient";
+import { config } from "../../src/config";
+import sinon from "sinon";
+import { sanitize } from "../../src/utils/youtubeID";
+
+// videoID array
+const badVideoIDs = [
+ ["null", "< 11"],
+ ["dQw4w9WgXc?", "invalid characters"],
+ ["https://www.youtube.com/clip/UgkxeLPGsmKnMdm46DGml_0aa0aaAAAAA00a", "clip URL"],
+ ["https://youtube.com/channel/UCaAa00aaaAA0a0a0AaaAAAA", "channel ID (UC)"],
+ ["https://www.youtube.com/@LinusTechTips", "channel @username"],
+ ["https://www.youtube.com/@GamersNexus", "channel @username"],
+ ["https://www.youtube.com/c/LinusTechTips", "custom channel /c/"],
+ ["https://www.youtube.com/c/GamersNexus", "custom channel /c/"],
+ ["https://www.youtube.com/", "home/ page URL"],
+ ["03224876b002487796379942f199bc22ffac46157ad2488119bccc7b03c55430","UUID"],
+ ["https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=16s#requiredSegment=03224876b002487796379942f199bc22ffac46157ad2488119bccc7b03c55430", "full #requiredSegments uuid"],
+ ["","empty videoID"]
+
+];
+const goodVideoIDs = [
+ ["dQw4w9WgXcQ", "standalone videoID"],
+ ["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "?watch link"],
+ ["http://www.youtube.com/watch?v=dQw4w9WgXcQ", "http link"],
+ ["www.youtube.com/watch?v=dQw4w9WgXcQ", "no protocol link"],
+ ["https://www.youtube.com/watch?v=dQw4w9WgXcQ?t=2", "trailing &t parameter"],
+ ["https://youtu.be/dQw4w9WgXcQ","youtu.be"],
+ ["youtu.be/dQw4w9WgXcQ","no protocol youtu.be"],
+ ["https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=16s#requiredSegment=00000000000","#requiredsegment link"],
+ ["https://www.youtube.com/embed/dQw4w9WgXcQ?wmode=transparent&rel=0&autohide=1&showinfo=1&fs=1&enablejsapi=0&theme=light", "long embedded link"],
+ ["http://m.youtube.com/watch?v=dQw4w9WgXcQ&app=m&persist_app=1", "force persist desktop"],
+ ["http://m.youtube.com/watch?v=dQw4w9WgXcQ", "mobile"],
+ ["https://www.youtube.com/watch?v=dQw4w9WgXcQ&list=PL8mG-AaA0aAa0AAa0A0A-aAaaA00aaAa0","/watch&list"],
+ ["https://www.youtube.com/embed/dQw4w9WgXcQ?list=PL8mG-AaA0aAa0AAa0A0A-aAaaA00aaAa0","/embed/video"],
+ ["dQw4w9WgXcQ\n", "escaped newline"],
+ ["dQw4w9WgXcQ\t", "escaped tab"],
+ ["%20dQw4w9WgXcQ%20%20%20", "urlencoded"],
+ ["https://sb.ltn.fi/video/dQw4w9WgXcQ/","sbltnfi link"],
+ ["https://www.youtube.com/watch?v=dQw4w9WgXcQ#t=0m10s", "anchor as t parameter"],
+];
+const edgeVideoIDs = [
+ ["https://www.youtube.com/embed/videoseries?list=PL8mG-Aaa0aAa1AAa0A0A-a0aaA00aaAa0", "/videoseries"],
+ ["https://www.youtube.com/embed/playlist?list=PL8mG-Aaa0aAa1AAa0A0A-a0aaA00aaAa0", "/playlist"],
+ ["PL8mG-Aaa0aAa1AAa0A0A-a0aaA00aaAa0", "playlist ID"],
+ ["UgkxeLPGsmKnMdm46DGml_0aa0aaAAAAA00a","clip ID"],
+ ["https://www.youtube.com/GamersNexus", "channel custom URL"],
+ ["https://www.youtube.com/LinusTechTips", "channel custom URL"],
+];
+const targetVideoID = "dQw4w9WgXcQ";
+
+// tests
+describe("YouTube VideoID validation - failing tests", () => {
+ for (const testCase of badVideoIDs) {
+ it(`Should error on invalid videoID - ${testCase[1]}`, () => {
+ assert.equal(sanitize(testCase[0]), null);
+ });
+ }
+});
+describe("YouTube VideoID validation - passing tests", () => {
+ for (const testCase of goodVideoIDs) {
+ it(`Should be able to sanitize good videoID - ${testCase[1]}`, () => {
+ assert.equal(sanitize(testCase[0]), targetVideoID);
+ });
+ }
+});
+describe("YouTube VideoID validation - edge cases tests", () => {
+ for (const testCase of edgeVideoIDs) {
+ it(`edge cases produce bad results - ${testCase[1]}`, () => {
+ assert.ok(sanitize(testCase[0]));
+ });
+ }
+});
+
+// stubs
+const mode = "production";
+let stub: sinon.SinonStub;
+
+// constants
+const endpoint = "/api/skipSegments";
+const userID = "postVideoID_user1";
+const expectedError = `No valid videoID. YouTube videoID could not be extracted`;
+
+
+// helper functions
+const postSkipSegments = (videoID: string) => client({
+ method: "POST",
+ url: endpoint,
+ params: {
+ videoID,
+ startTime: Math.random(),
+ endTime: 10,
+ userID,
+ service: "YouTube",
+ category: "sponsor"
+ }
+});
+
+describe("VideoID Validation - postSkipSegments", () => {
+ before(() => stub = sinon.stub(config, "mode").value(mode));
+ after(() => stub.restore());
+
+ it("Should return production mode if stub worked", (done) => {
+ assert.strictEqual(config.mode, mode);
+ done();
+ });
+
+ it(`Should return 400 for invalid videoID`, (done) => {
+ postSkipSegments("123456").then(res => {
+ assert.strictEqual(res.status, 400);
+ assert.strictEqual(res.data, expectedError);
+ done();
+ })
+ .catch(err => done(err));
+ });
+
+ it(`Should return 200 for valid videoID`, (done) => {
+ postSkipSegments("dQw4w9WgXcQ").then(res => {
+ assert.strictEqual(res.status, 200);
+ done();
+ })
+ .catch(err => done(err));
+ });
+});
\ No newline at end of file
diff --git a/test/mocks/youtubeMock.ts b/test/mocks/youtubeMock.ts
index 95f3d2078..c8f60c003 100644
--- a/test/mocks/youtubeMock.ts
+++ b/test/mocks/youtubeMock.ts
@@ -63,6 +63,11 @@ export class YouTubeApiMock {
lengthSeconds: 100,
} as APIVideoData
};
+ } else if (obj.id === "private-video") {
+ return {
+ err: false,
+ data: {} as APIVideoData
+ };
} else {
return {
err: false,