Use @signalapp/sqlcipher
This commit is contained in:
@@ -429,30 +429,6 @@ Signal Desktop makes use of the following open source projects.
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
## @signalapp/better-sqlite3
|
|
||||||
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2017 Joshua Wise
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## @signalapp/quill-cjs
|
## @signalapp/quill-cjs
|
||||||
|
|
||||||
Copyright (c) 2017-2024, Slab
|
Copyright (c) 2017-2024, Slab
|
||||||
@@ -487,6 +463,670 @@ Signal Desktop makes use of the following open source projects.
|
|||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
## @signalapp/sqlcipher
|
||||||
|
|
||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
## @tanstack/react-virtual
|
## @tanstack/react-virtual
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
10
package.json
10
package.json
@@ -117,10 +117,10 @@
|
|||||||
"@react-aria/focus": "3.19.1",
|
"@react-aria/focus": "3.19.1",
|
||||||
"@react-aria/utils": "3.25.3",
|
"@react-aria/utils": "3.25.3",
|
||||||
"@react-spring/web": "9.7.5",
|
"@react-spring/web": "9.7.5",
|
||||||
"@signalapp/better-sqlite3": "9.0.13",
|
|
||||||
"@signalapp/libsignal-client": "0.67.3",
|
"@signalapp/libsignal-client": "0.67.3",
|
||||||
"@signalapp/quill-cjs": "2.1.2",
|
"@signalapp/quill-cjs": "2.1.2",
|
||||||
"@signalapp/ringrtc": "2.50.2",
|
"@signalapp/ringrtc": "2.50.2",
|
||||||
|
"@signalapp/sqlcipher": "1.0.0",
|
||||||
"@tanstack/react-virtual": "3.11.2",
|
"@tanstack/react-virtual": "3.11.2",
|
||||||
"@types/fabric": "4.5.3",
|
"@types/fabric": "4.5.3",
|
||||||
"backbone": "1.6.0",
|
"backbone": "1.6.0",
|
||||||
@@ -384,7 +384,7 @@
|
|||||||
"@indutny/simple-windows-notifications",
|
"@indutny/simple-windows-notifications",
|
||||||
"@parcel/watcher",
|
"@parcel/watcher",
|
||||||
"@signalapp/libsignal-client",
|
"@signalapp/libsignal-client",
|
||||||
"@signalapp/better-sqlite3",
|
"@signalapp/sqlcipher",
|
||||||
"@signalapp/ringrtc",
|
"@signalapp/ringrtc",
|
||||||
"@swc/core",
|
"@swc/core",
|
||||||
"bufferutil",
|
"bufferutil",
|
||||||
@@ -426,7 +426,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sign": "./ts/scripts/sign-macos.js",
|
"sign": "./ts/scripts/sign-macos.js",
|
||||||
"singleArchFiles": "node_modules/@signalapp/{libsignal-client/prebuilds/**,ringrtc/build/**}",
|
"singleArchFiles": "node_modules/@signalapp/{libsignal-client/prebuilds/**,ringrtc/build/**,sqlcipher/prebuilds/**}",
|
||||||
"target": [
|
"target": [
|
||||||
{
|
{
|
||||||
"target": "zip",
|
"target": "zip",
|
||||||
@@ -607,9 +607,7 @@
|
|||||||
"node_modules/socks/build/common/*.js",
|
"node_modules/socks/build/common/*.js",
|
||||||
"node_modules/socks/build/client/*.js",
|
"node_modules/socks/build/client/*.js",
|
||||||
"node_modules/smart-buffer/build/*.js",
|
"node_modules/smart-buffer/build/*.js",
|
||||||
"!node_modules/@signalapp/better-sqlite3/deps/*",
|
"node_modules/@signalapp/sqlcipher/prebuilds/${platform}-${arch}/*.node",
|
||||||
"!node_modules/@signalapp/better-sqlite3/src/*",
|
|
||||||
"node_modules/@signalapp/better-sqlite3/build/Release/better_sqlite3.node",
|
|
||||||
"node_modules/@signalapp/libsignal-client/prebuilds/${platform}-${arch}/*.node",
|
"node_modules/@signalapp/libsignal-client/prebuilds/${platform}-${arch}/*.node",
|
||||||
"!node_modules/@signalapp/ringrtc/scripts/*",
|
"!node_modules/@signalapp/ringrtc/scripts/*",
|
||||||
"node_modules/@signalapp/ringrtc/build/${platform}/*${arch}*.node",
|
"node_modules/@signalapp/ringrtc/build/${platform}/*${arch}*.node",
|
||||||
|
22
pnpm-lock.yaml
generated
22
pnpm-lock.yaml
generated
@@ -124,9 +124,6 @@ importers:
|
|||||||
'@react-spring/web':
|
'@react-spring/web':
|
||||||
specifier: 9.7.5
|
specifier: 9.7.5
|
||||||
version: 9.7.5(react-dom@17.0.2(react@17.0.2))(react@17.0.2)
|
version: 9.7.5(react-dom@17.0.2(react@17.0.2))(react@17.0.2)
|
||||||
'@signalapp/better-sqlite3':
|
|
||||||
specifier: 9.0.13
|
|
||||||
version: 9.0.13
|
|
||||||
'@signalapp/libsignal-client':
|
'@signalapp/libsignal-client':
|
||||||
specifier: 0.67.3
|
specifier: 0.67.3
|
||||||
version: 0.67.3
|
version: 0.67.3
|
||||||
@@ -136,6 +133,9 @@ importers:
|
|||||||
'@signalapp/ringrtc':
|
'@signalapp/ringrtc':
|
||||||
specifier: 2.50.2
|
specifier: 2.50.2
|
||||||
version: 2.50.2
|
version: 2.50.2
|
||||||
|
'@signalapp/sqlcipher':
|
||||||
|
specifier: 1.0.0
|
||||||
|
version: 1.0.0
|
||||||
'@tanstack/react-virtual':
|
'@tanstack/react-virtual':
|
||||||
specifier: 3.11.2
|
specifier: 3.11.2
|
||||||
version: 3.11.2(react-dom@17.0.2(react@17.0.2))(react@17.0.2)
|
version: 3.11.2(react-dom@17.0.2(react@17.0.2))(react@17.0.2)
|
||||||
@@ -2529,9 +2529,6 @@ packages:
|
|||||||
'@sideway/pinpoint@2.0.0':
|
'@sideway/pinpoint@2.0.0':
|
||||||
resolution: {integrity: sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==}
|
resolution: {integrity: sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==}
|
||||||
|
|
||||||
'@signalapp/better-sqlite3@9.0.13':
|
|
||||||
resolution: {integrity: sha512-sl5JJvHz/mGy3JXXcWFq7PxeO/d9SaCjPq/FPc4RCujaTC9JofHLdxQjn2xSSZQBLm28o2as3p6hD9eDk+BVNw==}
|
|
||||||
|
|
||||||
'@signalapp/libsignal-client@0.60.2':
|
'@signalapp/libsignal-client@0.60.2':
|
||||||
resolution: {integrity: sha512-tU4kNP/yCwkFntb2ahXOSQJtzdy+YifAB2yv5hw0qyKSidRHLn6bYiz4Zo2tjxLDRoBLAUxCRsQramStiqNZdA==}
|
resolution: {integrity: sha512-tU4kNP/yCwkFntb2ahXOSQJtzdy+YifAB2yv5hw0qyKSidRHLn6bYiz4Zo2tjxLDRoBLAUxCRsQramStiqNZdA==}
|
||||||
|
|
||||||
@@ -2551,6 +2548,9 @@ packages:
|
|||||||
'@signalapp/ringrtc@2.50.2':
|
'@signalapp/ringrtc@2.50.2':
|
||||||
resolution: {integrity: sha512-fZgfz4asC4CZsvrhxYMDVbIz0iffde9GhWEgIBpAxgEiLpuURx9YRK1ghnn9eonfZNEXwhrTUXUBlC6xYyy1rQ==}
|
resolution: {integrity: sha512-fZgfz4asC4CZsvrhxYMDVbIz0iffde9GhWEgIBpAxgEiLpuURx9YRK1ghnn9eonfZNEXwhrTUXUBlC6xYyy1rQ==}
|
||||||
|
|
||||||
|
'@signalapp/sqlcipher@1.0.0':
|
||||||
|
resolution: {integrity: sha512-3+4Y/0Tf0gis8gaZrD58cnzVVRzeDtBCPhS3gUdvxgkEXMv4guSJ+MDfHZLQKmqvuPmjTlt+YOsTjvLCWruFaQ==}
|
||||||
|
|
||||||
'@sinclair/typebox@0.27.8':
|
'@sinclair/typebox@0.27.8':
|
||||||
resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
|
resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
|
||||||
|
|
||||||
@@ -12253,11 +12253,6 @@ snapshots:
|
|||||||
|
|
||||||
'@sideway/pinpoint@2.0.0': {}
|
'@sideway/pinpoint@2.0.0': {}
|
||||||
|
|
||||||
'@signalapp/better-sqlite3@9.0.13':
|
|
||||||
dependencies:
|
|
||||||
bindings: 1.5.0
|
|
||||||
tar: 6.2.1
|
|
||||||
|
|
||||||
'@signalapp/libsignal-client@0.60.2':
|
'@signalapp/libsignal-client@0.60.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
node-gyp-build: 4.8.4
|
node-gyp-build: 4.8.4
|
||||||
@@ -12309,6 +12304,11 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
'@signalapp/sqlcipher@1.0.0':
|
||||||
|
dependencies:
|
||||||
|
node-addon-api: 8.3.0
|
||||||
|
node-gyp-build: 4.8.4
|
||||||
|
|
||||||
'@sinclair/typebox@0.27.8': {}
|
'@sinclair/typebox@0.27.8': {}
|
||||||
|
|
||||||
'@sindresorhus/is@4.6.0': {}
|
'@sindresorhus/is@4.6.0': {}
|
||||||
|
@@ -34,7 +34,7 @@ const bundleDefaults = {
|
|||||||
'@signalapp/libsignal-client',
|
'@signalapp/libsignal-client',
|
||||||
'@signalapp/libsignal-client/zkgroup',
|
'@signalapp/libsignal-client/zkgroup',
|
||||||
'@signalapp/ringrtc',
|
'@signalapp/ringrtc',
|
||||||
'@signalapp/better-sqlite3',
|
'@signalapp/sqlcipher',
|
||||||
'@indutny/mac-screen-share',
|
'@indutny/mac-screen-share',
|
||||||
'electron',
|
'electron',
|
||||||
'fs-xattr',
|
'fs-xattr',
|
||||||
|
@@ -2418,12 +2418,6 @@ export class SignalProtocolStore extends EventEmitter {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUnprocessedById(id: string): Promise<UnprocessedType | undefined> {
|
|
||||||
return this.withZone(GLOBAL_ZONE, 'getUnprocessedById', async () => {
|
|
||||||
return DataReader.getUnprocessedById(id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addUnprocessed(
|
addUnprocessed(
|
||||||
data: UnprocessedType,
|
data: UnprocessedType,
|
||||||
{ zone = GLOBAL_ZONE }: SessionTransactionOptions = {}
|
{ zone = GLOBAL_ZONE }: SessionTransactionOptions = {}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2020 Signal Messenger, LLC
|
// Copyright 2020 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { ReadonlyDeep } from 'type-fest';
|
import type { ReadonlyDeep } from 'type-fest';
|
||||||
import type {
|
import type {
|
||||||
ConversationAttributesType,
|
ConversationAttributesType,
|
||||||
@@ -236,6 +236,13 @@ export type SentProtoType = {
|
|||||||
urgent: boolean;
|
urgent: boolean;
|
||||||
hasPniSignatureMessage: boolean;
|
hasPniSignatureMessage: boolean;
|
||||||
};
|
};
|
||||||
|
export type SentProtoDBType = {
|
||||||
|
contentHint: number;
|
||||||
|
proto: Uint8Array;
|
||||||
|
timestamp: number;
|
||||||
|
urgent: number;
|
||||||
|
hasPniSignatureMessage: number;
|
||||||
|
};
|
||||||
export type SentProtoWithMessageIdsType = SentProtoType & {
|
export type SentProtoWithMessageIdsType = SentProtoType & {
|
||||||
messageIds: Array<string>;
|
messageIds: Array<string>;
|
||||||
};
|
};
|
||||||
@@ -676,14 +683,14 @@ type ReadableInterface = {
|
|||||||
) => Array<MessageType>;
|
) => Array<MessageType>;
|
||||||
|
|
||||||
getUnprocessedCount: () => number;
|
getUnprocessedCount: () => number;
|
||||||
getUnprocessedById: (id: string) => UnprocessedType | undefined;
|
|
||||||
|
|
||||||
getAttachmentDownloadJob(
|
// Test-only
|
||||||
|
_getAttachmentDownloadJob(
|
||||||
job: Pick<
|
job: Pick<
|
||||||
AttachmentDownloadJobType,
|
AttachmentDownloadJobType,
|
||||||
'messageId' | 'attachmentType' | 'digest'
|
'messageId' | 'attachmentType' | 'digest'
|
||||||
>
|
>
|
||||||
): AttachmentDownloadJobType;
|
): AttachmentDownloadJobType | undefined;
|
||||||
|
|
||||||
getBackupCdnObjectMetadata: (
|
getBackupCdnObjectMetadata: (
|
||||||
mediaId: string
|
mediaId: string
|
||||||
|
1212
ts/sql/Server.ts
1212
ts/sql/Server.ts
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { ReadStatus } from '../../messages/MessageReadStatus';
|
import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
@@ -30,7 +30,11 @@ export function updateToSchemaVersion1020(
|
|||||||
SELECT id FROM conversations
|
SELECT id FROM conversations
|
||||||
WHERE serviceId IS ${ourAci}
|
WHERE serviceId IS ${ourAci}
|
||||||
`;
|
`;
|
||||||
const ourConversationId = db.prepare(selectQuery).pluck().get(selectParams);
|
const ourConversationId = db
|
||||||
|
.prepare(selectQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(selectParams);
|
||||||
if (ourConversationId == null) {
|
if (ourConversationId == null) {
|
||||||
logger.error('updateToSchemaVersion1020: no conversation');
|
logger.error('updateToSchemaVersion1020: no conversation');
|
||||||
db.pragma('user_version = 1020');
|
db.pragma('user_version = 1020');
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql, sqlFragment } from '../util';
|
import { sql, sqlFragment } from '../util';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import {
|
import {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export const version = 1140;
|
export const version = 1140;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export const version = 1150;
|
export const version = 1150;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql, sqlConstant } from '../util';
|
import { sql, sqlConstant } from '../util';
|
||||||
import { CallDirection, CallStatusValue } from '../../types/CallDisposition';
|
import { CallDirection, CallStatusValue } from '../../types/CallDisposition';
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { AttachmentDownloadSource } from '../Interface';
|
import { AttachmentDownloadSource } from '../Interface';
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export const version = 1190;
|
export const version = 1190;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export const version = 1200;
|
export const version = 1200;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export const version = 1210;
|
export const version = 1210;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import z from 'zod';
|
import z from 'zod';
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import * as Errors from '../../types/errors';
|
import * as Errors from '../../types/errors';
|
||||||
import {
|
import {
|
||||||
@@ -144,16 +144,17 @@ export function updateToSchemaVersion1220(
|
|||||||
) STRICT;
|
) STRICT;
|
||||||
`);
|
`);
|
||||||
|
|
||||||
const getItem = db
|
const getItem = db.prepare(
|
||||||
.prepare(
|
`
|
||||||
`
|
SELECT json -> '$.value' FROM items WHERE id IS ?
|
||||||
SELECT json -> '$.value' FROM items WHERE id IS ?
|
`,
|
||||||
`
|
{
|
||||||
)
|
pluck: true,
|
||||||
.pluck();
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const identityKeyMapJson = getItem.get('identityKeyMap');
|
const identityKeyMapJson = getItem.get<string>(['identityKeyMap']);
|
||||||
const registrationIdMapJson = getItem.get('registrationIdMap');
|
const registrationIdMapJson = getItem.get<string>(['registrationIdMap']);
|
||||||
|
|
||||||
// If we don't have private keys - the sessions cannot be used anyway
|
// If we don't have private keys - the sessions cannot be used anyway
|
||||||
if (!identityKeyMapJson || !registrationIdMapJson) {
|
if (!identityKeyMapJson || !registrationIdMapJson) {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export const version = 1230;
|
export const version = 1230;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export const version = 1250;
|
export const version = 1250;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2025 Signal Messenger, LLC
|
// Copyright 2025 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
|
||||||
|
@@ -116,20 +116,22 @@ export function updateToSchemaVersion1280(
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const decoded = Proto.Envelope.decode(Buffer.from(envelope, 'base64'));
|
const decoded = Proto.Envelope.decode(
|
||||||
|
Buffer.from(String(envelope), 'base64')
|
||||||
|
);
|
||||||
if (!decoded.content) {
|
if (!decoded.content) {
|
||||||
throw new Error('Missing envelope content');
|
throw new Error('Missing envelope content');
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = decrypted
|
const content = decrypted
|
||||||
? Buffer.from(decrypted, 'base64')
|
? Buffer.from(String(decrypted), 'base64')
|
||||||
: decoded.content;
|
: decoded.content;
|
||||||
|
|
||||||
insertStmt.run({
|
insertStmt.run({
|
||||||
...rest,
|
...rest,
|
||||||
id,
|
id,
|
||||||
type: decoded.type ?? Proto.Envelope.Type.UNKNOWN,
|
type: decoded.type ?? Proto.Envelope.Type.UNKNOWN,
|
||||||
content,
|
content: content ?? null,
|
||||||
isEncrypted: decrypted ? 0 : 1,
|
isEncrypted: decrypted ? 0 : 1,
|
||||||
timestamp: timestamp || Date.now(),
|
timestamp: timestamp || Date.now(),
|
||||||
attempts: attempts || 0,
|
attempts: attempts || 0,
|
||||||
@@ -138,16 +140,17 @@ export function updateToSchemaVersion1280(
|
|||||||
story: story ? 1 : 0,
|
story: story ? 1 : 0,
|
||||||
serverGuid: serverGuid || getGuid(),
|
serverGuid: serverGuid || getGuid(),
|
||||||
serverTimestamp: serverTimestamp || 0,
|
serverTimestamp: serverTimestamp || 0,
|
||||||
destinationServiceId: normalizeServiceId(
|
destinationServiceId:
|
||||||
decoded.destinationServiceId || ourAci,
|
normalizeServiceId(
|
||||||
'Envelope.destinationServiceId'
|
decoded.destinationServiceId || ourAci,
|
||||||
),
|
'Envelope.destinationServiceId'
|
||||||
|
) ?? null,
|
||||||
updatedPni: isUntaggedPniString(decoded.updatedPni)
|
updatedPni: isUntaggedPniString(decoded.updatedPni)
|
||||||
? normalizePni(
|
? normalizePni(
|
||||||
toTaggedPni(decoded.updatedPni),
|
toTaggedPni(decoded.updatedPni),
|
||||||
'Envelope.updatedPni'
|
'Envelope.updatedPni'
|
||||||
)
|
)
|
||||||
: undefined,
|
: null,
|
||||||
// Sadly not captured previously
|
// Sadly not captured previously
|
||||||
messageAgeSec: 0,
|
messageAgeSec: 0,
|
||||||
reportingToken: decoded.reportSpamToken?.length
|
reportingToken: decoded.reportSpamToken?.length
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2025 Signal Messenger, LLC
|
// Copyright 2025 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
|
||||||
|
@@ -5,14 +5,13 @@ import type { LoggerType } from '../../types/Logging';
|
|||||||
import { isValidUuid } from '../../util/isValidUuid';
|
import { isValidUuid } from '../../util/isValidUuid';
|
||||||
import Helpers from '../../textsecure/Helpers';
|
import Helpers from '../../textsecure/Helpers';
|
||||||
import { createOrUpdate, getById, removeById } from '../util';
|
import { createOrUpdate, getById, removeById } from '../util';
|
||||||
import type { EmptyQuery, Query } from '../util';
|
|
||||||
import type { ItemKeyType, ReadableDB, WritableDB } from '../Interface';
|
import type { ItemKeyType, ReadableDB, WritableDB } from '../Interface';
|
||||||
|
|
||||||
export function getOurUuid(db: ReadableDB): string | undefined {
|
export function getOurUuid(db: ReadableDB): string | undefined {
|
||||||
const UUID_ID: ItemKeyType = 'uuid_id';
|
const UUID_ID: ItemKeyType = 'uuid_id';
|
||||||
|
|
||||||
const row: { json: string } | undefined = db
|
const row: { json: string } | undefined = db
|
||||||
.prepare<Query>('SELECT json FROM items WHERE id = $id;')
|
.prepare('SELECT json FROM items WHERE id = $id;')
|
||||||
.get({ id: UUID_ID });
|
.get({ id: UUID_ID });
|
||||||
|
|
||||||
if (!row) {
|
if (!row) {
|
||||||
@@ -34,19 +33,20 @@ export default function updateToSchemaVersion41(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getConversationUuid = db
|
const getConversationUuid = db.prepare(
|
||||||
.prepare<Query>(
|
`
|
||||||
`
|
SELECT uuid
|
||||||
SELECT uuid
|
FROM
|
||||||
FROM
|
conversations
|
||||||
conversations
|
WHERE
|
||||||
WHERE
|
id = $conversationId
|
||||||
id = $conversationId
|
`,
|
||||||
`
|
{
|
||||||
)
|
pluck: true,
|
||||||
.pluck();
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const getConversationStats = db.prepare<Query>(
|
const getConversationStats = db.prepare(
|
||||||
`
|
`
|
||||||
SELECT uuid, e164, active_at
|
SELECT uuid, e164, active_at
|
||||||
FROM
|
FROM
|
||||||
@@ -56,9 +56,15 @@ export default function updateToSchemaVersion41(
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
type StatsType = {
|
||||||
|
uuid: string;
|
||||||
|
e164: string;
|
||||||
|
active_at: number;
|
||||||
|
};
|
||||||
|
|
||||||
const compareConvoRecency = (a: string, b: string): number => {
|
const compareConvoRecency = (a: string, b: string): number => {
|
||||||
const aStats = getConversationStats.get({ conversationId: a });
|
const aStats = getConversationStats.get<StatsType>({ conversationId: a });
|
||||||
const bStats = getConversationStats.get({ conversationId: b });
|
const bStats = getConversationStats.get<StatsType>({ conversationId: b });
|
||||||
|
|
||||||
const isAComplete = Boolean(aStats?.uuid && aStats?.e164);
|
const isAComplete = Boolean(aStats?.uuid && aStats?.e164);
|
||||||
const isBComplete = Boolean(bStats?.uuid && bStats?.e164);
|
const isBComplete = Boolean(bStats?.uuid && bStats?.e164);
|
||||||
@@ -73,7 +79,7 @@ export default function updateToSchemaVersion41(
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aStats.active_at - bStats.active_at;
|
return (aStats?.active_at ?? 0) - (bStats?.active_at ?? 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearSessionsAndKeys = (): number => {
|
const clearSessionsAndKeys = (): number => {
|
||||||
@@ -141,7 +147,7 @@ export default function updateToSchemaVersion41(
|
|||||||
const prefixKeys = (ourUuid: string) => {
|
const prefixKeys = (ourUuid: string) => {
|
||||||
for (const table of ['signedPreKeys', 'preKeys']) {
|
for (const table of ['signedPreKeys', 'preKeys']) {
|
||||||
// Update id to include suffix, add `ourUuid` and `keyId` fields.
|
// Update id to include suffix, add `ourUuid` and `keyId` fields.
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE ${table}
|
UPDATE ${table}
|
||||||
SET
|
SET
|
||||||
@@ -166,14 +172,12 @@ export default function updateToSchemaVersion41(
|
|||||||
senderId: string;
|
senderId: string;
|
||||||
lastUpdatedDate: number;
|
lastUpdatedDate: number;
|
||||||
}> = db
|
}> = db
|
||||||
.prepare<EmptyQuery>(
|
.prepare('SELECT id, senderId, lastUpdatedDate FROM senderKeys')
|
||||||
'SELECT id, senderId, lastUpdatedDate FROM senderKeys'
|
|
||||||
)
|
|
||||||
.all();
|
.all();
|
||||||
|
|
||||||
logger.info(`Updating ${senderKeys.length} sender keys`);
|
logger.info(`Updating ${senderKeys.length} sender keys`);
|
||||||
|
|
||||||
const updateSenderKey = db.prepare<Query>(
|
const updateSenderKey = db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE senderKeys
|
UPDATE senderKeys
|
||||||
SET
|
SET
|
||||||
@@ -184,9 +188,7 @@ export default function updateToSchemaVersion41(
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
const deleteSenderKey = db.prepare<Query>(
|
const deleteSenderKey = db.prepare('DELETE FROM senderKeys WHERE id = $id');
|
||||||
'DELETE FROM senderKeys WHERE id = $id'
|
|
||||||
);
|
|
||||||
|
|
||||||
const pastKeys = new Map<
|
const pastKeys = new Map<
|
||||||
string,
|
string,
|
||||||
@@ -201,7 +203,7 @@ export default function updateToSchemaVersion41(
|
|||||||
let skipped = 0;
|
let skipped = 0;
|
||||||
for (const { id, senderId, lastUpdatedDate } of senderKeys) {
|
for (const { id, senderId, lastUpdatedDate } of senderKeys) {
|
||||||
const [conversationId] = Helpers.unencodeNumber(senderId);
|
const [conversationId] = Helpers.unencodeNumber(senderId);
|
||||||
const uuid = getConversationUuid.get({ conversationId });
|
const uuid = getConversationUuid.get<string>({ conversationId });
|
||||||
|
|
||||||
if (!uuid) {
|
if (!uuid) {
|
||||||
deleted += 1;
|
deleted += 1;
|
||||||
@@ -252,12 +254,12 @@ export default function updateToSchemaVersion41(
|
|||||||
//
|
//
|
||||||
// Set ourUuid column and field in json
|
// Set ourUuid column and field in json
|
||||||
const allSessions = db
|
const allSessions = db
|
||||||
.prepare<EmptyQuery>('SELECT id, conversationId FROM SESSIONS')
|
.prepare('SELECT id, conversationId FROM SESSIONS')
|
||||||
.all();
|
.all<{ id: string; conversationId: string }>();
|
||||||
|
|
||||||
logger.info(`Updating ${allSessions.length} sessions`);
|
logger.info(`Updating ${allSessions.length} sessions`);
|
||||||
|
|
||||||
const updateSession = db.prepare<Query>(
|
const updateSession = db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE sessions
|
UPDATE sessions
|
||||||
SET
|
SET
|
||||||
@@ -278,9 +280,7 @@ export default function updateToSchemaVersion41(
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
const deleteSession = db.prepare<Query>(
|
const deleteSession = db.prepare('DELETE FROM sessions WHERE id = $id');
|
||||||
'DELETE FROM sessions WHERE id = $id'
|
|
||||||
);
|
|
||||||
|
|
||||||
const pastSessions = new Map<
|
const pastSessions = new Map<
|
||||||
string,
|
string,
|
||||||
@@ -293,7 +293,7 @@ export default function updateToSchemaVersion41(
|
|||||||
let deleted = 0;
|
let deleted = 0;
|
||||||
let skipped = 0;
|
let skipped = 0;
|
||||||
for (const { id, conversationId } of allSessions) {
|
for (const { id, conversationId } of allSessions) {
|
||||||
const uuid = getConversationUuid.get({ conversationId });
|
const uuid = getConversationUuid.get<string>({ conversationId });
|
||||||
if (!uuid) {
|
if (!uuid) {
|
||||||
deleted += 1;
|
deleted += 1;
|
||||||
deleteSession.run({ id });
|
deleteSession.run({ id });
|
||||||
@@ -338,13 +338,13 @@ export default function updateToSchemaVersion41(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateIdentityKeys = () => {
|
const updateIdentityKeys = () => {
|
||||||
const identityKeys: ReadonlyArray<{
|
const identityKeys = db
|
||||||
id: string;
|
.prepare('SELECT id FROM identityKeys')
|
||||||
}> = db.prepare<EmptyQuery>('SELECT id FROM identityKeys').all();
|
.all<{ id: string }>();
|
||||||
|
|
||||||
logger.info(`Updating ${identityKeys.length} identity keys`);
|
logger.info(`Updating ${identityKeys.length} identity keys`);
|
||||||
|
|
||||||
const updateIdentityKey = db.prepare<Query>(
|
const updateIdentityKey = db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE OR REPLACE identityKeys
|
UPDATE OR REPLACE identityKeys
|
||||||
SET
|
SET
|
||||||
@@ -361,7 +361,7 @@ export default function updateToSchemaVersion41(
|
|||||||
|
|
||||||
let migrated = 0;
|
let migrated = 0;
|
||||||
for (const { id } of identityKeys) {
|
for (const { id } of identityKeys) {
|
||||||
const uuid = getConversationUuid.get({ conversationId: id });
|
const uuid = getConversationUuid.get<string>({ conversationId: id });
|
||||||
|
|
||||||
let newId: string;
|
let newId: string;
|
||||||
if (uuid) {
|
if (uuid) {
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import { batchMultiVarQuery } from '../util';
|
import { batchMultiVarQuery } from '../util';
|
||||||
import type { ArrayQuery } from '../util';
|
|
||||||
import type { WritableDB } from '../Interface';
|
import type { WritableDB } from '../Interface';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
@@ -39,8 +38,9 @@ export default function updateToSchemaVersion42(
|
|||||||
// Note: we use `pluck` here to fetch only the first column of
|
// Note: we use `pluck` here to fetch only the first column of
|
||||||
// returned row.
|
// returned row.
|
||||||
const messageIdList: Array<string> = db
|
const messageIdList: Array<string> = db
|
||||||
.prepare('SELECT id FROM messages ORDER BY id ASC;')
|
.prepare('SELECT id FROM messages ORDER BY id ASC;', {
|
||||||
.pluck()
|
pluck: true,
|
||||||
|
})
|
||||||
.all();
|
.all();
|
||||||
const allReactions: Array<{
|
const allReactions: Array<{
|
||||||
rowid: number;
|
rowid: number;
|
||||||
@@ -57,7 +57,7 @@ export default function updateToSchemaVersion42(
|
|||||||
});
|
});
|
||||||
|
|
||||||
function deleteReactions(rowids: ReadonlyArray<number>) {
|
function deleteReactions(rowids: ReadonlyArray<number>) {
|
||||||
db.prepare<ArrayQuery>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
DELETE FROM reactions
|
DELETE FROM reactions
|
||||||
WHERE rowid IN ( ${rowids.map(() => '?').join(', ')} );
|
WHERE rowid IN ( ${rowids.map(() => '?').join(', ')} );
|
||||||
|
@@ -14,7 +14,6 @@ import {
|
|||||||
jsonToObject,
|
jsonToObject,
|
||||||
objectToJSON,
|
objectToJSON,
|
||||||
} from '../util';
|
} from '../util';
|
||||||
import type { EmptyQuery, Query } from '../util';
|
|
||||||
import type { WritableDB } from '../Interface';
|
import type { WritableDB } from '../Interface';
|
||||||
|
|
||||||
type MessageType = Readonly<{
|
type MessageType = Readonly<{
|
||||||
@@ -61,17 +60,18 @@ export default function updateToSchemaVersion43(
|
|||||||
pendingAdminApprovalV2?: Array<LegacyAdminApprovalType>;
|
pendingAdminApprovalV2?: Array<LegacyAdminApprovalType>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getConversationUuid = db
|
const getConversationUuid = db.prepare(
|
||||||
.prepare<Query>(
|
`
|
||||||
`
|
SELECT uuid
|
||||||
SELECT uuid
|
FROM
|
||||||
FROM
|
conversations
|
||||||
conversations
|
WHERE
|
||||||
WHERE
|
id = $conversationId
|
||||||
id = $conversationId
|
`,
|
||||||
`
|
{
|
||||||
)
|
pluck: true,
|
||||||
.pluck();
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const updateConversationStmt = db.prepare(
|
const updateConversationStmt = db.prepare(
|
||||||
`
|
`
|
||||||
@@ -112,7 +112,7 @@ export default function updateToSchemaVersion43(
|
|||||||
|
|
||||||
const newValue = oldValue
|
const newValue = oldValue
|
||||||
.map(member => {
|
.map(member => {
|
||||||
const uuid: ServiceIdString = getConversationUuid.get({
|
const uuid = getConversationUuid.get<ServiceIdString>({
|
||||||
conversationId: member.conversationId,
|
conversationId: member.conversationId,
|
||||||
});
|
});
|
||||||
if (!uuid) {
|
if (!uuid) {
|
||||||
@@ -278,7 +278,7 @@ export default function updateToSchemaVersion43(
|
|||||||
}
|
}
|
||||||
changedDetails = true;
|
changedDetails = true;
|
||||||
|
|
||||||
const newValue: ServiceIdString | null = getConversationUuid.get({
|
const newValue = getConversationUuid.get<ServiceIdString>({
|
||||||
conversationId: oldValue,
|
conversationId: oldValue,
|
||||||
});
|
});
|
||||||
if (key === 'inviter' && !newValue) {
|
if (key === 'inviter' && !newValue) {
|
||||||
@@ -318,7 +318,7 @@ export default function updateToSchemaVersion43(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sourceUuid) {
|
if (sourceUuid) {
|
||||||
const newValue: ServiceIdString | null = getConversationUuid.get({
|
const newValue = getConversationUuid.get<ServiceIdString>({
|
||||||
conversationId: sourceUuid,
|
conversationId: sourceUuid,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ export default function updateToSchemaVersion43(
|
|||||||
if (invitedGV2Members) {
|
if (invitedGV2Members) {
|
||||||
const newMembers = invitedGV2Members
|
const newMembers = invitedGV2Members
|
||||||
.map(({ addedByUserId, conversationId }, i) => {
|
.map(({ addedByUserId, conversationId }, i) => {
|
||||||
const uuid: ServiceIdString | null = getConversationUuid.get({
|
const uuid = getConversationUuid.get<ServiceIdString>({
|
||||||
conversationId,
|
conversationId,
|
||||||
});
|
});
|
||||||
const oldMember =
|
const oldMember =
|
||||||
@@ -357,7 +357,7 @@ export default function updateToSchemaVersion43(
|
|||||||
return newMember;
|
return newMember;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newAddedBy: ServiceIdString | null = getConversationUuid.get({
|
const newAddedBy = getConversationUuid.get<ServiceIdString>({
|
||||||
conversationId: addedByUserId,
|
conversationId: addedByUserId,
|
||||||
});
|
});
|
||||||
if (!newAddedBy) {
|
if (!newAddedBy) {
|
||||||
@@ -392,15 +392,16 @@ export default function updateToSchemaVersion43(
|
|||||||
|
|
||||||
db.transaction(() => {
|
db.transaction(() => {
|
||||||
const allConversations = db
|
const allConversations = db
|
||||||
.prepare<EmptyQuery>(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT json, profileLastFetchedAt
|
SELECT json
|
||||||
FROM conversations
|
FROM conversations
|
||||||
ORDER BY id ASC;
|
ORDER BY id ASC;
|
||||||
`
|
`,
|
||||||
|
{ pluck: true }
|
||||||
)
|
)
|
||||||
.all()
|
.all<string>()
|
||||||
.map(({ json }) => jsonToObject<ConversationType>(json));
|
.map(json => jsonToObject<ConversationType>(json));
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
'updateToSchemaVersion43: About to iterate through ' +
|
'updateToSchemaVersion43: About to iterate through ' +
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { getOurUuid } from './41-uuid-keys';
|
import { getOurUuid } from './41-uuid-keys';
|
||||||
import type { WritableDB } from '../Interface';
|
import type { WritableDB } from '../Interface';
|
||||||
import type { Query } from '../util';
|
|
||||||
|
|
||||||
export default function updateToSchemaVersion47(
|
export default function updateToSchemaVersion47(
|
||||||
currentVersion: number,
|
currentVersion: number,
|
||||||
@@ -123,7 +122,7 @@ export default function updateToSchemaVersion47(
|
|||||||
if (!ourUuid) {
|
if (!ourUuid) {
|
||||||
logger.info('updateToSchemaVersion47: our UUID not found');
|
logger.info('updateToSchemaVersion47: our UUID not found');
|
||||||
} else {
|
} else {
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE messages SET
|
UPDATE messages SET
|
||||||
isChangeCreatedByUs = json_extract(json, '$.groupV2Change.from') IS $ourUuid;
|
isChangeCreatedByUs = json_extract(json, '$.groupV2Change.from') IS $ourUuid;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ export default function updateToSchemaVersion51(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = getMessageById.get(messageId);
|
const message = getMessageById.get([messageId]);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`updateToSchemaVersion51: Unable to find message for reaction job ${id}`
|
`updateToSchemaVersion51: Unable to find message for reaction job ${id}`
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { jsonToObject } from '../util';
|
import { jsonToObject } from '../util';
|
||||||
import type { EmptyQuery } from '../util';
|
|
||||||
|
|
||||||
export default function updateToSchemaVersion53(
|
export default function updateToSchemaVersion53(
|
||||||
currentVersion: number,
|
currentVersion: number,
|
||||||
@@ -67,16 +66,17 @@ export default function updateToSchemaVersion53(
|
|||||||
|
|
||||||
db.transaction(() => {
|
db.transaction(() => {
|
||||||
const allConversations = db
|
const allConversations = db
|
||||||
.prepare<EmptyQuery>(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT json, profileLastFetchedAt
|
SELECT json
|
||||||
FROM conversations
|
FROM conversations
|
||||||
WHERE type = 'group'
|
WHERE type = 'group'
|
||||||
ORDER BY id ASC;
|
ORDER BY id ASC;
|
||||||
`
|
`,
|
||||||
|
{ pluck: true }
|
||||||
)
|
)
|
||||||
.all()
|
.all<string>()
|
||||||
.map(({ json }) => jsonToObject<ConversationType>(json));
|
.map(json => jsonToObject<ConversationType>(json));
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
'updateToSchemaVersion53: About to iterate through ' +
|
'updateToSchemaVersion53: About to iterate through ' +
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import { ReadStatus } from '../../messages/MessageReadStatus';
|
import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||||
import { SeenStatus } from '../../MessageSeenStatus';
|
import { SeenStatus } from '../../MessageSeenStatus';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import { ReadStatus } from '../../messages/MessageReadStatus';
|
import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||||
import { SeenStatus } from '../../MessageSeenStatus';
|
import { SeenStatus } from '../../MessageSeenStatus';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export default function updateToSchemaVersion72(
|
export default function updateToSchemaVersion72(
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ export default function updateToSchemaVersion77(
|
|||||||
db.exec(
|
db.exec(
|
||||||
`
|
`
|
||||||
-- Create FTS table with custom tokenizer from
|
-- Create FTS table with custom tokenizer from
|
||||||
-- @signalapp/better-sqlite3.
|
-- @signalapp/sqlcipher.
|
||||||
|
|
||||||
DROP TABLE messages_fts;
|
DROP TABLE messages_fts;
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ export default function updateToSchemaVersion78(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = getMessageById.get(messageId);
|
const message = getMessageById.get([messageId]);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`updateToSchemaVersion78: Unable to find message for ${queue.queueType} job ${id}`
|
`updateToSchemaVersion78: Unable to find message for ${queue.queueType} job ${id}`
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export default function updateToSchemaVersion83(
|
export default function updateToSchemaVersion83(
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export default function updateToSchemaVersion84(
|
export default function updateToSchemaVersion84(
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { cleanKeys } from './920-clean-more-keys';
|
import { cleanKeys } from './920-clean-more-keys';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import { omit } from 'lodash';
|
import { omit } from 'lodash';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
@@ -484,27 +484,31 @@ function migrateItems(db: Database, logger: LoggerType): OurServiceIds {
|
|||||||
const uuidIdJson = db
|
const uuidIdJson = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT json
|
SELECT json
|
||||||
FROM items
|
FROM items
|
||||||
WHERE id IS 'uuid_id'
|
WHERE id IS 'uuid_id'
|
||||||
`
|
`,
|
||||||
|
{
|
||||||
|
pluck: true,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.pluck()
|
.get<string>();
|
||||||
.get();
|
|
||||||
const pniJson = db
|
const pniJson = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT json
|
SELECT json
|
||||||
FROM items
|
FROM items
|
||||||
WHERE id IS 'pni'
|
WHERE id IS 'pni'
|
||||||
`
|
`,
|
||||||
|
{
|
||||||
|
pluck: true,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.pluck()
|
.get<string>();
|
||||||
.get();
|
|
||||||
|
|
||||||
let legacyAci: string | undefined;
|
let legacyAci: string | undefined;
|
||||||
try {
|
try {
|
||||||
[legacyAci] = JSON.parse(uuidIdJson).value.split('.', 2);
|
[legacyAci] = JSON.parse(uuidIdJson ?? '').value.split('.', 2);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (uuidIdJson) {
|
if (uuidIdJson) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
@@ -518,7 +522,7 @@ function migrateItems(db: Database, logger: LoggerType): OurServiceIds {
|
|||||||
|
|
||||||
let legacyPni: string | undefined;
|
let legacyPni: string | undefined;
|
||||||
try {
|
try {
|
||||||
legacyPni = JSON.parse(pniJson).value;
|
legacyPni = JSON.parse(pniJson ?? '').value;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (pniJson) {
|
if (pniJson) {
|
||||||
logger.warn('updateToSchemaVersion88: failed to parse pni item', error);
|
logger.warn('updateToSchemaVersion88: failed to parse pni item', error);
|
||||||
@@ -852,7 +856,10 @@ function migratePreKeys(
|
|||||||
ourServiceIds: OurServiceIds,
|
ourServiceIds: OurServiceIds,
|
||||||
logger: LoggerType
|
logger: LoggerType
|
||||||
): void {
|
): void {
|
||||||
const preKeys = db.prepare(`SELECT id, json FROM ${table}`).all();
|
const preKeys = db.prepare(`SELECT id, json FROM ${table}`).all<{
|
||||||
|
id: string;
|
||||||
|
json: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
const updateStmt = db.prepare(`
|
const updateStmt = db.prepare(`
|
||||||
UPDATE ${table}
|
UPDATE ${table}
|
||||||
@@ -1001,7 +1008,11 @@ function migrateJobs(
|
|||||||
identifierToServiceId: Map<string, ServiceIdString>,
|
identifierToServiceId: Map<string, ServiceIdString>,
|
||||||
logger: LoggerType
|
logger: LoggerType
|
||||||
): void {
|
): void {
|
||||||
const jobs = db.prepare('SELECT id, queueType, data FROM jobs').all();
|
const jobs = db.prepare('SELECT id, queueType, data FROM jobs').all<{
|
||||||
|
id: string;
|
||||||
|
queueType: string;
|
||||||
|
data: string;
|
||||||
|
}>();
|
||||||
const updateStmt = db.prepare('UPDATE jobs SET data = $data WHERE id IS $id');
|
const updateStmt = db.prepare('UPDATE jobs SET data = $data WHERE id IS $id');
|
||||||
|
|
||||||
let updatedCount = 0;
|
let updatedCount = 0;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database, RunResult } from '@signalapp/better-sqlite3';
|
import type { Database, RunResult } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
@@ -60,10 +60,12 @@ export default function updateToSchemaVersion91(
|
|||||||
|
|
||||||
// Do overall count - if it's less than 1000, move on
|
// Do overall count - if it's less than 1000, move on
|
||||||
|
|
||||||
const totalKeys = db
|
const totalKeys =
|
||||||
.prepare('SELECT count(*) FROM preKeys;')
|
db
|
||||||
.pluck(true)
|
.prepare('SELECT count(*) FROM preKeys;', {
|
||||||
.get();
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get<number>() ?? 0;
|
||||||
logger.info(`updateToSchemaVersion91: Found ${totalKeys} keys`);
|
logger.info(`updateToSchemaVersion91: Found ${totalKeys} keys`);
|
||||||
if (totalKeys < 1000) {
|
if (totalKeys < 1000) {
|
||||||
db.pragma('user_version = 91');
|
db.pragma('user_version = 91');
|
||||||
@@ -74,11 +76,12 @@ export default function updateToSchemaVersion91(
|
|||||||
|
|
||||||
let pni: PniString;
|
let pni: PniString;
|
||||||
const pniJson = db
|
const pniJson = db
|
||||||
.prepare("SELECT json FROM items WHERE id IS 'pni'")
|
.prepare("SELECT json FROM items WHERE id IS 'pni'", {
|
||||||
.pluck()
|
pluck: true,
|
||||||
.get();
|
})
|
||||||
|
.get<string>();
|
||||||
try {
|
try {
|
||||||
const pniData = JSON.parse(pniJson);
|
const pniData = JSON.parse(pniJson ?? '');
|
||||||
pni = normalizePni(pniData.value, 'updateToSchemaVersion91');
|
pni = normalizePni(pniData.value, 'updateToSchemaVersion91');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
db.pragma('user_version = 91');
|
db.pragma('user_version = 91');
|
||||||
@@ -97,7 +100,11 @@ export default function updateToSchemaVersion91(
|
|||||||
|
|
||||||
const [beforeQuery, beforeParams] =
|
const [beforeQuery, beforeParams] =
|
||||||
sql`SELECT count(*) from preKeys WHERE ourServiceId = ${pni}`;
|
sql`SELECT count(*) from preKeys WHERE ourServiceId = ${pni}`;
|
||||||
const beforeKeys = db.prepare(beforeQuery).pluck(true).get(beforeParams);
|
const beforeKeys = db
|
||||||
|
.prepare(beforeQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(beforeParams);
|
||||||
logger.info(`updateToSchemaVersion91: Found ${beforeKeys} preKeys for PNI`);
|
logger.info(`updateToSchemaVersion91: Found ${beforeKeys} preKeys for PNI`);
|
||||||
|
|
||||||
// Create index to help us with all these queries
|
// Create index to help us with all these queries
|
||||||
@@ -124,7 +131,11 @@ export default function updateToSchemaVersion91(
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
OFFSET 499
|
OFFSET 499
|
||||||
`;
|
`;
|
||||||
const oldBoundary = db.prepare(oldQuery).pluck(true).get(oldParams);
|
const oldBoundary = db
|
||||||
|
.prepare(oldQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(oldParams);
|
||||||
logger.info(
|
logger.info(
|
||||||
`updateToSchemaVersion91: Found 500th-oldest timestamp: ${oldBoundary}`
|
`updateToSchemaVersion91: Found 500th-oldest timestamp: ${oldBoundary}`
|
||||||
);
|
);
|
||||||
@@ -141,7 +152,11 @@ export default function updateToSchemaVersion91(
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
OFFSET 499
|
OFFSET 499
|
||||||
`;
|
`;
|
||||||
const newBoundary = db.prepare(newQuery).pluck(true).get(newParams);
|
const newBoundary = db
|
||||||
|
.prepare(newQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(newParams);
|
||||||
logger.info(
|
logger.info(
|
||||||
`updateToSchemaVersion91: Found 500th-newest timestamp: ${newBoundary}`
|
`updateToSchemaVersion91: Found 500th-newest timestamp: ${newBoundary}`
|
||||||
);
|
);
|
||||||
@@ -155,8 +170,8 @@ export default function updateToSchemaVersion91(
|
|||||||
SELECT rowid FROM preKeys
|
SELECT rowid FROM preKeys
|
||||||
WHERE
|
WHERE
|
||||||
createdAt IS NOT NULL AND
|
createdAt IS NOT NULL AND
|
||||||
createdAt > ${oldBoundary} AND
|
createdAt > ${oldBoundary ?? null} AND
|
||||||
createdAt < ${newBoundary} AND
|
createdAt < ${newBoundary ?? null} AND
|
||||||
ourServiceId = ${pni}
|
ourServiceId = ${pni}
|
||||||
LIMIT 10000
|
LIMIT 10000
|
||||||
);
|
);
|
||||||
@@ -175,7 +190,11 @@ export default function updateToSchemaVersion91(
|
|||||||
FROM preKeys
|
FROM preKeys
|
||||||
WHERE ourServiceId = ${pni};
|
WHERE ourServiceId = ${pni};
|
||||||
`;
|
`;
|
||||||
const afterCount = db.prepare(afterQuery).pluck(true).get(afterParams);
|
const afterCount = db
|
||||||
|
.prepare(afterQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(afterParams);
|
||||||
logger.info(
|
logger.info(
|
||||||
`updateToSchemaVersion91: Found ${afterCount} preKeys for PNI after delete`
|
`updateToSchemaVersion91: Found ${afterCount} preKeys for PNI after delete`
|
||||||
);
|
);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database, RunResult } from '@signalapp/better-sqlite3';
|
import type { Database, RunResult } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import type { QueryFragment } from '../util';
|
import type { QueryFragment } from '../util';
|
||||||
@@ -65,11 +65,12 @@ export function cleanKeys(
|
|||||||
// Grab our PNI
|
// Grab our PNI
|
||||||
let pni: PniString;
|
let pni: PniString;
|
||||||
const pniJson = db
|
const pniJson = db
|
||||||
.prepare("SELECT json FROM items WHERE id IS 'pni'")
|
.prepare("SELECT json FROM items WHERE id IS 'pni'", {
|
||||||
.pluck()
|
pluck: true,
|
||||||
.get();
|
})
|
||||||
|
.get<string>();
|
||||||
try {
|
try {
|
||||||
const pniData = JSON.parse(pniJson);
|
const pniData = JSON.parse(pniJson ?? '');
|
||||||
pni = normalizePni(pniData.value, logId);
|
pni = normalizePni(pniData.value, logId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (pniJson) {
|
if (pniJson) {
|
||||||
@@ -84,10 +85,12 @@ export function cleanKeys(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do overall count - if it's less than 1000, move on
|
// Do overall count - if it's less than 1000, move on
|
||||||
const totalKeys = db
|
const totalKeys =
|
||||||
.prepare(sql`SELECT count(*) FROM ${tableName};`[0])
|
db
|
||||||
.pluck(true)
|
.prepare(sql`SELECT count(*) FROM ${tableName};`[0], {
|
||||||
.get();
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get<number>() ?? 0;
|
||||||
logger.info(`${logId}: Found ${totalKeys} total keys`);
|
logger.info(`${logId}: Found ${totalKeys} total keys`);
|
||||||
if (totalKeys < 1000) {
|
if (totalKeys < 1000) {
|
||||||
return;
|
return;
|
||||||
@@ -96,7 +99,11 @@ export function cleanKeys(
|
|||||||
// Grab PNI-specific count
|
// Grab PNI-specific count
|
||||||
const [beforeQuery, beforeParams] =
|
const [beforeQuery, beforeParams] =
|
||||||
sql`SELECT count(*) from ${tableName} WHERE ${idField} = ${pni}`;
|
sql`SELECT count(*) from ${tableName} WHERE ${idField} = ${pni}`;
|
||||||
const beforeKeys = db.prepare(beforeQuery).pluck(true).get(beforeParams);
|
const beforeKeys = db
|
||||||
|
.prepare(beforeQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(beforeParams);
|
||||||
logger.info(`${logId}: Found ${beforeKeys} keys for PNI`);
|
logger.info(`${logId}: Found ${beforeKeys} keys for PNI`);
|
||||||
|
|
||||||
// Create index to help us with all these queries
|
// Create index to help us with all these queries
|
||||||
@@ -123,7 +130,11 @@ export function cleanKeys(
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
OFFSET 499
|
OFFSET 499
|
||||||
`;
|
`;
|
||||||
const oldBoundary = db.prepare(oldQuery).pluck(true).get(oldParams);
|
const oldBoundary = db
|
||||||
|
.prepare(oldQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(oldParams);
|
||||||
logger.info(`${logId}: Found 500th-oldest timestamp: ${oldBoundary}`);
|
logger.info(`${logId}: Found 500th-oldest timestamp: ${oldBoundary}`);
|
||||||
|
|
||||||
// Fetch 500th-newest timestamp for PNI
|
// Fetch 500th-newest timestamp for PNI
|
||||||
@@ -137,7 +148,11 @@ export function cleanKeys(
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
OFFSET 499
|
OFFSET 499
|
||||||
`;
|
`;
|
||||||
const newBoundary = db.prepare(newQuery).pluck(true).get(newParams);
|
const newBoundary = db
|
||||||
|
.prepare(newQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(newParams);
|
||||||
logger.info(`${logId}: Found 500th-newest timestamp: ${newBoundary}`);
|
logger.info(`${logId}: Found 500th-newest timestamp: ${newBoundary}`);
|
||||||
|
|
||||||
// Delete everything in between for PNI
|
// Delete everything in between for PNI
|
||||||
@@ -146,8 +161,8 @@ export function cleanKeys(
|
|||||||
DELETE FROM ${tableName}
|
DELETE FROM ${tableName}
|
||||||
WHERE
|
WHERE
|
||||||
createdAt IS NOT NULL AND
|
createdAt IS NOT NULL AND
|
||||||
createdAt > ${oldBoundary} AND
|
createdAt > ${oldBoundary ?? null} AND
|
||||||
createdAt < ${newBoundary} AND
|
createdAt < ${newBoundary ?? null} AND
|
||||||
${idField} = ${pni}
|
${idField} = ${pni}
|
||||||
LIMIT 10000;
|
LIMIT 10000;
|
||||||
`;
|
`;
|
||||||
@@ -164,7 +179,11 @@ export function cleanKeys(
|
|||||||
FROM ${tableName}
|
FROM ${tableName}
|
||||||
WHERE ${idField} = ${pni};
|
WHERE ${idField} = ${pni};
|
||||||
`;
|
`;
|
||||||
const afterCount = db.prepare(afterQuery).pluck(true).get(afterParams);
|
const afterCount = db
|
||||||
|
.prepare(afterQuery, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(afterParams);
|
||||||
logger.info(`${logId}: Found ${afterCount} keys for PNI after delete`);
|
logger.info(`${logId}: Found ${afterCount} keys for PNI after delete`);
|
||||||
|
|
||||||
db.exec(
|
db.exec(
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
import type {
|
import type {
|
||||||
@@ -74,27 +74,31 @@ function migratePni(
|
|||||||
const uuidIdJson = db
|
const uuidIdJson = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT json
|
SELECT json
|
||||||
FROM items
|
FROM items
|
||||||
WHERE id IS 'uuid_id'
|
WHERE id IS 'uuid_id'
|
||||||
`
|
`,
|
||||||
|
{
|
||||||
|
pluck: true,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.pluck()
|
.get<string>();
|
||||||
.get();
|
|
||||||
const pniJson = db
|
const pniJson = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT json
|
SELECT json
|
||||||
FROM items
|
FROM items
|
||||||
WHERE id IS 'pni'
|
WHERE id IS 'pni'
|
||||||
`
|
`,
|
||||||
|
{
|
||||||
|
pluck: true,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.pluck()
|
.get<string>();
|
||||||
.get();
|
|
||||||
|
|
||||||
let aci: string | undefined;
|
let aci: string | undefined;
|
||||||
try {
|
try {
|
||||||
[aci] = JSON.parse(uuidIdJson).value.split('.', 2);
|
[aci] = JSON.parse(uuidIdJson ?? '').value.split('.', 2);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (uuidIdJson) {
|
if (uuidIdJson) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
@@ -111,7 +115,7 @@ function migratePni(
|
|||||||
|
|
||||||
let legacyPni: string | undefined;
|
let legacyPni: string | undefined;
|
||||||
try {
|
try {
|
||||||
legacyPni = JSON.parse(pniJson).value;
|
legacyPni = JSON.parse(pniJson ?? '').value;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (pniJson) {
|
if (pniJson) {
|
||||||
logger.warn('updateToSchemaVersion960: failed to parse pni item', error);
|
logger.warn('updateToSchemaVersion960: failed to parse pni item', error);
|
||||||
@@ -188,7 +192,7 @@ function migratePreKeys(
|
|||||||
): void {
|
): void {
|
||||||
const preKeys = db
|
const preKeys = db
|
||||||
.prepare(`SELECT id, json FROM ${table} WHERE ourServiceId IS $legacyPni`)
|
.prepare(`SELECT id, json FROM ${table} WHERE ourServiceId IS $legacyPni`)
|
||||||
.all({ legacyPni });
|
.all<{ id: string; json: string }>({ legacyPni });
|
||||||
|
|
||||||
const updateStmt = db.prepare(`
|
const updateStmt = db.prepare(`
|
||||||
UPDATE ${table}
|
UPDATE ${table}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
export const version = 970;
|
export const version = 970;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2023 Signal Messenger, LLC
|
// Copyright 2023 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
|
|
||||||
import type { LoggerType } from '../../types/Logging';
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from '@signalapp/better-sqlite3';
|
import type { Database } from '@signalapp/sqlcipher';
|
||||||
import { keyBy } from 'lodash';
|
import { keyBy } from 'lodash';
|
||||||
import { v4 as generateUuid } from 'uuid';
|
import { v4 as generateUuid } from 'uuid';
|
||||||
|
|
||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
objectToJSON,
|
objectToJSON,
|
||||||
jsonToObject,
|
jsonToObject,
|
||||||
} from '../util';
|
} from '../util';
|
||||||
import type { Query, EmptyQuery } from '../util';
|
|
||||||
import type { WritableDB } from '../Interface';
|
import type { WritableDB } from '../Interface';
|
||||||
|
|
||||||
import updateToSchemaVersion41 from './41-uuid-keys';
|
import updateToSchemaVersion41 from './41-uuid-keys';
|
||||||
@@ -957,10 +956,10 @@ function updateToSchemaVersion20(
|
|||||||
// significantly, so we drop them and recreate them later.
|
// significantly, so we drop them and recreate them later.
|
||||||
// Drop triggers
|
// Drop triggers
|
||||||
const triggers = db
|
const triggers = db
|
||||||
.prepare<EmptyQuery>(
|
.prepare(
|
||||||
"SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = 'messages'"
|
"SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = 'messages'"
|
||||||
)
|
)
|
||||||
.all();
|
.all<{ name: string; sql: string }>();
|
||||||
|
|
||||||
for (const trigger of triggers) {
|
for (const trigger of triggers) {
|
||||||
db.exec(`DROP TRIGGER ${trigger.name}`);
|
db.exec(`DROP TRIGGER ${trigger.name}`);
|
||||||
@@ -985,28 +984,29 @@ function updateToSchemaVersion20(
|
|||||||
|
|
||||||
// Drop invalid groups and any associated messages
|
// Drop invalid groups and any associated messages
|
||||||
const maybeInvalidGroups = db
|
const maybeInvalidGroups = db
|
||||||
.prepare<EmptyQuery>(
|
.prepare(
|
||||||
"SELECT * FROM conversations WHERE type = 'group' AND members IS NULL;"
|
"SELECT * FROM conversations WHERE type = 'group' AND members IS NULL;"
|
||||||
)
|
)
|
||||||
.all();
|
.all<{ id: string; json: string }>();
|
||||||
for (const group of maybeInvalidGroups) {
|
for (const group of maybeInvalidGroups) {
|
||||||
const json: { id: string; members: Array<unknown> } = JSON.parse(
|
const json: { id: string; members: Array<unknown> } = JSON.parse(
|
||||||
group.json
|
group.json
|
||||||
);
|
);
|
||||||
if (!json.members || !json.members.length) {
|
if (!json.members || !json.members.length) {
|
||||||
db.prepare<Query>('DELETE FROM conversations WHERE id = $id;').run({
|
db.prepare('DELETE FROM conversations WHERE id = $id;').run({
|
||||||
|
id: json.id,
|
||||||
|
});
|
||||||
|
db.prepare('DELETE FROM messages WHERE conversationId = $id;').run({
|
||||||
id: json.id,
|
id: json.id,
|
||||||
});
|
});
|
||||||
db.prepare<Query>(
|
|
||||||
'DELETE FROM messages WHERE conversationId = $id;'
|
|
||||||
).run({ id: json.id });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate new IDs and alter data
|
// Generate new IDs and alter data
|
||||||
const allConversations = db
|
const allConversations = db.prepare('SELECT * FROM conversations;').all<{
|
||||||
.prepare<EmptyQuery>('SELECT * FROM conversations;')
|
id: string;
|
||||||
.all();
|
type: string;
|
||||||
|
}>();
|
||||||
const allConversationsByOldId = keyBy(allConversations, 'id');
|
const allConversationsByOldId = keyBy(allConversations, 'id');
|
||||||
|
|
||||||
for (const row of allConversations) {
|
for (const row of allConversations) {
|
||||||
@@ -1023,7 +1023,7 @@ function updateToSchemaVersion20(
|
|||||||
}
|
}
|
||||||
const patch = JSON.stringify(patchObj);
|
const patch = JSON.stringify(patchObj);
|
||||||
|
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE conversations
|
UPDATE conversations
|
||||||
SET id = $newId, json = JSON_PATCH(json, $patch)
|
SET id = $newId, json = JSON_PATCH(json, $patch)
|
||||||
@@ -1035,7 +1035,7 @@ function updateToSchemaVersion20(
|
|||||||
patch,
|
patch,
|
||||||
});
|
});
|
||||||
const messagePatch = JSON.stringify({ conversationId: newId });
|
const messagePatch = JSON.stringify({ conversationId: newId });
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE messages
|
UPDATE messages
|
||||||
SET conversationId = $newId, json = JSON_PATCH(json, $patch)
|
SET conversationId = $newId, json = JSON_PATCH(json, $patch)
|
||||||
@@ -1049,7 +1049,7 @@ function updateToSchemaVersion20(
|
|||||||
members: string;
|
members: string;
|
||||||
json: string;
|
json: string;
|
||||||
}> = db
|
}> = db
|
||||||
.prepare<EmptyQuery>(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT id, members, json FROM conversations WHERE type = 'group';
|
SELECT id, members, json FROM conversations WHERE type = 'group';
|
||||||
`
|
`
|
||||||
@@ -1088,7 +1088,7 @@ function updateToSchemaVersion20(
|
|||||||
profileSharing: false,
|
profileSharing: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE conversations
|
UPDATE conversations
|
||||||
SET
|
SET
|
||||||
@@ -1113,7 +1113,7 @@ function updateToSchemaVersion20(
|
|||||||
members: newMembers,
|
members: newMembers,
|
||||||
};
|
};
|
||||||
const newMembersValue = newMembers.join(' ');
|
const newMembersValue = newMembers.join(' ');
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE conversations
|
UPDATE conversations
|
||||||
SET members = $newMembersValue, json = $newJsonValue
|
SET members = $newMembersValue, json = $newJsonValue
|
||||||
@@ -1127,7 +1127,10 @@ function updateToSchemaVersion20(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Update sessions to stable IDs
|
// Update sessions to stable IDs
|
||||||
const allSessions = db.prepare<EmptyQuery>('SELECT * FROM sessions;').all();
|
const allSessions = db.prepare('SELECT * FROM sessions;').all<{
|
||||||
|
id: string;
|
||||||
|
json: string;
|
||||||
|
}>();
|
||||||
for (const session of allSessions) {
|
for (const session of allSessions) {
|
||||||
// Not using patch here so we can explicitly delete a property rather than
|
// Not using patch here so we can explicitly delete a property rather than
|
||||||
// implicitly delete via null
|
// implicitly delete via null
|
||||||
@@ -1138,7 +1141,7 @@ function updateToSchemaVersion20(
|
|||||||
newJson.id = `${newJson.conversationId}.${newJson.deviceId}`;
|
newJson.id = `${newJson.conversationId}.${newJson.deviceId}`;
|
||||||
}
|
}
|
||||||
delete newJson.number;
|
delete newJson.number;
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE sessions
|
UPDATE sessions
|
||||||
SET id = $newId, json = $newJson, conversationId = $newConversationId
|
SET id = $newId, json = $newJson, conversationId = $newConversationId
|
||||||
@@ -1153,13 +1156,14 @@ function updateToSchemaVersion20(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update identity keys to stable IDs
|
// Update identity keys to stable IDs
|
||||||
const allIdentityKeys = db
|
const allIdentityKeys = db.prepare('SELECT * FROM identityKeys;').all<{
|
||||||
.prepare<EmptyQuery>('SELECT * FROM identityKeys;')
|
json: string;
|
||||||
.all();
|
id: number;
|
||||||
|
}>();
|
||||||
for (const identityKey of allIdentityKeys) {
|
for (const identityKey of allIdentityKeys) {
|
||||||
const newJson = JSON.parse(identityKey.json);
|
const newJson = JSON.parse(identityKey.json);
|
||||||
newJson.id = allConversationsByOldId[newJson.id];
|
newJson.id = allConversationsByOldId[newJson.id];
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
UPDATE identityKeys
|
UPDATE identityKeys
|
||||||
SET id = $newId, json = $newJson
|
SET id = $newId, json = $newJson
|
||||||
@@ -2105,10 +2109,12 @@ export function enableFTS5SecureDelete(db: Database, logger: LoggerType): void {
|
|||||||
db
|
db
|
||||||
.prepare(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT v FROM messages_fts_config WHERE k is 'secure-delete';
|
SELECT v FROM messages_fts_config WHERE k is 'secure-delete';
|
||||||
`
|
`,
|
||||||
|
{
|
||||||
|
pluck: true,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.pluck()
|
|
||||||
.get() === 1;
|
.get() === 1;
|
||||||
|
|
||||||
if (!isEnabled) {
|
if (!isEnabled) {
|
||||||
|
@@ -21,7 +21,6 @@ import {
|
|||||||
defunctCallLinkFromRecord,
|
defunctCallLinkFromRecord,
|
||||||
} from '../../util/callLinksRingrtc';
|
} from '../../util/callLinksRingrtc';
|
||||||
import type { ReadableDB, WritableDB } from '../Interface';
|
import type { ReadableDB, WritableDB } from '../Interface';
|
||||||
import { prepare } from '../Server';
|
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
import { strictAssert } from '../../util/assert';
|
import { strictAssert } from '../../util/assert';
|
||||||
import { CallStatusValue, DirectCallStatus } from '../../types/CallDisposition';
|
import { CallStatusValue, DirectCallStatus } from '../../types/CallDisposition';
|
||||||
@@ -33,7 +32,13 @@ export function callLinkExists(db: ReadableDB, roomId: string): boolean {
|
|||||||
FROM callLinks
|
FROM callLinks
|
||||||
WHERE roomId = ${roomId};
|
WHERE roomId = ${roomId};
|
||||||
`;
|
`;
|
||||||
return db.prepare(query).pluck(true).get(params) === 1;
|
return (
|
||||||
|
db
|
||||||
|
.prepare(query, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(params) === 1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCallLinkByRoomId(
|
export function getCallLinkByRoomId(
|
||||||
@@ -53,11 +58,9 @@ export function getCallLinkRecordByRoomId(
|
|||||||
db: ReadableDB,
|
db: ReadableDB,
|
||||||
roomId: string
|
roomId: string
|
||||||
): CallLinkRecord | undefined {
|
): CallLinkRecord | undefined {
|
||||||
const row = prepare(db, 'SELECT * FROM callLinks WHERE roomId = $roomId').get(
|
const row = db.prepare('SELECT * FROM callLinks WHERE roomId = $roomId').get({
|
||||||
{
|
roomId,
|
||||||
roomId,
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!row) {
|
if (!row) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -83,8 +86,7 @@ function _insertCallLink(db: WritableDB, callLink: CallLinkType): void {
|
|||||||
assertRoomIdMatchesRootKey(roomId, rootKey);
|
assertRoomIdMatchesRootKey(roomId, rootKey);
|
||||||
|
|
||||||
const data = callLinkToRecord(callLink);
|
const data = callLinkToRecord(callLink);
|
||||||
prepare(
|
db.prepare(
|
||||||
db,
|
|
||||||
`
|
`
|
||||||
INSERT INTO callLinks (
|
INSERT INTO callLinks (
|
||||||
roomId,
|
roomId,
|
||||||
@@ -174,8 +176,7 @@ export function updateCallLinkAdminKeyByRoomId(
|
|||||||
adminKey: string
|
adminKey: string
|
||||||
): void {
|
): void {
|
||||||
const adminKeyBytes = toAdminKeyBytes(adminKey);
|
const adminKeyBytes = toAdminKeyBytes(adminKey);
|
||||||
prepare(
|
db.prepare(
|
||||||
db,
|
|
||||||
`
|
`
|
||||||
UPDATE callLinks
|
UPDATE callLinks
|
||||||
SET adminKey = $adminKeyBytes
|
SET adminKey = $adminKeyBytes
|
||||||
@@ -360,7 +361,11 @@ export function getAllMarkedDeletedCallLinkRoomIds(
|
|||||||
const [query] = sql`
|
const [query] = sql`
|
||||||
SELECT roomId FROM callLinks WHERE deleted = 1;
|
SELECT roomId FROM callLinks WHERE deleted = 1;
|
||||||
`;
|
`;
|
||||||
return db.prepare(query).pluck().all();
|
return db
|
||||||
|
.prepare(query, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.all();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Run this after uploading storage records, maybe periodically on startup
|
// TODO: Run this after uploading storage records, maybe periodically on startup
|
||||||
@@ -387,7 +392,13 @@ export function defunctCallLinkExists(db: ReadableDB, roomId: string): boolean {
|
|||||||
FROM defunctCallLinks
|
FROM defunctCallLinks
|
||||||
WHERE roomId = ${roomId};
|
WHERE roomId = ${roomId};
|
||||||
`;
|
`;
|
||||||
return db.prepare(query).pluck(true).get(params) === 1;
|
return (
|
||||||
|
db
|
||||||
|
.prepare(query, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
|
.get(params) === 1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllDefunctCallLinksWithAdminKey(
|
export function getAllDefunctCallLinksWithAdminKey(
|
||||||
@@ -414,8 +425,7 @@ export function insertDefunctCallLink(
|
|||||||
assertRoomIdMatchesRootKey(roomId, rootKey);
|
assertRoomIdMatchesRootKey(roomId, rootKey);
|
||||||
|
|
||||||
const data = defunctCallLinkToRecord(defunctCallLink);
|
const data = defunctCallLinkToRecord(defunctCallLink);
|
||||||
prepare(
|
db.prepare(
|
||||||
db,
|
|
||||||
`
|
`
|
||||||
INSERT INTO defunctCallLinks (
|
INSERT INTO defunctCallLinks (
|
||||||
roomId,
|
roomId,
|
||||||
|
@@ -11,7 +11,6 @@ import {
|
|||||||
groupSendMemberEndorsementSchema,
|
groupSendMemberEndorsementSchema,
|
||||||
groupSendEndorsementsDataSchema,
|
groupSendEndorsementsDataSchema,
|
||||||
} from '../../types/GroupSendEndorsements';
|
} from '../../types/GroupSendEndorsements';
|
||||||
import { prepare } from '../Server';
|
|
||||||
import type { ReadableDB, WritableDB } from '../Interface';
|
import type { ReadableDB, WritableDB } from '../Interface';
|
||||||
import { sql } from '../util';
|
import { sql } from '../util';
|
||||||
import type { AciString } from '../../types/ServiceId';
|
import type { AciString } from '../../types/ServiceId';
|
||||||
@@ -43,8 +42,8 @@ function _deleteAllEndorsementsForGroup(db: WritableDB, groupId: string): void {
|
|||||||
DELETE FROM groupSendMemberEndorsement
|
DELETE FROM groupSendMemberEndorsement
|
||||||
WHERE groupId IS ${groupId};
|
WHERE groupId IS ${groupId};
|
||||||
`;
|
`;
|
||||||
prepare<Array<unknown>>(db, deleteCombined).run(deleteCombinedParams);
|
db.prepare(deleteCombined).run(deleteCombinedParams);
|
||||||
prepare<Array<unknown>>(db, deleteMembers).run(deleteMembersParams);
|
db.prepare(deleteMembers).run(deleteMembersParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _replaceCombinedEndorsement(
|
function _replaceCombinedEndorsement(
|
||||||
@@ -57,9 +56,7 @@ function _replaceCombinedEndorsement(
|
|||||||
(groupId, expiration, endorsement)
|
(groupId, expiration, endorsement)
|
||||||
VALUES (${groupId}, ${expiration}, ${endorsement});
|
VALUES (${groupId}, ${expiration}, ${endorsement});
|
||||||
`;
|
`;
|
||||||
const result = prepare<Array<unknown>>(db, insertCombined).run(
|
const result = db.prepare(insertCombined).run(insertCombinedParams);
|
||||||
insertCombinedParams
|
|
||||||
);
|
|
||||||
strictAssert(
|
strictAssert(
|
||||||
result.changes === 1,
|
result.changes === 1,
|
||||||
'Must update groupSendCombinedEndorsement'
|
'Must update groupSendCombinedEndorsement'
|
||||||
@@ -77,9 +74,7 @@ function _replaceMemberEndorsements(
|
|||||||
(groupId, memberAci, expiration, endorsement)
|
(groupId, memberAci, expiration, endorsement)
|
||||||
VALUES (${groupId}, ${memberAci}, ${expiration}, ${endorsement});
|
VALUES (${groupId}, ${memberAci}, ${expiration}, ${endorsement});
|
||||||
`;
|
`;
|
||||||
const result = prepare<Array<unknown>>(db, replaceMember).run(
|
const result = db.prepare(replaceMember).run(replaceMemberParams);
|
||||||
replaceMemberParams
|
|
||||||
);
|
|
||||||
strictAssert(
|
strictAssert(
|
||||||
result.changes === 1,
|
result.changes === 1,
|
||||||
'Must update groupSendMemberEndorsement'
|
'Must update groupSendMemberEndorsement'
|
||||||
@@ -104,8 +99,10 @@ export function getGroupSendCombinedEndorsementExpiration(
|
|||||||
SELECT expiration FROM groupSendCombinedEndorsement
|
SELECT expiration FROM groupSendCombinedEndorsement
|
||||||
WHERE groupId IS ${groupId};
|
WHERE groupId IS ${groupId};
|
||||||
`;
|
`;
|
||||||
const value = prepare<Array<unknown>>(db, selectGroup)
|
const value = db
|
||||||
.pluck()
|
.prepare(selectGroup, {
|
||||||
|
pluck: true,
|
||||||
|
})
|
||||||
.get(selectGroupParams);
|
.get(selectGroupParams);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -128,19 +125,17 @@ export function getGroupSendEndorsementsData(
|
|||||||
WHERE groupId IS ${groupId}
|
WHERE groupId IS ${groupId}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const combinedEndorsement: unknown = prepare<Array<unknown>>(
|
const combinedEndorsement: unknown = db
|
||||||
db,
|
.prepare(selectCombinedEndorsement)
|
||||||
selectCombinedEndorsement
|
.get(selectCombinedEndorsementParams);
|
||||||
).get(selectCombinedEndorsementParams);
|
|
||||||
|
|
||||||
if (combinedEndorsement == null) {
|
if (combinedEndorsement == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const memberEndorsements: Array<unknown> = prepare<Array<unknown>>(
|
const memberEndorsements: Array<unknown> = db
|
||||||
db,
|
.prepare(selectMemberEndorsements)
|
||||||
selectMemberEndorsements
|
.all(selectMemberEndorsementsParams);
|
||||||
).all(selectMemberEndorsementsParams);
|
|
||||||
|
|
||||||
return parseLoose(groupSendEndorsementsDataSchema, {
|
return parseLoose(groupSendEndorsementsDataSchema, {
|
||||||
combinedEndorsement,
|
combinedEndorsement,
|
||||||
@@ -159,9 +154,9 @@ export function getGroupSendMemberEndorsement(
|
|||||||
WHERE groupId IS ${groupId}
|
WHERE groupId IS ${groupId}
|
||||||
AND memberAci IS ${memberAci}
|
AND memberAci IS ${memberAci}
|
||||||
`;
|
`;
|
||||||
const row = prepare<Array<unknown>>(db, selectMemberEndorsements).get(
|
const row = db
|
||||||
selectMemberEndorsementsParams
|
.prepare(selectMemberEndorsements)
|
||||||
);
|
.get(selectMemberEndorsementsParams);
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -6,11 +6,6 @@ import { isNumber, last } from 'lodash';
|
|||||||
import type { ReadableDB, WritableDB } from './Interface';
|
import type { ReadableDB, WritableDB } from './Interface';
|
||||||
import type { LoggerType } from '../types/Logging';
|
import type { LoggerType } from '../types/Logging';
|
||||||
|
|
||||||
export type EmptyQuery = [];
|
|
||||||
export type ArrayQuery = Array<ReadonlyArray<null | number | bigint | string>>;
|
|
||||||
export type Query = {
|
|
||||||
[key: string]: null | number | bigint | string | Uint8Array;
|
|
||||||
};
|
|
||||||
export type JSONRow = Readonly<{ json: string }>;
|
export type JSONRow = Readonly<{ json: string }>;
|
||||||
export type JSONRows = Array<JSONRow>;
|
export type JSONRows = Array<JSONRow>;
|
||||||
|
|
||||||
@@ -39,12 +34,7 @@ export function jsonToObject<T>(json: string): T {
|
|||||||
return JSON.parse(json);
|
return JSON.parse(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueryTemplateParam =
|
export type QueryTemplateParam = Uint8Array | string | number | null;
|
||||||
| Uint8Array
|
|
||||||
| string
|
|
||||||
| number
|
|
||||||
| null
|
|
||||||
| undefined;
|
|
||||||
export type QueryFragmentValue = QueryFragment | QueryTemplateParam;
|
export type QueryFragmentValue = QueryFragment | QueryTemplateParam;
|
||||||
|
|
||||||
export class QueryFragment {
|
export class QueryFragment {
|
||||||
@@ -184,7 +174,11 @@ export function explainQueryPlan(
|
|||||||
template: QueryTemplate
|
template: QueryTemplate
|
||||||
): QueryTemplate {
|
): QueryTemplate {
|
||||||
const [query, params] = template;
|
const [query, params] = template;
|
||||||
const plan = db.prepare(`EXPLAIN QUERY PLAN ${query}`).all(params);
|
const plan = db.prepare(`EXPLAIN QUERY PLAN ${query}`).all<{
|
||||||
|
id: string | number;
|
||||||
|
parent: string | number;
|
||||||
|
detail: string;
|
||||||
|
}>(params);
|
||||||
logger.info('EXPLAIN QUERY PLAN');
|
logger.info('EXPLAIN QUERY PLAN');
|
||||||
for (const line of query.split('\n')) {
|
for (const line of query.split('\n')) {
|
||||||
logger.info(line);
|
logger.info(line);
|
||||||
@@ -200,15 +194,15 @@ export function explainQueryPlan(
|
|||||||
//
|
//
|
||||||
|
|
||||||
export function getSQLiteVersion(db: ReadableDB): string {
|
export function getSQLiteVersion(db: ReadableDB): string {
|
||||||
const { sqlite_version: version } = db
|
return (
|
||||||
.prepare<EmptyQuery>('select sqlite_version() AS sqlite_version')
|
db
|
||||||
.get();
|
.prepare('select sqlite_version() AS sqlite_version', { pluck: true })
|
||||||
|
.get<string>() ?? ''
|
||||||
return version;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSchemaVersion(db: ReadableDB): number {
|
export function getSchemaVersion(db: ReadableDB): number {
|
||||||
return db.pragma('schema_version', { simple: true });
|
return db.pragma('schema_version', { simple: true }) as number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setUserVersion(db: WritableDB, version: number): void {
|
export function setUserVersion(db: WritableDB, version: number): void {
|
||||||
@@ -219,11 +213,11 @@ export function setUserVersion(db: WritableDB, version: number): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getUserVersion(db: ReadableDB): number {
|
export function getUserVersion(db: ReadableDB): number {
|
||||||
return db.pragma('user_version', { simple: true });
|
return db.pragma('user_version', { simple: true }) as number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSQLCipherVersion(db: ReadableDB): string | undefined {
|
export function getSQLCipherVersion(db: ReadableDB): string | undefined {
|
||||||
return db.pragma('cipher_version', { simple: true });
|
return db.pragma('cipher_version', { simple: true }) as string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -276,7 +270,7 @@ export function createOrUpdate<Key extends string | number>(
|
|||||||
throw new Error('createOrUpdate: Provided data did not have a truthy id');
|
throw new Error('createOrUpdate: Provided data did not have a truthy id');
|
||||||
}
|
}
|
||||||
|
|
||||||
db.prepare<Query>(
|
db.prepare(
|
||||||
`
|
`
|
||||||
INSERT OR REPLACE INTO ${table} (
|
INSERT OR REPLACE INTO ${table} (
|
||||||
id,
|
id,
|
||||||
@@ -310,14 +304,14 @@ export function getById<Key extends string | number, Result = unknown>(
|
|||||||
id: Key
|
id: Key
|
||||||
): Result | undefined {
|
): Result | undefined {
|
||||||
const row = db
|
const row = db
|
||||||
.prepare<Query>(
|
.prepare(
|
||||||
`
|
`
|
||||||
SELECT *
|
SELECT json
|
||||||
FROM ${table}
|
FROM ${table}
|
||||||
WHERE id = $id;
|
WHERE id = $id;
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.get({
|
.get<{ json: string }>({
|
||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -362,22 +356,21 @@ export function removeById<Key extends string | number>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function removeAllFromTable(db: WritableDB, table: TableType): number {
|
export function removeAllFromTable(db: WritableDB, table: TableType): number {
|
||||||
return db.prepare<EmptyQuery>(`DELETE FROM ${table};`).run().changes;
|
return db.prepare(`DELETE FROM ${table};`).run().changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllFromTable<T>(db: ReadableDB, table: TableType): Array<T> {
|
export function getAllFromTable<T>(db: ReadableDB, table: TableType): Array<T> {
|
||||||
const rows: JSONRows = db
|
const rows: JSONRows = db.prepare(`SELECT json FROM ${table};`).all();
|
||||||
.prepare<EmptyQuery>(`SELECT json FROM ${table};`)
|
|
||||||
.all();
|
|
||||||
|
|
||||||
return rows.map(row => jsonToObject(row.json));
|
return rows.map(row => jsonToObject(row.json));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCountFromTable(db: ReadableDB, table: TableType): number {
|
export function getCountFromTable(db: ReadableDB, table: TableType): number {
|
||||||
const result: null | number = db
|
const result = db
|
||||||
.prepare<EmptyQuery>(`SELECT count(*) from ${table};`)
|
.prepare(`SELECT count(*) from ${table};`, {
|
||||||
.pluck(true)
|
pluck: true,
|
||||||
.get();
|
})
|
||||||
|
.get<number>();
|
||||||
if (isNumber(result)) {
|
if (isNumber(result)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -392,7 +385,7 @@ export class TableIterator<ObjectType extends { id: string }> {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
*[Symbol.iterator](): Iterator<ObjectType> {
|
*[Symbol.iterator](): Iterator<ObjectType> {
|
||||||
const fetchObject = this.db.prepare<Query>(
|
const fetchObject = this.db.prepare(
|
||||||
`
|
`
|
||||||
SELECT json FROM ${this.table}
|
SELECT json FROM ${this.table}
|
||||||
WHERE id > $id
|
WHERE id > $id
|
||||||
|
@@ -61,6 +61,7 @@ describe('Message', () => {
|
|||||||
return window.MessageCache.register(
|
return window.MessageCache.register(
|
||||||
new MessageModel({
|
new MessageModel({
|
||||||
id,
|
id,
|
||||||
|
conversationId: 'convo',
|
||||||
...attrs,
|
...attrs,
|
||||||
sent_at: Date.now(),
|
sent_at: Date.now(),
|
||||||
received_at: Date.now(),
|
received_at: Date.now(),
|
||||||
|
@@ -315,8 +315,8 @@ describe('AttachmentDownloadManager/JobManager', () => {
|
|||||||
assert.strictEqual(runJob.callCount, 2);
|
assert.strictEqual(runJob.callCount, 2);
|
||||||
assertRunJobCalledWith([jobs[1], jobs[0]]);
|
assertRunJobCalledWith([jobs[1], jobs[0]]);
|
||||||
|
|
||||||
const retriedJob = await DataReader.getAttachmentDownloadJob(jobs[1]);
|
const retriedJob = await DataReader._getAttachmentDownloadJob(jobs[1]);
|
||||||
const finishedJob = await DataReader.getAttachmentDownloadJob(jobs[0]);
|
const finishedJob = await DataReader._getAttachmentDownloadJob(jobs[0]);
|
||||||
|
|
||||||
assert.isUndefined(finishedJob);
|
assert.isUndefined(finishedJob);
|
||||||
assert.strictEqual(retriedJob?.attempts, 1);
|
assert.strictEqual(retriedJob?.attempts, 1);
|
||||||
@@ -349,7 +349,7 @@ describe('AttachmentDownloadManager/JobManager', () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Ensure it's been removed after completed
|
// Ensure it's been removed after completed
|
||||||
assert.isUndefined(await DataReader.getAttachmentDownloadJob(jobs[1]));
|
assert.isUndefined(await DataReader._getAttachmentDownloadJob(jobs[1]));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('will reset attempts if addJob is called again', async () => {
|
it('will reset attempts if addJob is called again', async () => {
|
||||||
@@ -402,7 +402,7 @@ describe('AttachmentDownloadManager/JobManager', () => {
|
|||||||
assert.strictEqual(runJob.callCount, 8);
|
assert.strictEqual(runJob.callCount, 8);
|
||||||
|
|
||||||
// Ensure it's been removed
|
// Ensure it's been removed
|
||||||
assert.isUndefined(await DataReader.getAttachmentDownloadJob(jobs[0]));
|
assert.isUndefined(await DataReader._getAttachmentDownloadJob(jobs[0]));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('only selects backup_import jobs if the mediaDownload is not paused', async () => {
|
it('only selects backup_import jobs if the mediaDownload is not paused', async () => {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user