Skip to content

A lightweight Clip Studio Paint alternative with real-time multiplayer collaborative drawing. Built with Tauri and React.

1.0.0 verison

sora6e18729e438b
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..e72444c
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,71 @@
+name: Release Ink Studio
+
+on:
+ push:
+ tags:
+ - 'v*'
+ workflow_dispatch:
+
+permissions:
+ contents: write
+
+jobs:
+ publish-tauri:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - platform: windows-latest
+ args: ''
+ # Ready to enable when macOS / Linux releases are desired:
+ # - platform: macos-latest
+ # args: '--target aarch64-apple-darwin'
+ # - platform: macos-latest
+ # args: '--target x86_64-apple-darwin'
+ # - platform: ubuntu-22.04
+ # args: ''
+
+ runs-on: ${{ matrix.platform }}
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ cache: 'npm'
+
+ - name: Install Rust stable
+ uses: dtolnay/rust-toolchain@stable
+
+ - name: Rust cache
+ uses: swatinem/rust-cache@v2
+ with:
+ workspaces: './src-tauri -> target'
+
+ # Uncomment if enabling ubuntu-22.04 above:
+ # - name: Install Linux dependencies
+ # if: matrix.platform == 'ubuntu-22.04'
+ # run: |
+ # sudo apt-get update
+ # sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
+
+ - name: Install frontend dependencies
+ run: npm ci
+
+ - name: Build and publish Tauri release
+ uses: tauri-apps/tauri-action@v0
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
+ with:
+ tagName: v__VERSION__
+ releaseName: 'Ink Studio v__VERSION__'
+ releaseBody: 'See the assets below to download and install Ink Studio.'
+ releaseDraft: true
+ prerelease: false
+ includeUpdaterJson: true
+ args: ${{ matrix.args }}
diff --git a/.gitignore b/.gitignore
index 2e3d39d..88214d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,10 @@ dist-ssr
# Database and temp files
*.db
+
+# Secrets and signing keys
+*.key
+*.pub
+*.pem
+.env
+.env.*
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f6cdd22
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,232 @@
+GNU GENERAL PUBLIC LICENSE
+Version 3, 29 June 2007
+
+Copyright © 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 General Public License is a free, copyleft license for software and other kinds of works.
+
+The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
+
+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.
+
+To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
+
+For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
+
+Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
+
+Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS
+
+0. Definitions.
+
+“This License” refers to version 3 of the GNU 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. Use with the GNU Affero General Public License.
+Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
+
+14. Revised Versions of this License.
+The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
+
+If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
+
+Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
+
+15. Disclaimer of Warranty.
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. Limitation of Liability.
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+17. Interpretation of Sections 15 and 16.
+If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
+
+You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
+
+The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/README.md b/README.md
index ffb9922..a6db300 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Ink Studio
-A lightweight desktop digital painting application with real-time collaborative multiplayer drawing, inspired by Clip Studio Paint.
+**Collaborative Drawing Studio** by Sora — a lightweight desktop digital painting and manga application with real-time collaborative multiplayer drawing, inspired by Clip Studio Paint.
## Features
@@ -103,3 +103,7 @@ npm run tauri build
| `Ctrl + Shift + R` | Toggle perspective ruler |
| `Ctrl + Shift + P` | Toggle perspective snapping |
| `Ctrl + ,` | Settings |
+
+## License
+
+Ink Studio is licensed under the [GNU General Public License v3.0](./LICENSE) — Copyright © 2026 Sora.
diff --git a/index.html b/index.html
index 1a0089c..1237d41 100644
--- a/index.html
+++ b/index.html
@@ -5,10 +5,7 @@
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" href="/app-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Ink Studio</title>
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Neucha&display=swap" rel="stylesheet">
+ <title>Ink Studio - Collaborative Drawing Studio</title>
</head>
<body>
diff --git a/package-lock.json b/package-lock.json
index 462ba47..2e7b0b3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,16 +1,19 @@
{
"name": "ink-studio",
- "version": "0.1.0",
+ "version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ink-studio",
- "version": "0.1.0",
+ "version": "1.0.0",
+ "license": "GPL-3.0",
"dependencies": {
"@tailwindcss/vite": "^4.3.3",
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-opener": "^2",
+ "@tauri-apps/plugin-process": "^2.4.0",
+ "@tauri-apps/plugin-updater": "^2.14.1",
"@types/sql.js": "^1.4.11",
"@types/three": "^0.186.0",
"ag-psd": "^31.0.2",
@@ -626,9 +629,9 @@
}
},
"node_modules/@tauri-apps/api": {
- "version": "2.11.1",
- "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.11.1.tgz",
- "integrity": "sha512-M2FPuYND2m+wh5hfW9ZpSdxMPdEJovPBWwoHJmwUpysTYNHaOkVFN419m/K0LIgjb/7KU2vBgsUepJWugQCvAA==",
+ "version": "2.12.5",
+ "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.12.5.tgz",
+ "integrity": "sha512-G9QIMt5fzED+aS4QhVK3w1HWLKpLIwH/MnpCr9z1ugGEHnS2ORmqrLkc0uALOjRK4qXJy+4Yiw8LDl/KicC1Hg==",
"license": "Apache-2.0 OR MIT",
"funding": {
"type": "opencollective",
@@ -876,6 +879,24 @@
"@tauri-apps/api": "^2.11.0"
}
},
+ "node_modules/@tauri-apps/plugin-process": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.4.0.tgz",
+ "integrity": "sha512-GddrmsSLAYrLa/yTXlXK/YRDzUgYeeOnUXTbiyvJWkmI424RmDPD3FVLeqcon7rv6O6ZfhBilcrHWnSo7o6hIQ==",
+ "license": "MIT OR Apache-2.0",
+ "dependencies": {
+ "@tauri-apps/api": "^2.12.0"
+ }
+ },
+ "node_modules/@tauri-apps/plugin-updater": {
+ "version": "2.14.1",
+ "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-updater/-/plugin-updater-2.14.1.tgz",
+ "integrity": "sha512-Hr7nlBm1wT6xbwzjZ/S36YULazu8MNlj5vvOwMl47fXI7HTa5Bjl1PbDEwVHaZTAKzE1VZsUy35UqnbrQxmYQw==",
+ "license": "MIT OR Apache-2.0",
+ "dependencies": {
+ "@tauri-apps/api": "^2.12.0"
+ }
+ },
"node_modules/@tweenjs/tween.js": {
"version": "23.1.3",
"resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz",
diff --git a/package.json b/package.json
index 7685f74..c82d777 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,10 @@
{
"name": "ink-studio",
"private": true,
- "version": "0.1.0",
+ "version": "1.0.0",
+ "description": "Collaborative Drawing Studio",
+ "author": "Sora",
+ "license": "GPL-3.0",
"type": "module",
"scripts": {
"dev": "vite",
@@ -14,6 +17,8 @@
"@tailwindcss/vite": "^4.3.3",
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-opener": "^2",
+ "@tauri-apps/plugin-process": "^2.4.0",
+ "@tauri-apps/plugin-updater": "^2.14.1",
"@types/sql.js": "^1.4.11",
"@types/three": "^0.186.0",
"ag-psd": "^31.0.2",
diff --git a/public/tauri.svg b/public/tauri.svg
deleted file mode 100644
index 31b62c9..0000000
--- a/public/tauri.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
-<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
-</svg>
diff --git a/public/vite.svg b/public/vite.svg
deleted file mode 100644
index e7b8dfb..0000000
--- a/public/vite.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
\ No newline at end of file
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 04ff5a4..e8602b0 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -19,15 +19,15 @@ dependencies = [
[[package]]
name = "alloc-no-stdlib"
-version = "2.0.4"
+version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3"
+checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a"
[[package]]
name = "alloc-stdlib"
-version = "0.2.4"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e76a019e91224d279006ff972f1e984179a6e9feb050adba6ce8274aef23195"
+checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1"
dependencies = [
"alloc-no-stdlib",
]
@@ -295,7 +295,16 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
dependencies = [
- "bit-vec",
+ "bit-vec 0.8.0",
+]
+
+[[package]]
+name = "bit-set"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c"
+dependencies = [
+ "bit-vec 0.10.2",
]
[[package]]
@@ -304,6 +313,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
+[[package]]
+name = "bit-vec"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72503af1e72be411d74ca45cd6b309878fcb35354e252fc2a3a8bda3a97082a0"
+
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -361,9 +376,9 @@ dependencies = [
[[package]]
name = "brotli"
-version = "8.0.4"
+version = "9.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3"
+checksum = "9071f285ed78f04f37d675abaaef5de7689e2f30a216c8dc6795465d81910a13"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
@@ -372,9 +387,9 @@ dependencies = [
[[package]]
name = "brotli-decompressor"
-version = "5.0.3"
+version = "6.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583"
+checksum = "cc031cd87c6529082b0b65c604e86af0ed7744841b17ccfe60b1e31fa606179e"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
@@ -475,12 +490,13 @@ dependencies = [
[[package]]
name = "cargo_toml"
-version = "0.22.3"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "374b7c592d9c00c1f4972ea58390ac6b18cbb6ab79011f3bdc90a0b82ca06b77"
+checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9"
dependencies = [
+ "semver",
"serde",
- "toml 0.9.12+spec-1.1.0",
+ "toml 1.1.6+spec-1.1.0",
]
[[package]]
@@ -501,13 +517,13 @@ checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cfb"
-version = "0.7.3"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f"
+checksum = "a347dcabdae9c31b0825fd6a8bed285ec9c2acb89c47827126d52fa4f59cece3"
dependencies = [
- "byteorder",
"fnv",
"uuid",
+ "web-time",
]
[[package]]
@@ -526,6 +542,12 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
+[[package]]
+name = "cfg_aliases"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
+
[[package]]
name = "chrono"
version = "0.4.45"
@@ -563,6 +585,15 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"
+[[package]]
+name = "constant_time_eq"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9eb6feb175df65d0a3ccd3e73484e940d0ac664e8034f0519fd49a93db3071d9"
+dependencies = [
+ "rustversion",
+]
+
[[package]]
name = "cookie"
version = "0.18.2"
@@ -573,6 +604,16 @@ dependencies = [
"version_check",
]
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "core-foundation"
version = "0.10.1"
@@ -596,7 +637,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97"
dependencies = [
"bitflags 2.13.2",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-graphics-types",
"foreign-types",
"libc",
@@ -609,7 +650,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
dependencies = [
"bitflags 2.13.2",
- "core-foundation",
+ "core-foundation 0.10.1",
"libc",
]
@@ -676,42 +717,48 @@ dependencies = [
[[package]]
name = "cssparser"
-version = "0.36.0"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2"
+checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98"
dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa",
- "phf",
+ "phf 0.13.1",
"smallvec",
]
[[package]]
-name = "cssparser-macros"
-version = "0.6.1"
+name = "cssparser"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
+checksum = "11119743ad110e8c1bdccd930d7f5c30c99e5fc76a7b63ec9807e84eef0c5f59"
dependencies = [
- "quote",
- "syn 2.0.119",
+ "cssparser-macros",
+ "dtoa-short",
+ "itoa",
+ "phf 0.14.0",
+ "smallvec",
]
[[package]]
-name = "ctor"
-version = "0.8.0"
+name = "cssparser-macros"
+version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "352d39c2f7bef1d6ad73db6f5160efcaed66d94ef8c6c573a8410c00bf909a98"
+checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a"
dependencies = [
- "ctor-proc-macro",
- "dtor",
+ "quote",
+ "syn 3.0.6",
]
[[package]]
-name = "ctor-proc-macro"
-version = "0.0.7"
+name = "ctor"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1"
+checksum = "ea691ed9f36489d087419b8b2ba3ef27d89621380b4178c73e2445a379e4e0f4"
+dependencies = [
+ "link-section",
+]
[[package]]
name = "darling"
@@ -848,9 +895,9 @@ dependencies = [
[[package]]
name = "dirs"
-version = "6.0.0"
+version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
+checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f"
dependencies = [
"dirs-sys",
]
@@ -915,16 +962,31 @@ dependencies = [
[[package]]
name = "dom_query"
-version = "0.27.0"
+version = "0.28.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fac5fca71e65e94cc718a6e2af65d6e0f9c6027751c2aa562fbb5087fda639bc"
+dependencies = [
+ "bit-set 0.8.0",
+ "cssparser 0.37.0",
+ "foldhash",
+ "html5ever 0.39.0",
+ "precomputed-hash",
+ "selectors 0.38.0",
+ "tendril",
+]
+
+[[package]]
+name = "dom_query"
+version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "521e380c0c8afb8d9a1e83a1822ee03556fc3e3e7dbc1fd30be14e37f9cb3f89"
+checksum = "498c698ac51127148a3984450e51fca7f01805a91d7a1f7a24af0a5f761e3385"
dependencies = [
- "bit-set",
- "cssparser",
+ "bit-set 0.11.1",
+ "cssparser 0.38.0",
"foldhash",
- "html5ever",
+ "html5ever 0.40.1",
"precomputed-hash",
- "selectors",
+ "selectors 0.41.0",
"tendril",
]
@@ -952,21 +1014,6 @@ dependencies = [
"dtoa",
]
-[[package]]
-name = "dtor"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1057d6c64987086ff8ed0fd3fbf377a6b7d205cc7715868cd401705f715cbe4"
-dependencies = [
- "dtor-proc-macro",
-]
-
-[[package]]
-name = "dtor-proc-macro"
-version = "0.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5"
-
[[package]]
name = "dunce"
version = "1.0.5"
@@ -1098,6 +1145,16 @@ dependencies = [
"rustc_version",
]
+[[package]]
+name = "filetime"
+version = "0.2.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1255e7a9f1902190d4c10a75f2f7f495d3d3ce13e9ba26e6c48683a0f4dbed7"
+dependencies = [
+ "cfg-if",
+ "libc",
+]
+
[[package]]
name = "find-msvc-tools"
version = "0.1.13"
@@ -1386,8 +1443,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
dependencies = [
"cfg-if",
+ "js-sys",
"libc",
"r-efi 6.0.0",
+ "wasm-bindgen",
]
[[package]]
@@ -1576,12 +1635,23 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "html5ever"
-version = "0.38.0"
+version = "0.39.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8"
+dependencies = [
+ "log",
+ "markup5ever 0.39.0",
+]
+
+[[package]]
+name = "html5ever"
+version = "0.40.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2"
+checksum = "456a1a377e608e555d22ddab27ac0114bc7a7b4199078108e34c2aeae6c9b130"
dependencies = [
"log",
- "markup5ever",
+ "markup5ever 0.40.0",
+ "memchr",
]
[[package]]
@@ -1665,6 +1735,21 @@ dependencies = [
"want",
]
+[[package]]
+name = "hyper-rustls"
+version = "0.27.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53"
+dependencies = [
+ "http",
+ "hyper",
+ "hyper-util",
+ "rustls",
+ "tokio",
+ "tokio-rustls",
+ "tower-service",
+]
+
[[package]]
name = "hyper-util"
version = "0.1.21"
@@ -1684,9 +1769,11 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"socket2",
+ "system-configuration",
"tokio",
"tower-service",
"tracing",
+ "windows-registry",
]
[[package]]
@@ -1715,12 +1802,12 @@ dependencies = [
[[package]]
name = "ico"
-version = "0.5.0"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e795dff5605e0f04bff85ca41b51a96b83e80b281e96231bcaaf1ac35103371"
+checksum = "d75e94d66081e4d8dcd098bd8dc5254800fea14a26389b298410158d834de167"
dependencies = [
"byteorder",
- "png 0.17.16",
+ "png",
]
[[package]]
@@ -1858,13 +1945,36 @@ dependencies = [
[[package]]
name = "infer"
-version = "0.19.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7"
+checksum = "f4200d433cbd5178df7797c9c2e75b348b728e39631cf14520d1e2fc424201f4"
dependencies = [
"cfb",
]
+[[package]]
+name = "ink-studio"
+version = "1.0.0"
+dependencies = [
+ "axum",
+ "futures-util",
+ "getrandom 0.2.17",
+ "hex",
+ "lz4_flex",
+ "mime_guess",
+ "rust-embed",
+ "serde",
+ "serde_json",
+ "sha2 0.10.9",
+ "tauri",
+ "tauri-build",
+ "tauri-plugin-opener",
+ "tauri-plugin-process",
+ "tauri-plugin-updater",
+ "tokio",
+ "tower-http 0.5.2",
+]
+
[[package]]
name = "ipnet"
version = "2.12.2"
@@ -1989,6 +2099,36 @@ dependencies = [
"windows-sys 0.45.0",
]
+[[package]]
+name = "jni"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
+dependencies = [
+ "cfg-if",
+ "combine",
+ "jni-macros",
+ "jni-sys 0.4.1",
+ "log",
+ "simd_cesu8",
+ "thiserror 2.0.21",
+ "walkdir",
+ "windows-link 0.2.1",
+]
+
+[[package]]
+name = "jni-macros"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "simd_cesu8",
+ "syn 2.0.119",
+]
+
[[package]]
name = "jni-sys"
version = "0.3.1"
@@ -2030,21 +2170,21 @@ dependencies = [
[[package]]
name = "json-patch"
-version = "3.0.1"
+version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08"
+checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72"
dependencies = [
"jsonptr",
"serde",
"serde_json",
- "thiserror 1.0.69",
+ "thiserror 2.0.21",
]
[[package]]
name = "jsonptr"
-version = "0.6.3"
+version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70"
+checksum = "a5a3cc660ba5d72bce0b3bb295bf20847ccbb40fd423f3f05b61273672e561fe"
dependencies = [
"serde",
"serde_json",
@@ -2052,13 +2192,12 @@ dependencies = [
[[package]]
name = "keyboard-types"
-version = "0.7.0"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a"
+checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d"
dependencies = [
"bitflags 2.13.2",
"serde",
- "unicode-segmentation",
]
[[package]]
@@ -2119,6 +2258,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "link-section"
+version = "0.19.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4d9aae57673c1a235149777a74d152f3210ebd3e3b13346d2cdb6809e566bd3c"
+
[[package]]
name = "linux-raw-sys"
version = "0.12.1"
@@ -2157,13 +2302,24 @@ dependencies = [
[[package]]
name = "markup5ever"
-version = "0.38.0"
+version = "0.39.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de"
+dependencies = [
+ "log",
+ "tendril",
+ "web_atoms 0.2.6",
+]
+
+[[package]]
+name = "markup5ever"
+version = "0.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862"
+checksum = "0ab3dc68ac4a0f5719e560136778c1ee716e296030d75dbd4484e37e39e3a842"
dependencies = [
"log",
"tendril",
- "web_atoms",
+ "web_atoms 0.3.0",
]
[[package]]
@@ -2203,6 +2359,12 @@ dependencies = [
"unicase",
]
+[[package]]
+name = "minisign-verify"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "871285dc19d8d0ebe0eef3d0e99a205f2a71363b122632cbbfa4a6c370a960ce"
+
[[package]]
name = "miniz_oxide"
version = "0.8.9"
@@ -2236,9 +2398,9 @@ dependencies = [
[[package]]
name = "muda"
-version = "0.19.3"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1dd04e60bc0b07438a6771710ee1698f98f6ebbc7f89b61264af1563b8aeb878"
+checksum = "cca139e57da4383727f189e43e66e84fa372347027fc996f9f1a007ec0a37996"
dependencies = [
"crossbeam-channel",
"dpi",
@@ -2249,7 +2411,7 @@ dependencies = [
"objc2-core-foundation",
"objc2-foundation",
"once_cell",
- "png 0.18.1",
+ "png",
"serde",
"thiserror 2.0.21",
"windows-sys 0.61.2",
@@ -2270,6 +2432,12 @@ dependencies = [
"thiserror 1.0.69",
]
+[[package]]
+name = "ndk-context"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
+
[[package]]
name = "ndk-sys"
version = "0.6.0+11769913"
@@ -2285,6 +2453,18 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
+[[package]]
+name = "nix"
+version = "0.32.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77730ed34f01f4990cb2ea67fec715ecebc6fab9a6396cf83c5529b13f581bdc"
+dependencies = [
+ "bitflags 2.13.2",
+ "cfg-if",
+ "cfg_aliases",
+ "libc",
+]
+
[[package]]
name = "num-conv"
version = "0.2.2"
@@ -2343,6 +2523,7 @@ dependencies = [
"objc2",
"objc2-core-foundation",
"objc2-foundation",
+ "objc2-quartz-core",
]
[[package]]
@@ -2445,6 +2626,7 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
dependencies = [
"bitflags 2.13.2",
"block2",
+ "libc",
"objc2",
"objc2-core-foundation",
]
@@ -2460,6 +2642,18 @@ dependencies = [
"objc2-core-foundation",
]
+[[package]]
+name = "objc2-osa-kit"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-app-kit",
+ "objc2-foundation",
+]
+
[[package]]
name = "objc2-quartz-core"
version = "0.3.2"
@@ -2534,6 +2728,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "openssl-probe"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1"
+
[[package]]
name = "option-ext"
version = "0.2.0"
@@ -2550,6 +2750,20 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "osakit"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"
+dependencies = [
+ "objc2",
+ "objc2-foundation",
+ "objc2-osa-kit",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.21",
+]
+
[[package]]
name = "pango"
version = "0.18.3"
@@ -2616,8 +2830,19 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
dependencies = [
- "phf_macros",
- "phf_shared",
+ "phf_macros 0.13.1",
+ "phf_shared 0.13.1",
+ "serde",
+]
+
+[[package]]
+name = "phf"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6"
+dependencies = [
+ "phf_macros 0.14.0",
+ "phf_shared 0.14.0",
"serde",
]
@@ -2627,8 +2852,18 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"
dependencies = [
- "phf_generator",
- "phf_shared",
+ "phf_generator 0.13.1",
+ "phf_shared 0.13.1",
+]
+
+[[package]]
+name = "phf_codegen"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41b585a510fb76fdebead6897982ef2a03a21d8e6cbcca904999742a4afc6ffe"
+dependencies = [
+ "phf_generator 0.14.0",
+ "phf_shared 0.14.0",
]
[[package]]
@@ -2638,7 +2873,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
dependencies = [
"fastrand",
- "phf_shared",
+ "phf_shared 0.13.1",
+]
+
+[[package]]
+name = "phf_generator"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100"
+dependencies = [
+ "fastrand",
+ "phf_shared 0.14.0",
]
[[package]]
@@ -2647,8 +2892,21 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef"
dependencies = [
- "phf_generator",
- "phf_shared",
+ "phf_generator 0.13.1",
+ "phf_shared 0.13.1",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "phf_macros"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085"
+dependencies = [
+ "phf_generator 0.14.0",
+ "phf_shared 0.14.0",
"proc-macro2",
"quote",
"syn 2.0.119",
@@ -2663,6 +2921,15 @@ dependencies = [
"siphasher",
]
+[[package]]
+name = "phf_shared"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89"
+dependencies = [
+ "siphasher",
+]
+
[[package]]
name = "pin-project-lite"
version = "0.2.17"
@@ -2701,22 +2968,9 @@ dependencies = [
[[package]]
name = "png"
-version = "0.17.16"
+version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"
-dependencies = [
- "bitflags 1.3.2",
- "crc32fast",
- "fdeflate",
- "flate2",
- "miniz_oxide 0.8.9",
-]
-
-[[package]]
-name = "png"
-version = "0.18.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
+checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
dependencies = [
"bitflags 2.13.2",
"crc32fast",
@@ -2994,15 +3248,20 @@ dependencies = [
"http-body",
"http-body-util",
"hyper",
+ "hyper-rustls",
"hyper-util",
"js-sys",
"log",
"percent-encoding",
"pin-project-lite",
+ "rustls",
+ "rustls-pki-types",
+ "rustls-platform-verifier",
"serde",
"serde_json",
"sync_wrapper",
"tokio",
+ "tokio-rustls",
"tokio-util",
"tower",
"tower-http 0.6.11",
@@ -3014,6 +3273,20 @@ dependencies = [
"web-sys",
]
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom 0.2.17",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
[[package]]
name = "rust-embed"
version = "8.12.0"
@@ -3077,6 +3350,79 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "rustls"
+version = "0.23.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
+dependencies = [
+ "once_cell",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-native-certs"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4"
+dependencies = [
+ "openssl-probe",
+ "rustls-pki-types",
+ "schannel",
+ "security-framework",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb"
+dependencies = [
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-platform-verifier"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98"
+dependencies = [
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "jni 0.22.4",
+ "log",
+ "once_cell",
+ "rustls",
+ "rustls-native-certs",
+ "rustls-platform-verifier-android",
+ "rustls-webpki",
+ "security-framework",
+ "security-framework-sys",
+ "webpki-root-certs",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustls-platform-verifier-android"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f"
+
+[[package]]
+name = "rustls-webpki"
+version = "0.103.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
[[package]]
name = "rustversion"
version = "1.0.23"
@@ -3098,6 +3444,15 @@ dependencies = [
"winapi-util",
]
+[[package]]
+name = "schannel"
+version = "0.1.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "schemars"
version = "0.8.22"
@@ -3155,22 +3510,62 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+[[package]]
+name = "security-framework"
+version = "3.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
+dependencies = [
+ "bitflags 2.13.2",
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "libc",
+ "security-framework-sys",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "selectors"
-version = "0.36.1"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c"
+checksum = "8adfa1c298912827b8a28b223b3b874357397ae706e6190acd9bf28cee99114d"
dependencies = [
"bitflags 2.13.2",
- "cssparser",
+ "cssparser 0.37.0",
"derive_more",
"log",
"new_debug_unreachable",
- "phf",
- "phf_codegen",
+ "phf 0.13.1",
+ "phf_codegen 0.13.1",
"precomputed-hash",
"rustc-hash",
- "servo_arc",
+ "servo_arc 0.4.3",
+ "smallvec",
+]
+
+[[package]]
+name = "selectors"
+version = "0.41.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8322aebea94a6cc288ff884e8a49bdbceef60206c400c6c46d22e62fc4fd91a6"
+dependencies = [
+ "bitflags 2.13.2",
+ "cssparser 0.38.0",
+ "derive_more",
+ "log",
+ "new_debug_unreachable",
+ "precomputed-hash",
+ "rustc-hash",
+ "servo_arc 0.5.0",
"smallvec",
]
@@ -3366,6 +3761,15 @@ dependencies = [
"stable_deref_trait",
]
+[[package]]
+name = "servo_arc"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4eceb519ec34d8290aaf6e46f435102f2bfa63f22b05a144fb16ab266d3b198"
+dependencies = [
+ "stable_deref_trait",
+]
+
[[package]]
name = "sha1"
version = "0.10.7"
@@ -3421,6 +3825,22 @@ version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
+[[package]]
+name = "simd_cesu8"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520"
+dependencies = [
+ "rustc_version",
+ "simdutf8",
+]
+
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
[[package]]
name = "siphasher"
version = "1.0.3"
@@ -3503,6 +3923,12 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
+[[package]]
+name = "static_vcruntime"
+version = "3.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7"
+
[[package]]
name = "string_cache"
version = "0.9.0"
@@ -3511,7 +3937,19 @@ checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901"
dependencies = [
"new_debug_unreachable",
"parking_lot",
- "phf_shared",
+ "phf_shared 0.13.1",
+ "precomputed-hash",
+]
+
+[[package]]
+name = "string_cache"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ffa8a5dbe8b3f0bbe29d4c3225daafaeead63afdc1b65fc4c01a1384166038e6"
+dependencies = [
+ "new_debug_unreachable",
+ "parking_lot",
+ "phf_shared 0.14.0",
"precomputed-hash",
]
@@ -3521,8 +3959,20 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69"
dependencies = [
- "phf_generator",
- "phf_shared",
+ "phf_generator 0.13.1",
+ "phf_shared 0.13.1",
+ "proc-macro2",
+ "quote",
+]
+
+[[package]]
+name = "string_cache_codegen"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "928dcdf75e47626b3617a976ec205d9f057584c371c1f23b782129268d0e6edc"
+dependencies = [
+ "phf_generator 0.14.0",
+ "phf_shared 0.14.0",
"proc-macro2",
"quote",
]
@@ -3533,11 +3983,17 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
[[package]]
name = "swift-rs"
-version = "1.0.8"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e45c444e496845d3f2a351146bff59aae4975b2280238df1dfaa0c7d1846f38e"
+checksum = "cefd87076fd385308ee4aff597256c902f1fbb4d031de1558efc12f8ffefadd9"
dependencies = [
"base64 0.21.7",
"serde",
@@ -3596,6 +4052,27 @@ dependencies = [
"syn 3.0.6",
]
+[[package]]
+name = "system-configuration"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
+dependencies = [
+ "bitflags 2.13.2",
+ "core-foundation 0.9.4",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "system-deps"
version = "6.2.2"
@@ -3611,13 +4088,13 @@ dependencies = [
[[package]]
name = "tao"
-version = "0.35.3"
+version = "0.37.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d1c93047acf68669466a34690ac58cca7010bd1b201e1ec86f1fd0a75d3dd4a9"
+checksum = "02ca9c0ce2a2fd70dc4ef4449ca5e8d30e6fa0db111cd8008594602a06a68371"
dependencies = [
"bitflags 2.13.2",
"block2",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-graphics",
"crossbeam-channel",
"dbus",
@@ -3627,24 +4104,24 @@ dependencies = [
"gdkwayland-sys",
"gdkx11-sys",
"gtk",
- "jni",
+ "jni 0.21.1",
"libc",
"log",
"ndk",
+ "ndk-context",
"ndk-sys",
"objc2",
"objc2-app-kit",
"objc2-foundation",
"objc2-ui-kit",
- "once_cell",
"parking_lot",
"percent-encoding",
"raw-window-handle",
"tao-macros",
"unicode-segmentation",
"url",
- "windows",
- "windows-core 0.61.2",
+ "windows 0.62.2",
+ "windows-core 0.62.2",
"windows-version",
"x11-dl",
]
@@ -3660,6 +4137,17 @@ dependencies = [
"syn 2.0.119",
]
+[[package]]
+name = "tar"
+version = "0.4.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
+dependencies = [
+ "filetime",
+ "libc",
+ "xattr",
+]
+
[[package]]
name = "target-lexicon"
version = "0.12.16"
@@ -3668,9 +4156,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]]
name = "tauri"
-version = "2.11.6"
+version = "2.12.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fa5bacdb9bbad5954af3d1bd6cf6ae9192cab1b2e270f4a07f904610b9e85f4"
+checksum = "30fbfbb9dc9a2697b0e96d909ddc295fb18d2d82a58ed542ab8d9eba2edbe6da"
dependencies = [
"anyhow",
"bytes",
@@ -3683,7 +4171,7 @@ dependencies = [
"gtk",
"heck 0.5.0",
"http",
- "jni",
+ "jni 0.21.1",
"libc",
"log",
"mime",
@@ -3714,35 +4202,14 @@ dependencies = [
"webkit2gtk",
"webview2-com",
"window-vibrancy",
- "windows",
-]
-
-[[package]]
-name = "tauri-app"
-version = "0.1.0"
-dependencies = [
- "axum",
- "futures-util",
- "getrandom 0.2.17",
- "hex",
- "lz4_flex",
- "mime_guess",
- "rust-embed",
- "serde",
- "serde_json",
- "sha2 0.10.9",
- "tauri",
- "tauri-build",
- "tauri-plugin-opener",
- "tokio",
- "tower-http 0.5.2",
+ "windows 0.62.2",
]
[[package]]
name = "tauri-build"
-version = "2.6.3"
+version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc9ce40b16101cb6ea63d3e221567affd1c3a9205f95d7bc574941a10636b632"
+checksum = "73d80784e874fa117b9b00a6680cf2f9b8a51bbd14406bea980cf8f328b00646"
dependencies = [
"anyhow",
"cargo_toml",
@@ -3754,6 +4221,8 @@ dependencies = [
"semver",
"serde",
"serde_json",
+ "static_vcruntime",
+ "strsim",
"tauri-utils",
"tauri-winres",
"walkdir",
@@ -3761,22 +4230,22 @@ dependencies = [
[[package]]
name = "tauri-codegen"
-version = "2.6.3"
+version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08279169ff42f8fc45a1dbc9dcae888893ba95288142e5880c59b93a26d2cfc5"
+checksum = "c5dc6caab4da5646f57648f39b794bae118f0dd4a4305eeb8c892966171f4852"
dependencies = [
- "base64 0.22.1",
+ "base64 0.23.1",
"brotli",
"ico",
"json-patch",
"plist",
- "png 0.17.16",
+ "png",
"proc-macro2",
"quote",
"semver",
"serde",
"serde_json",
- "sha2 0.10.9",
+ "sha2 0.11.0",
"syn 2.0.119",
"tauri-utils",
"thiserror 2.0.21",
@@ -3788,9 +4257,9 @@ dependencies = [
[[package]]
name = "tauri-macros"
-version = "2.6.3"
+version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8b394794f399a421811d06966343e7933fcae92d59f5180b9388d1174497a45"
+checksum = "2831c5da8603a96b1efc0b650c2cb6decc69b6cda257d815fe70c7f5be53818e"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -3802,9 +4271,9 @@ dependencies = [
[[package]]
name = "tauri-plugin"
-version = "2.6.3"
+version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74be5dd4bed9afbd145e5716b5fa2ec28cbc29c34ffa61c258c9273d896c8020"
+checksum = "6c18076d9b04211cb4899387aab97497e8edd0d02cd21710623afcdde27145d1"
dependencies = [
"anyhow",
"glob",
@@ -3834,21 +4303,65 @@ dependencies = [
"tauri-plugin",
"thiserror 2.0.21",
"url",
- "windows",
+ "windows 0.61.3",
"zbus",
]
+[[package]]
+name = "tauri-plugin-process"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74ae3d8549ae564c0397377373e262f340908eb23a5b9fbe03f2a00007dc0038"
+dependencies = [
+ "tauri",
+ "tauri-plugin",
+]
+
+[[package]]
+name = "tauri-plugin-updater"
+version = "2.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d957abbcb3f9f6c76d22a3a0f012f30880640d0bccb5634d2b12a9937e4c872b"
+dependencies = [
+ "base64 0.23.1",
+ "dirs",
+ "flate2",
+ "futures-util",
+ "http",
+ "infer",
+ "libc",
+ "log",
+ "minisign-verify",
+ "osakit",
+ "percent-encoding",
+ "reqwest",
+ "rustls",
+ "semver",
+ "serde",
+ "serde_json",
+ "tar",
+ "tauri",
+ "tauri-plugin",
+ "tempfile",
+ "thiserror 2.0.21",
+ "time",
+ "tokio",
+ "url",
+ "windows-sys 0.61.2",
+ "zip",
+]
+
[[package]]
name = "tauri-runtime"
-version = "2.11.3"
+version = "2.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0b4bc95aed361b0019067d189a1174a603d460d0f6c72606512d59fc9c12ec8"
+checksum = "60c2b14bd5265b63993cdc34ad526fb836e0fd0cf64a4634a895db0784844d5e"
dependencies = [
"cookie",
"dpi",
"gtk",
"http",
- "jni",
+ "jni 0.21.1",
"objc2",
"objc2-ui-kit",
"objc2-web-kit",
@@ -3860,22 +4373,21 @@ dependencies = [
"url",
"webkit2gtk",
"webview2-com",
- "windows",
+ "windows 0.62.2",
]
[[package]]
name = "tauri-runtime-wry"
-version = "2.11.4"
+version = "2.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e6fac707727b7a2f48e4ded90976324267371073edbb415ffb73bb0458d203f"
+checksum = "b8c14a025255cc9816d401635035075b09b6cc9973b7b8fd7b8fcb8753f30f92"
dependencies = [
"gtk",
"http",
- "jni",
+ "jni 0.21.1",
"log",
"objc2",
"objc2-app-kit",
- "once_cell",
"percent-encoding",
"raw-window-handle",
"softbuffer",
@@ -3885,21 +4397,21 @@ dependencies = [
"url",
"webkit2gtk",
"webview2-com",
- "windows",
+ "windows 0.62.2",
"wry",
]
[[package]]
name = "tauri-utils"
-version = "2.9.3"
+version = "2.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e176a18e67764923c4f1ce66f25ae4abe5f688384d5eb1a0fa6c77f3d90f887"
+checksum = "28d1d33d4453c5df0bf1672dbc7ada69d8ed74f56a4316d964a4aa73d4ecd3ad"
dependencies = [
"anyhow",
"brotli",
"cargo_metadata",
"ctor",
- "dom_query",
+ "dom_query 0.28.0",
"dunce",
"glob",
"http",
@@ -3907,7 +4419,7 @@ dependencies = [
"json-patch",
"log",
"memchr",
- "phf",
+ "phf 0.13.1",
"plist",
"proc-macro2",
"quote",
@@ -4074,6 +4586,16 @@ dependencies = [
"syn 3.0.6",
]
+[[package]]
+name = "tokio-rustls"
+version = "0.26.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db"
+dependencies = [
+ "rustls",
+ "tokio",
+]
+
[[package]]
name = "tokio-tungstenite"
version = "0.24.0"
@@ -4111,21 +4633,6 @@ dependencies = [
"toml_edit 0.20.2",
]
-[[package]]
-name = "toml"
-version = "0.9.12+spec-1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"
-dependencies = [
- "indexmap 2.14.2",
- "serde_core",
- "serde_spanned 1.1.1",
- "toml_datetime 0.7.5+spec-1.1.0",
- "toml_parser",
- "toml_writer",
- "winnow 0.7.15",
-]
-
[[package]]
name = "toml"
version = "1.1.6+spec-1.1.0"
@@ -4150,15 +4657,6 @@ dependencies = [
"serde",
]
-[[package]]
-name = "toml_datetime"
-version = "0.7.5+spec-1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
-dependencies = [
- "serde_core",
-]
-
[[package]]
name = "toml_datetime"
version = "1.1.1+spec-1.1.0"
@@ -4324,9 +4822,9 @@ dependencies = [
[[package]]
name = "tray-icon"
-version = "0.24.2"
+version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "045979e3f037cd18ad1cb2a419dfda133c5c29c9f3453370079f2255d46c257e"
+checksum = "b2b9c52859a94554803ccd4a24b98f74148ebc73b90676d783f3490b1bff9d72"
dependencies = [
"crossbeam-channel",
"dirs",
@@ -4338,7 +4836,7 @@ dependencies = [
"objc2-core-graphics",
"objc2-foundation",
"once_cell",
- "png 0.18.1",
+ "png",
"serde",
"thiserror 2.0.21",
"windows-sys 0.61.2",
@@ -4374,6 +4872,12 @@ version = "2.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86a801b3cea342a06d468c8710662aa29e5e05e4f5c0d62f00bbb7f2ad7941c2"
+[[package]]
+name = "typed-path"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e"
+
[[package]]
name = "typeid"
version = "1.0.3"
@@ -4397,47 +4901,6 @@ dependencies = [
"windows-sys 0.61.2",
]
-[[package]]
-name = "unic-char-property"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221"
-dependencies = [
- "unic-char-range",
-]
-
-[[package]]
-name = "unic-char-range"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc"
-
-[[package]]
-name = "unic-common"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc"
-
-[[package]]
-name = "unic-ucd-ident"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987"
-dependencies = [
- "unic-char-property",
- "unic-char-range",
- "unic-ucd-version",
-]
-
-[[package]]
-name = "unic-ucd-version"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4"
-dependencies = [
- "unic-common",
-]
-
[[package]]
name = "unicase"
version = "2.9.0"
@@ -4456,6 +4919,12 @@ version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
[[package]]
name = "url"
version = "2.5.8"
@@ -4471,13 +4940,13 @@ dependencies = [
[[package]]
name = "urlpattern"
-version = "0.3.0"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d"
+checksum = "df16f50ef4cc145211879a3867ba757076b25dfee812040dcb0658bd9ae7904b"
dependencies = [
+ "icu_properties",
"regex",
"serde",
- "unic-ucd-ident",
"url",
]
@@ -4649,16 +5118,38 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "web-time"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
[[package]]
name = "web_atoms"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba8b815c1b593dc0baf78dd0f4fc8fdb2de53198fb1163738093e9a311c33fb3"
dependencies = [
- "phf",
- "phf_codegen",
- "string_cache",
- "string_cache_codegen",
+ "phf 0.13.1",
+ "phf_codegen 0.13.1",
+ "string_cache 0.9.0",
+ "string_cache_codegen 0.6.1",
+]
+
+[[package]]
+name = "web_atoms"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7572660c8890448ba236b7376f27e389c6a7e1c70195622faced601f855c0ada"
+dependencies = [
+ "phf 0.14.0",
+ "phf_codegen 0.14.0",
+ "string_cache 0.11.0",
+ "string_cache_codegen 0.11.2",
]
[[package]]
@@ -4705,18 +5196,25 @@ dependencies = [
"system-deps",
]
+[[package]]
+name = "webpki-root-certs"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "293198dcebfb821155b5092ab94b5a82ff180eddd7241df3bd6e66a4ffd1a585"
+dependencies = [
+ "rustls-pki-types",
+]
+
[[package]]
name = "webview2-com"
-version = "0.38.2"
+version = "0.39.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a"
+checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6"
dependencies = [
"webview2-com-macros",
"webview2-com-sys",
- "windows",
- "windows-core 0.61.2",
- "windows-implement",
- "windows-interface",
+ "windows 0.62.2",
+ "windows-core 0.62.2",
]
[[package]]
@@ -4732,13 +5230,13 @@ dependencies = [
[[package]]
name = "webview2-com-sys"
-version = "0.38.2"
+version = "0.39.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c"
+checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb"
dependencies = [
"thiserror 2.0.21",
- "windows",
- "windows-core 0.61.2",
+ "windows 0.62.2",
+ "windows-core 0.62.2",
]
[[package]]
@@ -4774,16 +5272,17 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "window-vibrancy"
-version = "0.6.0"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9bec5a31f3f9362f2258fd0e9c9dd61a9ca432e7306cc78c444258f0dce9a9c"
+checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580"
dependencies = [
"objc2",
"objc2-app-kit",
"objc2-core-foundation",
"objc2-foundation",
+ "objc2-quartz-core",
"raw-window-handle",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
"windows-version",
]
@@ -4793,11 +5292,23 @@ version = "0.61.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
dependencies = [
- "windows-collections",
+ "windows-collections 0.2.0",
"windows-core 0.61.2",
- "windows-future",
+ "windows-future 0.2.1",
"windows-link 0.1.3",
- "windows-numerics",
+ "windows-numerics 0.2.0",
+]
+
+[[package]]
+name = "windows"
+version = "0.62.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
+dependencies = [
+ "windows-collections 0.3.2",
+ "windows-core 0.62.2",
+ "windows-future 0.3.2",
+ "windows-numerics 0.3.1",
]
[[package]]
@@ -4809,6 +5320,15 @@ dependencies = [
"windows-core 0.61.2",
]
+[[package]]
+name = "windows-collections"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
+dependencies = [
+ "windows-core 0.62.2",
+]
+
[[package]]
name = "windows-core"
version = "0.61.2"
@@ -4843,7 +5363,18 @@ checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
dependencies = [
"windows-core 0.61.2",
"windows-link 0.1.3",
- "windows-threading",
+ "windows-threading 0.1.0",
+]
+
+[[package]]
+name = "windows-future"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
+dependencies = [
+ "windows-core 0.62.2",
+ "windows-link 0.2.1",
+ "windows-threading 0.2.1",
]
[[package]]
@@ -4890,6 +5421,27 @@ dependencies = [
"windows-link 0.1.3",
]
+[[package]]
+name = "windows-numerics"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
+dependencies = [
+ "windows-core 0.62.2",
+ "windows-link 0.2.1",
+]
+
+[[package]]
+name = "windows-registry"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
+dependencies = [
+ "windows-link 0.2.1",
+ "windows-result 0.4.1",
+ "windows-strings 0.5.1",
+]
+
[[package]]
name = "windows-result"
version = "0.3.4"
@@ -4935,6 +5487,15 @@ dependencies = [
"windows-targets 0.42.2",
]
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-sys"
version = "0.59.0"
@@ -4993,6 +5554,15 @@ dependencies = [
"windows-link 0.1.3",
]
+[[package]]
+name = "windows-threading"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
+dependencies = [
+ "windows-link 0.2.1",
+]
+
[[package]]
name = "windows-version"
version = "0.1.7"
@@ -5101,12 +5671,6 @@ dependencies = [
"memchr",
]
-[[package]]
-name = "winnow"
-version = "0.7.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
-
[[package]]
name = "winnow"
version = "1.0.4"
@@ -5140,23 +5704,23 @@ checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
[[package]]
name = "wry"
-version = "0.55.1"
+version = "0.57.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "186f9871daa55fd9c016578b810d149de58367113db7fb72b462d2323ce19514"
+checksum = "ceb43f824178e8110e3181bfd478359c43b041452a9560d321bd8d121e468f86"
dependencies = [
- "base64 0.22.1",
+ "base64 0.23.1",
"block2",
"cookie",
"crossbeam-channel",
"dirs",
- "dom_query",
+ "dom_query 0.29.0",
"dpi",
"dunce",
"gdkx11",
"gtk",
"http",
"javascriptcore-rs",
- "jni",
+ "jni 0.21.1",
"libc",
"ndk",
"objc2",
@@ -5165,7 +5729,6 @@ dependencies = [
"objc2-foundation",
"objc2-ui-kit",
"objc2-web-kit",
- "once_cell",
"percent-encoding",
"raw-window-handle",
"sha2 0.10.9",
@@ -5176,8 +5739,8 @@ dependencies = [
"webkit2gtk",
"webkit2gtk-sys",
"webview2-com",
- "windows",
- "windows-core 0.61.2",
+ "windows 0.62.2",
+ "windows-core 0.62.2",
"windows-version",
"x11-dl",
]
@@ -5203,6 +5766,16 @@ dependencies = [
"pkg-config",
]
+[[package]]
+name = "xattr"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"
+dependencies = [
+ "libc",
+ "rustix",
+]
+
[[package]]
name = "yoke"
version = "0.8.3"
@@ -5337,6 +5910,26 @@ dependencies = [
"synstructure",
]
+[[package]]
+name = "zeroize"
+version = "1.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa"
+dependencies = [
+ "zeroize_derive",
+]
+
+[[package]]
+name = "zeroize_derive"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
[[package]]
name = "zerotrie"
version = "0.2.5"
@@ -5370,6 +5963,24 @@ dependencies = [
"syn 3.0.6",
]
+[[package]]
+name = "zip"
+version = "9.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9534624d547e3f516ecde0ed9a70d37788f01d340efcfdd03bf3ea8e163c1d0"
+dependencies = [
+ "constant_time_eq",
+ "crc32fast",
+ "getrandom 0.4.3",
+ "indexmap 2.14.2",
+ "libc",
+ "memchr",
+ "nix",
+ "typed-path",
+ "windows-sys 0.61.2",
+ "zeroize",
+]
+
[[package]]
name = "zlib-rs"
version = "0.6.8"
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index f4edb73..e43be0b 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,8 +1,9 @@
[package]
-name = "tauri-app"
-version = "0.1.0"
-description = "A Tauri App"
-authors = ["you"]
+name = "ink-studio"
+version = "1.0.0"
+description = "Collaborative Drawing Studio"
+authors = ["Sora"]
+license = "GPL-3.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -20,6 +21,7 @@ tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2", features = [] }
tauri-plugin-opener = "2"
+tauri-plugin-process = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["full"] }
@@ -33,6 +35,9 @@ getrandom = "0.2"
sha2 = "0.10"
hex = "0.4"
+[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
+tauri-plugin-updater = "2"
+
# Read the optimization guideline for more details: https://tauri.app/concept/size/#cargo-configuration
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json
index 2eb74d9..909b6f6 100644
--- a/src-tauri/capabilities/default.json
+++ b/src-tauri/capabilities/default.json
@@ -6,6 +6,8 @@
"permissions": [
"core:default",
"opener:default",
+ "updater:default",
+ "process:allow-restart",
"core:window:allow-close",
"core:window:allow-minimize",
"core:window:allow-toggle-maximize",
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index d5169fb..c2ae079 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -5,7 +5,8 @@ mod timelapse;
use server::{
download_cloudflared as server_download_cloudflared, get_local_ip, get_server_status,
- start_embedded_server, stop_embedded_server, ServerInfo,
+ is_cloudflared_installed as server_is_cloudflared_installed, start_embedded_server,
+ stop_embedded_server, ServerInfo,
};
use std::collections::HashSet;
use std::path::{Path, PathBuf};
@@ -42,6 +43,30 @@ async fn download_cloudflared() -> Result<String, String> {
server_download_cloudflared().await
}
+#[tauri::command]
+async fn is_cloudflared_installed() -> bool {
+ server_is_cloudflared_installed().await
+}
+
+#[tauri::command]
+fn get_os_username() -> String {
+ let raw = std::env::var("USERNAME")
+ .or_else(|_| std::env::var("USER"))
+ .or_else(|_| std::env::var("LOGNAME"))
+ .unwrap_or_default();
+ let cleaned: String = raw
+ .trim()
+ .chars()
+ .filter(|c| !c.is_control())
+ .take(40)
+ .collect();
+ if cleaned.is_empty() {
+ "Artist".to_string()
+ } else {
+ cleaned
+ }
+}
+
#[tauri::command]
fn get_local_lan_ip() -> String {
get_local_ip()
@@ -504,6 +529,13 @@ pub fn run() {
let app = tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
+ .plugin(tauri_plugin_process::init())
+ .setup(|app| {
+ #[cfg(desktop)]
+ app.handle()
+ .plugin(tauri_plugin_updater::Builder::new().build())?;
+ Ok(())
+ })
.on_window_event(|_window, event| {
if let tauri::WindowEvent::DragDrop(tauri::DragDropEvent::Drop { paths, .. }) = event {
for p in paths {
@@ -516,6 +548,8 @@ pub fn run() {
stop_collab_server,
get_collab_server_status,
download_cloudflared,
+ is_cloudflared_installed,
+ get_os_username,
get_local_lan_ip,
save_undo_tile_cache,
load_undo_tile_cache,
diff --git a/src-tauri/src/server.rs b/src-tauri/src/server.rs
index ed3713b..88bf169 100644
--- a/src-tauri/src/server.rs
+++ b/src-tauri/src/server.rs
@@ -29,9 +29,10 @@ use tower_http::cors::{AllowOrigin, CorsLayer};
#[cfg(windows)]
const CREATE_NO_WINDOW: u32 = 0x08000000;
-const CLIENT_CHANNEL_CAPACITY: usize = 256;
+const CLIENT_CHANNEL_CAPACITY: usize = 2048;
const MAX_WS_MESSAGE_BYTES: usize = 8 * 1024 * 1024; // 8 MB
const MAX_CONCURRENT_CLIENTS: usize = 16;
+const WS_PING_INTERVAL_SECS: u64 = 25;
// Per-client message and bandwidth token bucket limits.
// Burst headroom accommodates progressive tile streaming on room join.
@@ -180,7 +181,13 @@ fn is_valid_port_suffix(rest: &str) -> bool {
&& port_str.parse::<u16>().is_ok()
}
-fn is_allowed_origin(origin: &str, local_ip: &str, port: u16, tunnel_origin: Option<&str>) -> bool {
+fn is_allowed_origin(
+ origin: &str,
+ local_ip: &str,
+ port: u16,
+ tunnel_origin: Option<&str>,
+ host_header: Option<&str>,
+) -> bool {
if origin.is_empty() || origin.eq_ignore_ascii_case("null") {
return false;
}
@@ -212,6 +219,24 @@ fn is_allowed_origin(origin: &str, local_ip: &str, port: u16, tunnel_origin: Opt
return true;
}
}
+ // Same-origin check against Host header (supports multi-NIC LAN / Tailscale IPs
+ // while still blocking cross-site WebSocket hijacking from external domains).
+ if let Some(host) = host_header {
+ let trimmed_host = host.trim();
+ if !trimmed_host.is_empty()
+ && !trimmed_host.contains('/')
+ && !trimmed_host.contains('@')
+ {
+ if let Some(origin_host) = origin
+ .strip_prefix("http://")
+ .or_else(|| origin.strip_prefix("https://"))
+ {
+ if origin_host.eq_ignore_ascii_case(trimmed_host) {
+ return true;
+ }
+ }
+ }
+ }
false
}
@@ -426,13 +451,27 @@ fn extract_trycloudflare_url(line: &str) -> Option<String> {
None
}
+pub async fn is_cloudflared_installed() -> bool {
+ locate_cloudflared().await.is_ok()
+}
+
+async fn ensure_cloudflared() -> Result<PathBuf, String> {
+ if let Ok(path) = locate_cloudflared().await {
+ return Ok(path);
+ }
+ let installed = download_cloudflared().await?;
+ Ok(PathBuf::from(installed))
+}
+
async fn start_cloudflare_tunnel(port: u16) -> Result<(tokio::process::Child, String), String> {
- let exe_path = locate_cloudflared().await?;
+ let exe_path = ensure_cloudflared().await?;
let mut cmd = tokio::process::Command::new(exe_path);
cmd.args([
"tunnel",
"--url",
&format!("http://127.0.0.1:{}", port),
+ "--protocol",
+ "http2",
"--no-autoupdate",
])
.stdout(Stdio::null())
@@ -452,21 +491,67 @@ async fn start_cloudflare_tunnel(port: u16) -> Result<(tokio::process::Child, St
.ok_or_else(|| "Could not capture cloudflared stderr".to_string())?;
let mut reader = BufReader::new(stderr).lines();
+ let mut found_url: Option<String> = None;
+ let mut last_error_line: Option<String> = None;
+
+ let overall_deadline = tokio::time::Instant::now() + tokio::time::Duration::from_secs(30);
+ let mut post_url_deadline: Option<tokio::time::Instant> = None;
+
+ loop {
+ let active_deadline = match post_url_deadline {
+ Some(d) => d.min(overall_deadline),
+ None => overall_deadline,
+ };
+
+ let next = tokio::select! {
+ line = reader.next_line() => Some(line),
+ _ = tokio::time::sleep_until(active_deadline) => None,
+ };
- let tunnel_url = tokio::select! {
- url = async {
- while let Ok(Some(line)) = reader.next_line().await {
- if let Some(url) = extract_trycloudflare_url(&line) {
- return Some(url);
+ match next {
+ Some(Ok(Some(line))) => {
+ if found_url.is_none() {
+ if let Some(url) = extract_trycloudflare_url(&line) {
+ found_url = Some(url);
+ // Wait briefly for Cloudflare edge registration so the link works immediately
+ post_url_deadline =
+ Some(tokio::time::Instant::now() + tokio::time::Duration::from_secs(8));
+ }
+ }
+ let lower = line.to_ascii_lowercase();
+ if lower.contains("err") || lower.contains("failed") || lower.contains("unable") {
+ last_error_line = Some(line.trim().chars().take(180).collect());
+ }
+ if found_url.is_some()
+ && (line.contains("Registered tunnel connection")
+ || lower.contains("connection registered"))
+ {
+ break;
}
}
- None
- } => url,
- _ = tokio::time::sleep(tokio::time::Duration::from_secs(18)) => None,
- };
+ Some(Ok(None)) | Some(Err(_)) => {
+ // Process closed stderr / exited
+ break;
+ }
+ None => {
+ // Deadline reached
+ break;
+ }
+ }
+ }
- match tunnel_url {
+ match found_url {
Some(url) => {
+ // Confirm process is still alive
+ if let Ok(Some(exit_status)) = child.try_wait() {
+ let detail = last_error_line
+ .map(|l| format!(" ({})", l))
+ .unwrap_or_default();
+ return Err(format!(
+ "Cloudflare tunnel exited unexpectedly ({}){}",
+ exit_status, detail
+ ));
+ }
// Keep draining stderr in the background so cloudflared never receives EPIPE
tokio::spawn(async move {
while let Ok(Some(_)) = reader.next_line().await {}
@@ -475,7 +560,13 @@ async fn start_cloudflare_tunnel(port: u16) -> Result<(tokio::process::Child, St
}
None => {
let _ = child.kill().await;
- Err("Timed out waiting for Cloudflare tunnel URL".to_string())
+ let detail = last_error_line
+ .map(|l| format!(": {}", l))
+ .unwrap_or_default();
+ Err(format!(
+ "Could not establish Cloudflare tunnel URL{}",
+ detail
+ ))
}
}
}
@@ -486,12 +577,19 @@ fn build_router(state: AppState) -> Router {
let cors_tunnel_origin = Arc::clone(&state.tunnel_origin);
let cors = CorsLayer::new()
- .allow_origin(AllowOrigin::predicate(move |origin: &HeaderValue, _| {
+ .allow_origin(AllowOrigin::predicate(move |origin: &HeaderValue, req| {
let Ok(origin_str) = origin.to_str() else {
return false;
};
+ let host_str = req.headers.get(header::HOST).and_then(|v| v.to_str().ok());
let tunnel = cors_tunnel_origin.read().ok().and_then(|g| g.clone());
- is_allowed_origin(origin_str, &cors_local_ip, cors_port, tunnel.as_deref())
+ is_allowed_origin(
+ origin_str,
+ &cors_local_ip,
+ cors_port,
+ tunnel.as_deref(),
+ host_str,
+ )
}))
.allow_methods([Method::GET, Method::OPTIONS])
.allow_headers([header::AUTHORIZATION, header::CONTENT_TYPE]);
@@ -577,10 +675,9 @@ pub async fn start_embedded_server(
is_global = true;
}
Err(err) => {
- eprintln!(
- "[Multiplayer] Cloudflare tunnel notice: {}. Using local network IP.",
- err
- );
+ // Do not silently fall back to an unreachable private LAN IP when Worldwide was requested.
+ let _ = shutdown_tx.send(());
+ return Err(format!("Worldwide tunnel failed: {}", err));
}
}
}
@@ -707,9 +804,16 @@ async fn ws_handler(
// 2. Origin check when Origin header is present (prevents cross-site WebSocket hijacking)
if let Some(origin_val) = headers.get(header::ORIGIN) {
+ let host_str = headers.get(header::HOST).and_then(|v| v.to_str().ok());
let origin_allowed = origin_val.to_str().ok().map_or(false, |origin_str| {
let tunnel = state.tunnel_origin.read().ok().and_then(|g| g.clone());
- is_allowed_origin(origin_str, &state.local_ip, state.port, tunnel.as_deref())
+ is_allowed_origin(
+ origin_str,
+ &state.local_ip,
+ state.port,
+ tunnel.as_deref(),
+ host_str,
+ )
});
if !origin_allowed {
return (StatusCode::FORBIDDEN, "Origin not allowed").into_response();
@@ -758,6 +862,26 @@ async fn broadcast_message(state: &AppState, sender_id: Option<usize>, msg: Mess
}
}
+fn extract_peer_id_from_join(text: &str) -> Option<String> {
+ if !text.contains("JOIN_REQUEST") {
+ return None;
+ }
+ let val: serde_json::Value = serde_json::from_str(text).ok()?;
+ if val.get("type")?.as_str()? != "JOIN_REQUEST" {
+ return None;
+ }
+ let peer_id = val.get("peer")?.get("id")?;
+ let id_str = match peer_id {
+ serde_json::Value::String(s) => s.trim().to_string(),
+ serde_json::Value::Number(n) => n.to_string(),
+ _ => return None,
+ };
+ if id_str.is_empty() || id_str.len() > 128 {
+ return None;
+ }
+ Some(id_str)
+}
+
async fn handle_socket(socket: WebSocket, state: AppState, _permit: OwnedSemaphorePermit) {
let client_id = NEXT_CLIENT_ID.fetch_add(1, Ordering::Relaxed);
let (mut sender, mut receiver) = socket.split();
@@ -799,41 +923,60 @@ async fn handle_socket(socket: WebSocket, state: AppState, _permit: OwnedSemapho
let mut msg_limiter = TokenBucket::new(CLIENT_MSG_BURST, CLIENT_MSG_REFILL_PER_SEC);
let mut byte_limiter = TokenBucket::new(CLIENT_BYTES_BURST, CLIENT_BYTES_REFILL_PER_SEC);
+ let mut known_peer_id: Option<String> = None;
+
+ // Periodic WebSocket Ping keeps Cloudflare Quick Tunnels alive past the 100s idle cutoff
+ let mut ping_interval =
+ tokio::time::interval(tokio::time::Duration::from_secs(WS_PING_INTERVAL_SECS));
+ ping_interval.tick().await;
// Broadcast loop for incoming WebSocket messages from this client
loop {
- let next_item = tokio::select! {
- _ = kick.notified() => None,
- item = receiver.next() => item,
- };
-
- let Some(Ok(msg)) = next_item else {
- break;
- };
-
- match msg {
- Message::Text(text) => {
- let len = text.len();
- if len > MAX_WS_MESSAGE_BYTES
- || !msg_limiter.try_consume(1.0)
- || !byte_limiter.try_consume(len as f64)
- {
+ tokio::select! {
+ _ = kick.notified() => break,
+ _ = ping_interval.tick() => {
+ if tx.try_send(Message::Ping(Vec::new())).is_err() {
break;
}
- broadcast_message(&state, Some(client_id), Message::Text(text)).await;
}
- Message::Binary(bin) => {
- let len = bin.len();
- if len > MAX_WS_MESSAGE_BYTES
- || !msg_limiter.try_consume(1.0)
- || !byte_limiter.try_consume(len as f64)
- {
+ item = receiver.next() => {
+ let Some(Ok(msg)) = item else {
break;
+ };
+
+ match msg {
+ Message::Text(text) => {
+ let len = text.len();
+ if len > MAX_WS_MESSAGE_BYTES
+ || !msg_limiter.try_consume(1.0)
+ || !byte_limiter.try_consume(len as f64)
+ {
+ break;
+ }
+ if known_peer_id.is_none() {
+ if let Some(pid) = extract_peer_id_from_join(&text) {
+ known_peer_id = Some(pid);
+ }
+ }
+ broadcast_message(&state, Some(client_id), Message::Text(text)).await;
+ }
+ Message::Binary(bin) => {
+ let len = bin.len();
+ if len > MAX_WS_MESSAGE_BYTES
+ || !msg_limiter.try_consume(1.0)
+ || !byte_limiter.try_consume(len as f64)
+ {
+ break;
+ }
+ broadcast_message(&state, Some(client_id), Message::Binary(bin)).await;
+ }
+ Message::Ping(payload) => {
+ let _ = tx.try_send(Message::Pong(payload));
+ }
+ Message::Pong(_) => {}
+ Message::Close(_) => break,
}
- broadcast_message(&state, Some(client_id), Message::Binary(bin)).await;
}
- Message::Close(_) => break,
- _ => {}
}
}
@@ -843,11 +986,18 @@ async fn handle_socket(socket: WebSocket, state: AppState, _permit: OwnedSemapho
}
forward_task.abort();
- // Broadcast user left event
- let leave_msg = serde_json::json!({
- "type": "PEER_DISCONNECTED",
- "clientId": client_id,
- });
+ // Broadcast user left event with both peerId and clientId so peers never turn into ghosts
+ let leave_msg = match known_peer_id {
+ Some(pid) => serde_json::json!({
+ "type": "PEER_DISCONNECTED",
+ "peerId": pid,
+ "clientId": client_id,
+ }),
+ None => serde_json::json!({
+ "type": "PEER_DISCONNECTED",
+ "clientId": client_id,
+ }),
+ };
broadcast_message(&state, None, Message::Text(leave_msg.to_string())).await;
}
@@ -888,22 +1038,38 @@ mod tests {
#[test]
fn test_origin_allowlist() {
let tunnel = Some("https://calm-brush.trycloudflare.com");
- assert!(is_allowed_origin("tauri://localhost", "192.168.1.5", 30303, tunnel));
- assert!(is_allowed_origin("http://tauri.localhost", "192.168.1.5", 30303, tunnel));
- assert!(is_allowed_origin("https://tauri.localhost", "192.168.1.5", 30303, tunnel));
- assert!(is_allowed_origin("http://localhost:1420", "192.168.1.5", 30303, tunnel));
- assert!(is_allowed_origin("http://localhost", "192.168.1.5", 30303, tunnel));
- assert!(is_allowed_origin("http://127.0.0.1:30303", "192.168.1.5", 30303, tunnel));
- assert!(is_allowed_origin("http://192.168.1.5:30303", "192.168.1.5", 30303, tunnel));
- assert!(is_allowed_origin("https://calm-brush.trycloudflare.com", "192.168.1.5", 30303, tunnel));
+ assert!(is_allowed_origin("tauri://localhost", "192.168.1.5", 30303, tunnel, None));
+ assert!(is_allowed_origin("http://tauri.localhost", "192.168.1.5", 30303, tunnel, None));
+ assert!(is_allowed_origin("https://tauri.localhost", "192.168.1.5", 30303, tunnel, None));
+ assert!(is_allowed_origin("http://localhost:1420", "192.168.1.5", 30303, tunnel, None));
+ assert!(is_allowed_origin("http://localhost", "192.168.1.5", 30303, tunnel, None));
+ assert!(is_allowed_origin("http://127.0.0.1:30303", "192.168.1.5", 30303, tunnel, None));
+ assert!(is_allowed_origin("http://192.168.1.5:30303", "192.168.1.5", 30303, tunnel, None));
+ assert!(is_allowed_origin("https://calm-brush.trycloudflare.com", "192.168.1.5", 30303, tunnel, None));
+ // Same-origin Host match (e.g. Tailscale / secondary LAN NIC)
+ assert!(is_allowed_origin(
+ "http://100.64.0.9:30303",
+ "192.168.1.5",
+ 30303,
+ tunnel,
+ Some("100.64.0.9:30303")
+ ));
// Disallowed origins
- assert!(!is_allowed_origin("https://evil.com", "192.168.1.5", 30303, tunnel));
- assert!(!is_allowed_origin("http://localhost.evil.com", "192.168.1.5", 30303, tunnel));
- assert!(!is_allowed_origin("http://localhost:1420/path", "192.168.1.5", 30303, tunnel));
- assert!(!is_allowed_origin("http://192.168.1.5:9999", "192.168.1.5", 30303, tunnel));
- assert!(!is_allowed_origin("https://other.trycloudflare.com", "192.168.1.5", 30303, tunnel));
- assert!(!is_allowed_origin("null", "192.168.1.5", 30303, tunnel));
+ assert!(!is_allowed_origin("https://evil.com", "192.168.1.5", 30303, tunnel, Some("192.168.1.5:30303")));
+ assert!(!is_allowed_origin("http://localhost.evil.com", "192.168.1.5", 30303, tunnel, None));
+ assert!(!is_allowed_origin("http://localhost:1420/path", "192.168.1.5", 30303, tunnel, None));
+ assert!(!is_allowed_origin("http://192.168.1.5:9999", "192.168.1.5", 30303, tunnel, Some("192.168.1.5:30303")));
+ assert!(!is_allowed_origin("https://other.trycloudflare.com", "192.168.1.5", 30303, tunnel, Some("calm-brush.trycloudflare.com")));
+ assert!(!is_allowed_origin("null", "192.168.1.5", 30303, tunnel, None));
+ }
+
+ #[test]
+ fn test_extract_peer_id_from_join() {
+ let msg = r##"{"type":"JOIN_REQUEST","peer":{"id":"peer-123-abc","name":"Alex","color":"#fff"}}"##;
+ assert_eq!(extract_peer_id_from_join(msg), Some("peer-123-abc".to_string()));
+ assert_eq!(extract_peer_id_from_join(r#"{"type":"CURSOR_MOVE","peerId":"x"}"#), None);
+ assert_eq!(extract_peer_id_from_join("not json"), None);
}
#[test]
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index f03a443..cad4180 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Ink Studio",
- "version": "0.1.0",
+ "version": "1.0.0",
"identifier": "com.inkstudio.app",
"build": {
"beforeDevCommand": "npm run dev",
@@ -13,7 +13,7 @@
"windows": [
{
"label": "main",
- "title": "Ink Studio - Graphics Editor",
+ "title": "Ink Studio - Collaborative Drawing Studio",
"width": 1280,
"height": 840,
"minWidth": 900,
@@ -28,6 +28,20 @@
"bundle": {
"active": true,
"targets": "all",
+ "createUpdaterArtifacts": true,
+ "publisher": "Sora",
+ "shortDescription": "Collaborative Drawing Studio",
+ "copyright": "Copyright © 2026 Sora",
+ "license": "GPL-3.0",
+ "licenseFile": "../LICENSE",
+ "fileAssociations": [
+ {
+ "ext": ["sora", "ink"],
+ "name": "Ink Studio Project",
+ "description": "Ink Studio Project File",
+ "role": "Editor"
+ }
+ ],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
@@ -35,5 +49,16 @@
"icons/icon.icns",
"icons/icon.ico"
]
+ },
+ "plugins": {
+ "updater": {
+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDBFOUVGREQ3NkIyMDNERTYKUldUbVBTQnIxLzJlRGtHb1BvUWNNcDE4UklUeTByMXUrSjdFb2k1TmR3ZnpSeDhTYzIra3pCVlcK",
+ "endpoints": [
+ "https://github.com/praisesora/inkstudio/releases/latest/download/latest.json"
+ ],
+ "windows": {
+ "installMode": "passive"
+ }
+ }
}
}
diff --git a/src/App.tsx b/src/App.tsx
index c6e11c3..f004034 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -9,9 +9,10 @@ import { screenToCanvas } from './utils/canvasUtils';
import { createDefaultPageFrame } from './utils/frameEngine';
import { AutoAction, AutoActionExecutionContext, executeAutoAction } from './utils/autoActionEngine';
import { globalTimelapseManager } from './utils/timelapseEngine';
-import { globalTileGrid } from './utils/tileEngine';
+import { globalTileGrid, parseTileKey } from './utils/tileEngine';
import { documentStore } from './utils/documentStore';
import { multiplayerService } from './services/multiplayerService';
+import { updaterService } from './services/updaterService';
import { useCanvasDrawing } from './hooks/useCanvasDrawing';
import {
PushHistoryStepFn,
@@ -53,9 +54,14 @@ export function App() {
const animationTimeline = useDocumentStore((s) => s.animationTimeline);
const isWebtoonMode = useUiStore((s) => s.isWebtoonMode);
+ // Delayed silent startup check for desktop Tauri updates (never blocks startup or crash recovery)
+ useEffect(() => {
+ return updaterService.scheduleStartupUpdateCheck(4500);
+ }, []);
+
const draftCanvasRef = useRef<HTMLCanvasElement | null>(null);
const strokeCanvasRef = draftCanvasRef;
- const selectiveUndoRef = useRef<(peerId?: string | number) => void>(() => {});
+ const selectiveUndoRef = useRef<(peerId?: string | number, strokeId?: string) => unknown>(() => {});
const pushHistoryStepRef = useRef<PushHistoryStepFn | null>(null);
const getActiveCanvasRef = useRef<() => HTMLCanvasElement | null>(() => null);
const showToast = uiStoreActions.showToast;
@@ -145,7 +151,10 @@ export function App() {
activeLayerId: layerMgr.activeLayerId,
selectedLayerIds: layerMgr.selectedLayerIds,
layerCanvasesRef: layerMgr.layerCanvasesRef,
+ materializeLayerCanvas: layerMgr.materializeLayerCanvas,
+ pushHistoryStepRef,
selectiveUndoRef,
+ resetZoomAndCenter: nav.resetZoomAndCenter,
setActiveLayerId: layerMgr.setActiveLayerId,
addLayer: layerMgr.addLayer,
addRemoteLayer: layerMgr.addRemoteLayer,
@@ -277,8 +286,34 @@ export function App() {
const handleUndo = useCallback(() => {
if (collab.isConnected && collab.myPeer.id) {
- drawing.selectiveUndo(collab.myPeer.id);
- multiplayerService.sendSelectiveUndo(collab.myPeer.id.toString());
+ void drawing.selectiveUndo('local').then((undone) => {
+ if (!undone || !multiplayerService.isConnected()) return;
+ if (undone.strokeId) {
+ multiplayerService.sendSelectiveUndo(undone.strokeId);
+ } else if (undone.tileDeltas && undone.tileDeltas.length > 0) {
+ const grid = documentStore.getActiveTileGrid();
+ for (const delta of undone.tileDeltas) {
+ const { layerId, tileX, tileY } = parseTileKey(delta.key);
+ const tile = grid.getTile(layerId, tileX, tileY, 0);
+ if (tile) {
+ multiplayerService.sendTileDelta(layerId, tile);
+ } else {
+ multiplayerService.sendTileDelta(layerId, {
+ layerId,
+ tileX,
+ tileY,
+ format: delta.format,
+ data: null,
+ dirty: true,
+ version: 0,
+ isPagedToDisk: false,
+ lastAccessTimestamp: Date.now(),
+ lod: 0,
+ });
+ }
+ }
+ }
+ });
} else {
drawing.undo();
}
@@ -1136,12 +1171,15 @@ export function App() {
updateMyName={collab.updateMyName}
handleStartHosting={collab.handleStartHosting}
stopHosting={collab.stopHosting}
+ joinByInviteUrl={collab.joinByInviteUrl}
+ leaveRoom={collab.leaveRoom}
clipboardInvite={collab.clipboardInvite}
setClipboardInvite={collab.setClipboardInvite}
webLandingInvite={collab.webLandingInvite}
setWebLandingInvite={collab.setWebLandingInvite}
joinRoom={collab.joinRoom}
onCaptureTimelapseNow={handleCaptureTimelapseNow}
+ handleSave={docLifecycle.handleSave}
showToast={showToast}
/>
</AppShell>
diff --git a/src/components/ClipboardInviteToast.tsx b/src/components/ClipboardInviteToast.tsx
index 8e3de7d..2b03476 100644
--- a/src/components/ClipboardInviteToast.tsx
+++ b/src/components/ClipboardInviteToast.tsx
@@ -1,15 +1,16 @@
import React from 'react';
import { Users, ArrowRight, X } from 'lucide-react';
+import { ParsedInviteLink } from '../services/multiplayerService';
interface ClipboardInviteToastProps {
- invite: {
- roomName: string;
- host: string;
- port: number;
- url: string;
- token?: string;
- } | null;
- onJoin: (host: string, port: number, roomName: string, token?: string) => void;
+ invite: ParsedInviteLink | null;
+ onJoin: (
+ host: string,
+ port: number,
+ roomName: string,
+ token?: string,
+ isSecure?: boolean
+ ) => void;
onDismiss: () => void;
}
@@ -35,13 +36,16 @@ export const ClipboardInviteToast: React.FC<ClipboardInviteToastProps> = ({
Room: <span className="font-semibold text-amber-300">"{invite.roomName}"</span>
</div>
<div className="text-[10px] text-[#888888] font-mono mt-0.5">
- Host: {invite.host}:{invite.port}
+ Host: {invite.host}
+ {invite.port && invite.port !== 443 && invite.port !== 80 ? `:${invite.port}` : ''}
</div>
</div>
<div className="flex items-center space-x-2 pl-2">
<button
- onClick={() => onJoin(invite.host, invite.port, invite.roomName, invite.token)}
+ onClick={() =>
+ onJoin(invite.host, invite.port, invite.roomName, invite.token, invite.isSecure)
+ }
className="flex items-center space-x-1.5 rounded-md bg-rose-600 hover:bg-rose-500 px-3 py-1.5 text-xs font-semibold text-white transition-colors shadow-sm cursor-pointer"
>
<span>Connect</span>
diff --git a/src/components/GlobalShortcutListener.tsx b/src/components/GlobalShortcutListener.tsx
index d1e5699..8723fb7 100644
--- a/src/components/GlobalShortcutListener.tsx
+++ b/src/components/GlobalShortcutListener.tsx
@@ -106,10 +106,28 @@ const NON_REPEATABLE_COMMANDS = new Set<string>([
'file.saveAs',
]);
+const NON_TEXT_INPUT_TYPES = new Set([
+ 'range',
+ 'checkbox',
+ 'radio',
+ 'color',
+ 'button',
+ 'submit',
+ 'reset',
+ 'file',
+ 'image',
+]);
+
function isEditableTarget(target: EventTarget | null): boolean {
if (!(target instanceof HTMLElement)) return false;
+ if (target.isContentEditable) return true;
const tag = target.tagName;
- return tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || target.isContentEditable;
+ if (tag === 'TEXTAREA' || tag === 'SELECT') return true;
+ if (tag === 'INPUT') {
+ const inputType = ((target as HTMLInputElement).type || 'text').toLowerCase();
+ return !NON_TEXT_INPUT_TYPES.has(inputType);
+ }
+ return false;
}
function modifierActionToTempTool(action: ModifierAction): ToolType | null {
@@ -451,6 +469,7 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
return;
}
+ clearModHold();
e.preventDefault();
shortcutManager.executeCommand(matched.id);
return;
diff --git a/src/components/HostModal.tsx b/src/components/HostModal.tsx
index 3168362..326c16a 100644
--- a/src/components/HostModal.tsx
+++ b/src/components/HostModal.tsx
@@ -1,6 +1,20 @@
-import React, { useState } from 'react';
+import React, { useState, useEffect, useRef } from 'react';
import { SessionHostInfo, CollabPeer } from '../types/multiplayer';
-import { Users, Copy, Check, Power, Wifi, Shield, X, User, Globe, Loader2 } from 'lucide-react';
+import {
+ Users,
+ Copy,
+ Check,
+ Power,
+ Wifi,
+ Shield,
+ X,
+ User,
+ Globe,
+ Loader2,
+ Link2,
+ LogOut,
+ AlertTriangle,
+} from 'lucide-react';
interface HostModalProps {
isOpen: boolean;
@@ -11,11 +25,24 @@ interface HostModalProps {
peers: CollabPeer[];
myPeer: CollabPeer;
onUpdateMyName: (name: string) => void;
- onStartHosting: (roomName: string, port: number, hostNickname?: string, isGlobal?: boolean) => Promise<any>;
+ onStartHosting: (
+ roomName: string,
+ port: number,
+ hostNickname?: string,
+ isGlobal?: boolean,
+ onStatus?: (status: string) => void
+ ) => Promise<any>;
onStopHosting: () => void;
+ onJoinByInviteUrl: (rawUrl: string, nickname?: string, persistName?: boolean) => Promise<boolean>;
+ onLeaveRoom: () => void;
showToast: (msg: string) => void;
}
+function defaultStudioName(name: string): string {
+ const clean = (name || '').trim();
+ return clean ? `${clean}'s Studio` : 'Ink Studio Session';
+}
+
export const HostModal: React.FC<HostModalProps> = ({
isOpen,
onClose,
@@ -27,15 +54,42 @@ export const HostModal: React.FC<HostModalProps> = ({
onUpdateMyName,
onStartHosting,
onStopHosting,
+ onJoinByInviteUrl,
+ onLeaveRoom,
showToast,
}) => {
- const [roomName, setRoomName] = useState("Sora's Studio");
+ const [activeTab, setActiveTab] = useState<'host' | 'join'>('host');
+ const [nickname, setNickname] = useState(myPeer.name || 'Artist');
+ const [roomName, setRoomName] = useState(() => defaultStudioName(myPeer.name));
const [port, setPort] = useState(30303);
- const [nickname, setNickname] = useState(myPeer.name || 'Sora');
const [isGlobal, setIsGlobal] = useState(true);
+ const [joinUrl, setJoinUrl] = useState('');
const [copied, setCopied] = useState(false);
const [copiedLocal, setCopiedLocal] = useState(false);
const [isStarting, setIsStarting] = useState(false);
+ const [isJoining, setIsJoining] = useState(false);
+ const [startStatus, setStartStatus] = useState('');
+ const [startError, setStartError] = useState<string | null>(null);
+
+ const nicknameEditedRef = useRef(false);
+ const roomNameEditedRef = useRef(false);
+
+ // Sync nickname & default room name when OS username resolves or Preferences changes
+ useEffect(() => {
+ if (!nicknameEditedRef.current && myPeer.name) {
+ setNickname(myPeer.name);
+ }
+ if (!roomNameEditedRef.current && myPeer.name) {
+ setRoomName(defaultStudioName(myPeer.name));
+ }
+ }, [myPeer.name]);
+
+ // Reset transient error when modal re-opens
+ useEffect(() => {
+ if (isOpen) {
+ setStartError(null);
+ }
+ }, [isOpen]);
if (!isOpen) return null;
@@ -44,10 +98,10 @@ export const HostModal: React.FC<HostModalProps> = ({
try {
await navigator.clipboard.writeText(hostInfo.inviteUrl);
setCopied(true);
- showToast('Link copied!');
+ showToast('Invite link copied.');
setTimeout(() => setCopied(false), 2000);
} catch {
- showToast('Failed to copy to clipboard');
+ showToast('Failed to copy to clipboard.');
}
};
@@ -56,20 +110,56 @@ export const HostModal: React.FC<HostModalProps> = ({
try {
await navigator.clipboard.writeText(hostInfo.localInviteUrl);
setCopiedLocal(true);
- showToast('Local LAN link copied!');
+ showToast('Local LAN link copied.');
setTimeout(() => setCopiedLocal(false), 2000);
} catch {
- showToast('Failed to copy to clipboard');
+ showToast('Failed to copy to clipboard.');
}
};
- const handleStart = async () => {
+ const handleStart = async (overrideGlobal?: boolean) => {
+ const useGlobal = overrideGlobal !== undefined ? overrideGlobal : isGlobal;
setIsStarting(true);
+ setStartError(null);
+ setStartStatus(useGlobal ? 'Starting Worldwide Tunnel...' : 'Starting Local Server...');
try {
- onUpdateMyName(nickname.trim() || 'Sora');
- await onStartHosting(roomName.trim() || "Sora's Studio", port, nickname.trim() || 'Sora', isGlobal);
+ const resolvedName = nickname.trim() || myPeer.name || 'Artist';
+ if (nicknameEditedRef.current && resolvedName !== myPeer.name) {
+ onUpdateMyName(resolvedName);
+ }
+ const resolvedRoom = roomName.trim() || defaultStudioName(resolvedName);
+ await onStartHosting(resolvedRoom, port, resolvedName, useGlobal, (status) => {
+ setStartStatus(status);
+ });
+ } catch (err: any) {
+ const msg = err?.message || (typeof err === 'string' ? err : 'Failed to start server');
+ setStartError(msg);
} finally {
setIsStarting(false);
+ setStartStatus('');
+ }
+ };
+
+ const handleJoinSubmit = async (e: React.FormEvent) => {
+ e.preventDefault();
+ const trimmedUrl = joinUrl.trim();
+ if (!trimmedUrl) {
+ showToast('Paste a room invite link first.');
+ return;
+ }
+ setIsJoining(true);
+ try {
+ const resolvedName = nickname.trim() || myPeer.name || 'Artist';
+ if (nicknameEditedRef.current && resolvedName !== myPeer.name) {
+ onUpdateMyName(resolvedName);
+ }
+ const ok = await onJoinByInviteUrl(trimmedUrl, resolvedName, nicknameEditedRef.current);
+ if (ok) {
+ setJoinUrl('');
+ onClose();
+ }
+ } finally {
+ setIsJoining(false);
}
};
@@ -83,8 +173,14 @@ export const HostModal: React.FC<HostModalProps> = ({
<Users className="w-5 h-5" />
</div>
<div>
- <h3 className="text-sm font-semibold text-white">Collaborative Drawing (Host)</h3>
- <p className="text-[11px] text-[#888888]">Local hosting without paid cloud servers</p>
+ <h3 className="text-sm font-semibold text-white">Collaborative Drawing</h3>
+ <p className="text-[11px] text-[#888888]">
+ {isConnected
+ ? isHost
+ ? 'Hosting active session'
+ : 'Connected to remote canvas'
+ : 'Host or join a live canvas session'}
+ </p>
</div>
</div>
<button
@@ -98,15 +194,18 @@ export const HostModal: React.FC<HostModalProps> = ({
{/* Content */}
<div className="p-5 space-y-4">
{isConnected && isHost ? (
- // Active session view
+ // Active Host View
<div className="space-y-4">
{hostInfo?.isGlobal ? (
<div className="rounded-md border border-sky-500/30 bg-sky-500/10 p-3.5 flex items-start space-x-3">
<Globe className="w-5 h-5 text-sky-400 shrink-0 mt-0.5" />
<div className="flex-1">
- <div className="text-xs font-semibold text-sky-300">Worldwide Cloudflare Tunnel Active</div>
+ <div className="text-xs font-semibold text-sky-300">
+ Worldwide Cloudflare Tunnel Active
+ </div>
<div className="text-[11px] text-[#aaaaaa] mt-0.5">
- Room: <span className="text-white font-medium">{hostInfo?.roomName}</span> — anyone in the world can join via link in browser or app.
+ Room: <span className="text-white font-medium">{hostInfo?.roomName}</span> —
+ anyone on any network can join via link in browser or desktop app.
</div>
</div>
</div>
@@ -114,9 +213,12 @@ export const HostModal: React.FC<HostModalProps> = ({
<div className="rounded-md border border-emerald-500/30 bg-emerald-500/10 p-3.5 flex items-start space-x-3">
<Wifi className="w-5 h-5 text-emerald-400 shrink-0 mt-0.5" />
<div className="flex-1">
- <div className="text-xs font-semibold text-emerald-300">Local Wi-Fi Server Active</div>
+ <div className="text-xs font-semibold text-emerald-300">
+ Local Wi-Fi Server Active
+ </div>
<div className="text-[11px] text-[#aaaaaa] mt-0.5">
- Room: <span className="text-white font-medium">{hostInfo?.roomName}</span> (port {hostInfo?.port})
+ Room: <span className="text-white font-medium">{hostInfo?.roomName}</span>{' '}
+ (port {hostInfo?.port})
</div>
</div>
</div>
@@ -125,7 +227,11 @@ export const HostModal: React.FC<HostModalProps> = ({
{/* Shareable Link Box */}
<div>
<label className="block text-[11px] font-medium text-[#aaaaaa] mb-1.5 flex items-center justify-between">
- <span>{hostInfo?.isGlobal ? 'Worldwide Invite Link (Browser or Desktop App):' : 'Local Wi-Fi Invite Link:'}</span>
+ <span>
+ {hostInfo?.isGlobal
+ ? 'Worldwide Invite Link (Browser or Desktop App):'
+ : 'Local Wi-Fi Invite Link:'}
+ </span>
{hostInfo?.isGlobal && (
<span className="text-[10px] text-sky-400 font-mono flex items-center space-x-1">
<span className="w-1.5 h-1.5 rounded-full bg-sky-400 animate-pulse" />
@@ -145,24 +251,28 @@ export const HostModal: React.FC<HostModalProps> = ({
className="flex items-center space-x-1.5 rounded border border-[#3e3e3e] bg-[#2a2a2a] hover:bg-[#333333] hover:border-[#4e4e4e] px-3 py-1.5 text-xs font-medium text-white transition-colors shadow-xs shrink-0 cursor-pointer"
>
{copied ? <Check className="w-3.5 h-3.5" /> : <Copy className="w-3.5 h-3.5" />}
- <span>{copied ? 'Copied!' : 'Copy'}</span>
+ <span>{copied ? 'Copied' : 'Copy'}</span>
</button>
</div>
{hostInfo?.isGlobal && hostInfo.localInviteUrl && (
<div className="mt-2 pt-2 border-t border-[#333333] flex items-center justify-between text-[10px] text-[#888888]">
- <span>Local LAN: <span className="font-mono text-[#aaaaaa]">{hostInfo.localInviteUrl}</span></span>
+ <span className="truncate">
+ Local LAN:{' '}
+ <span className="font-mono text-[#aaaaaa]">{hostInfo.localInviteUrl}</span>
+ </span>
<button
onClick={handleCopyLocalLink}
- className="text-[#aaaaaa] hover:text-white underline cursor-pointer ml-2"
+ className="text-[#aaaaaa] hover:text-white underline cursor-pointer ml-2 shrink-0"
>
- {copiedLocal ? 'Copied!' : 'Copy Local'}
+ {copiedLocal ? 'Copied' : 'Copy Local'}
</button>
</div>
)}
<p className="text-[10px] text-[#777777] mt-1.5 leading-relaxed">
- 💡 Friends can open this link directly in Chrome/Safari on PC, Mac, iPad, or enter it in the Ink Studio desktop app.
+ Share this link to open directly in a browser or paste it into the Join tab in the
+ desktop app.
</p>
</div>
@@ -172,7 +282,6 @@ export const HostModal: React.FC<HostModalProps> = ({
<span>Participants on Canvas ({peers.length + 1})</span>
</div>
<div className="rounded border border-[#333333] bg-[#1a1a1a] max-h-36 overflow-y-auto divide-y divide-[#2a2a2a]">
- {/* Host (Me) */}
<div className="flex items-center justify-between px-3 py-2 text-xs">
<div className="flex items-center space-x-2">
<div
@@ -186,9 +295,11 @@ export const HostModal: React.FC<HostModalProps> = ({
</span>
</div>
- {/* Guests */}
{peers.map((peer) => (
- <div key={peer.id} className="flex items-center justify-between px-3 py-2 text-xs">
+ <div
+ key={peer.id}
+ className="flex items-center justify-between px-3 py-2 text-xs"
+ >
<div className="flex items-center space-x-2">
<div
className="w-3 h-3 rounded-full shrink-0"
@@ -219,9 +330,103 @@ export const HostModal: React.FC<HostModalProps> = ({
</button>
</div>
</div>
+ ) : isConnected ? (
+ // Active Guest View
+ <div className="space-y-4">
+ <div className="rounded-md border border-sky-500/30 bg-sky-500/10 p-3.5 flex items-start space-x-3">
+ <Globe className="w-5 h-5 text-sky-400 shrink-0 mt-0.5" />
+ <div className="flex-1 min-w-0">
+ <div className="text-xs font-semibold text-sky-300">Connected to Session</div>
+ <div className="text-[11px] text-[#aaaaaa] mt-0.5 truncate">
+ Room:{' '}
+ <span className="text-white font-medium">
+ {hostInfo?.roomName || 'Studio'}
+ </span>
+ </div>
+ {hostInfo?.localIp && (
+ <div className="text-[10px] text-[#888888] font-mono truncate mt-0.5">
+ {hostInfo.localIp}
+ </div>
+ )}
+ </div>
+ </div>
+
+ <div>
+ <div className="text-xs font-medium text-[#aaaaaa] mb-2">
+ Participants on Canvas ({peers.length + 1})
+ </div>
+ <div className="rounded border border-[#333333] bg-[#1a1a1a] max-h-40 overflow-y-auto divide-y divide-[#2a2a2a]">
+ <div className="flex items-center justify-between px-3 py-2 text-xs">
+ <div className="flex items-center space-x-2">
+ <div
+ className="w-3 h-3 rounded-full shrink-0"
+ style={{ backgroundColor: myPeer.color }}
+ />
+ <span className="font-medium text-white">{myPeer.name} (You)</span>
+ </div>
+ <span className="text-[10px] text-emerald-400">Online</span>
+ </div>
+ {peers.map((peer) => (
+ <div
+ key={peer.id}
+ className="flex items-center justify-between px-3 py-2 text-xs"
+ >
+ <div className="flex items-center space-x-2">
+ <div
+ className="w-3 h-3 rounded-full shrink-0"
+ style={{ backgroundColor: peer.color }}
+ />
+ <span className="text-[#dddddd]">{peer.name}</span>
+ </div>
+ <span className="text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#2a2a2a] text-[#aaaaaa]">
+ {peer.isHost ? 'Host' : 'Peer'}
+ </span>
+ </div>
+ ))}
+ </div>
+ </div>
+
+ <div className="pt-2">
+ <button
+ onClick={() => {
+ onLeaveRoom();
+ onClose();
+ }}
+ className="w-full flex items-center justify-center space-x-2 rounded border border-rose-500/30 bg-rose-500/10 hover:bg-rose-500/20 py-2 text-xs font-medium text-rose-400 transition-colors cursor-pointer"
+ >
+ <LogOut className="w-3.5 h-3.5" />
+ <span>Leave Session</span>
+ </button>
+ </div>
+ </div>
) : (
- // Form to start hosting
+ // Disconnected: Host / Join Tabs
<div className="space-y-4">
+ <div className="grid grid-cols-2 rounded-md border border-[#383838] bg-[#1a1a1a] p-0.5">
+ <button
+ type="button"
+ onClick={() => setActiveTab('host')}
+ className={`rounded py-1.5 text-xs font-medium transition-colors cursor-pointer ${
+ activeTab === 'host'
+ ? 'bg-[#2e2e2e] text-white'
+ : 'text-[#888888] hover:text-[#cccccc]'
+ }`}
+ >
+ Host Session
+ </button>
+ <button
+ type="button"
+ onClick={() => setActiveTab('join')}
+ className={`rounded py-1.5 text-xs font-medium transition-colors cursor-pointer ${
+ activeTab === 'join'
+ ? 'bg-[#2e2e2e] text-white'
+ : 'text-[#888888] hover:text-[#cccccc]'
+ }`}
+ >
+ Join via Link
+ </button>
+ </div>
+
<div>
<label className="block text-xs font-medium text-[#cccccc] mb-1.5 flex items-center space-x-1">
<User className="w-3.5 h-3.5 text-[#888888]" />
@@ -230,111 +435,199 @@ export const HostModal: React.FC<HostModalProps> = ({
<input
type="text"
value={nickname}
- onChange={(e) => setNickname(e.target.value)}
- placeholder="e.g. Sora"
+ onChange={(e) => {
+ nicknameEditedRef.current = true;
+ setNickname(e.target.value);
+ }}
+ maxLength={40}
+ placeholder="Your name"
className="w-full rounded border border-[#3e3e3e] bg-[#1a1a1a] px-3 py-2 text-xs text-white focus:border-[#007acc] focus:outline-hidden"
/>
</div>
- <div>
- <label className="block text-xs font-medium text-[#cccccc] mb-1.5">
- Room / Canvas Name
- </label>
- <input
- type="text"
- value={roomName}
- onChange={(e) => setRoomName(e.target.value)}
- placeholder="e.g. Ink Studio Session"
- className="w-full rounded border border-[#3e3e3e] bg-[#1a1a1a] px-3 py-2 text-xs text-white focus:border-[#007acc] focus:outline-hidden"
- />
- </div>
+ {activeTab === 'host' ? (
+ <>
+ <div>
+ <label className="block text-xs font-medium text-[#cccccc] mb-1.5">
+ Room / Canvas Name
+ </label>
+ <input
+ type="text"
+ value={roomName}
+ onChange={(e) => {
+ roomNameEditedRef.current = true;
+ setRoomName(e.target.value);
+ }}
+ placeholder="Ink Studio Session"
+ className="w-full rounded border border-[#3e3e3e] bg-[#1a1a1a] px-3 py-2 text-xs text-white focus:border-[#007acc] focus:outline-hidden"
+ />
+ </div>
- {/* Network Mode Switcher */}
- <div>
- <label className="block text-xs font-medium text-[#cccccc] mb-1.5">
- Connection Mode
- </label>
- <div className="grid grid-cols-2 gap-2">
- <button
- type="button"
- onClick={() => setIsGlobal(true)}
- className={`flex items-start space-x-2 rounded-lg border p-2.5 text-left transition-colors cursor-pointer ${
- isGlobal
- ? 'border-sky-500 bg-sky-500/10 text-white'
- : 'border-[#383838] bg-[#1a1a1a] text-[#888888] hover:border-[#484848] hover:text-[#cccccc]'
- }`}
- >
- <Globe className={`w-4 h-4 shrink-0 mt-0.5 ${isGlobal ? 'text-sky-400' : 'text-[#888888]'}`} />
+ {/* Network Mode Switcher */}
+ <div>
+ <label className="block text-xs font-medium text-[#cccccc] mb-1.5">
+ Connection Mode
+ </label>
+ <div className="grid grid-cols-2 gap-2">
+ <button
+ type="button"
+ onClick={() => {
+ setIsGlobal(true);
+ setStartError(null);
+ }}
+ className={`flex items-start space-x-2 rounded-lg border p-2.5 text-left transition-colors cursor-pointer ${
+ isGlobal
+ ? 'border-sky-500 bg-sky-500/10 text-white'
+ : 'border-[#383838] bg-[#1a1a1a] text-[#888888] hover:border-[#484848] hover:text-[#cccccc]'
+ }`}
+ >
+ <Globe
+ className={`w-4 h-4 shrink-0 mt-0.5 ${isGlobal ? 'text-sky-400' : 'text-[#888888]'}`}
+ />
+ <div>
+ <div className="text-xs font-medium">Worldwide (Internet)</div>
+ <div className="text-[10px] opacity-75">Cloudflare Tunnel</div>
+ </div>
+ </button>
+
+ <button
+ type="button"
+ onClick={() => {
+ setIsGlobal(false);
+ setStartError(null);
+ }}
+ className={`flex items-start space-x-2 rounded-lg border p-2.5 text-left transition-colors cursor-pointer ${
+ !isGlobal
+ ? 'border-emerald-500 bg-emerald-500/10 text-white'
+ : 'border-[#383838] bg-[#1a1a1a] text-[#888888] hover:border-[#484848] hover:text-[#cccccc]'
+ }`}
+ >
+ <Wifi
+ className={`w-4 h-4 shrink-0 mt-0.5 ${!isGlobal ? 'text-emerald-400' : 'text-[#888888]'}`}
+ />
+ <div>
+ <div className="text-xs font-medium">Local Network Only</div>
+ <div className="text-[10px] opacity-75">Same Wi-Fi network</div>
+ </div>
+ </button>
+ </div>
+ </div>
+
+ {!isGlobal && (
<div>
- <div className="text-xs font-medium">Worldwide (Internet)</div>
- <div className="text-[10px] opacity-75">Cloudflare Tunnel</div>
+ <label className="block text-xs font-medium text-[#cccccc] mb-1.5">
+ Local Port
+ </label>
+ <input
+ type="number"
+ value={port}
+ onChange={(e) => setPort(Number(e.target.value))}
+ className="w-full rounded border border-[#3e3e3e] bg-[#1a1a1a] px-3 py-2 text-xs text-white focus:border-[#007acc] focus:outline-hidden font-mono"
+ />
+ <p className="text-[10px] text-[#777777] mt-1">
+ Default is 30303. Works over local Wi-Fi or virtual LAN (Tailscale).
+ </p>
</div>
- </button>
+ )}
+
+ {startError && (
+ <div className="rounded-md border border-rose-500/40 bg-rose-500/10 p-3 text-[11px] text-rose-300 space-y-2">
+ <div className="flex items-start space-x-2">
+ <AlertTriangle className="w-4 h-4 shrink-0 mt-0.5 text-rose-400" />
+ <span className="break-words">{startError}</span>
+ </div>
+ {isGlobal && (
+ <button
+ type="button"
+ onClick={() => {
+ setIsGlobal(false);
+ void handleStart(false);
+ }}
+ className="text-[11px] text-white underline hover:text-emerald-300 cursor-pointer"
+ >
+ Start Local Wi-Fi Server instead
+ </button>
+ )}
+ </div>
+ )}
+
+ <div className="rounded-md border border-[#333333] bg-[#1a1a1a] p-3 text-[11px] text-[#aaaaaa] space-y-1.5">
+ <div className="flex items-center space-x-1.5 text-white font-medium">
+ <Shield className="w-3.5 h-3.5 text-[#888888]" />
+ <span>
+ {isGlobal ? 'Encrypted Worldwide Tunnel' : 'Local Wi-Fi Access'}
+ </span>
+ </div>
+ <p className="leading-relaxed">
+ {isGlobal
+ ? 'Launches a Cloudflare HTTPS/WSS tunnel (HTTP/2 over port 443) so friends on any network can join in a browser or desktop app.'
+ : 'Reachable only by devices on the same Wi-Fi network or virtual LAN (e.g. Tailscale).'}
+ </p>
+ </div>
<button
- type="button"
- onClick={() => setIsGlobal(false)}
- className={`flex items-start space-x-2 rounded-lg border p-2.5 text-left transition-colors cursor-pointer ${
- !isGlobal
- ? 'border-emerald-500 bg-emerald-500/10 text-white'
- : 'border-[#383838] bg-[#1a1a1a] text-[#888888] hover:border-[#484848] hover:text-[#cccccc]'
- }`}
+ disabled={isStarting}
+ onClick={() => void handleStart()}
+ className="w-full flex items-center justify-center space-x-2 rounded border border-[#3e3e3e] bg-[#2a2a2a] hover:bg-[#333333] hover:border-[#4e4e4e] py-2.5 text-xs font-semibold text-white transition-colors shadow-xs disabled:opacity-50 cursor-pointer"
>
- <Wifi className={`w-4 h-4 shrink-0 mt-0.5 ${!isGlobal ? 'text-emerald-400' : 'text-[#888888]'}`} />
- <div>
- <div className="text-xs font-medium">Local Network Only</div>
- <div className="text-[10px] opacity-75">Same Wi-Fi network</div>
- </div>
+ {isStarting ? (
+ <>
+ <Loader2 className="w-4 h-4 text-sky-400 animate-spin" />
+ <span>
+ {startStatus ||
+ (isGlobal ? 'Starting Worldwide Tunnel...' : 'Starting Server...')}
+ </span>
+ </>
+ ) : (
+ <>
+ {isGlobal ? (
+ <Globe className="w-4 h-4 text-sky-400" />
+ ) : (
+ <Users className="w-4 h-4 text-[#cccccc]" />
+ )}
+ <span>Start Server & Copy Link</span>
+ </>
+ )}
</button>
- </div>
- </div>
+ </>
+ ) : (
+ <form onSubmit={handleJoinSubmit} className="space-y-4">
+ <div>
+ <label className="block text-xs font-medium text-[#cccccc] mb-1.5 flex items-center space-x-1">
+ <Link2 className="w-3.5 h-3.5 text-[#888888]" />
+ <span>Invite Link</span>
+ </label>
+ <input
+ type="text"
+ value={joinUrl}
+ onChange={(e) => setJoinUrl(e.target.value)}
+ placeholder="https://....trycloudflare.com/?room=...&token=..."
+ className="w-full rounded border border-[#3e3e3e] bg-[#1a1a1a] px-3 py-2 text-xs text-white font-mono focus:border-[#007acc] focus:outline-hidden"
+ />
+ <p className="text-[10px] text-[#777777] mt-1">
+ Paste the full worldwide or LAN invite link shared by the host.
+ </p>
+ </div>
- {!isGlobal && (
- <div>
- <label className="block text-xs font-medium text-[#cccccc] mb-1.5">
- Local Port
- </label>
- <input
- type="number"
- value={port}
- onChange={(e) => setPort(Number(e.target.value))}
- className="w-full rounded border border-[#3e3e3e] bg-[#1a1a1a] px-3 py-2 text-xs text-white focus:border-[#007acc] focus:outline-hidden font-mono"
- />
- <p className="text-[10px] text-[#777777] mt-1">
- Default is 30303. Works over local Wi-Fi or virtual LAN (Tailscale).
- </p>
- </div>
+ <button
+ type="submit"
+ disabled={isJoining || !joinUrl.trim()}
+ className="w-full flex items-center justify-center space-x-2 rounded border border-[#3e3e3e] bg-[#2a2a2a] hover:bg-[#333333] hover:border-[#4e4e4e] py-2.5 text-xs font-semibold text-white transition-colors shadow-xs disabled:opacity-50 cursor-pointer"
+ >
+ {isJoining ? (
+ <>
+ <Loader2 className="w-4 h-4 text-sky-400 animate-spin" />
+ <span>Connecting...</span>
+ </>
+ ) : (
+ <>
+ <Link2 className="w-4 h-4 text-sky-400" />
+ <span>Join Session</span>
+ </>
+ )}
+ </button>
+ </form>
)}
-
- <div className="rounded-md border border-[#333333] bg-[#1a1a1a] p-3 text-[11px] text-[#aaaaaa] space-y-1.5">
- <div className="flex items-center space-x-1.5 text-white font-medium">
- <Shield className="w-3.5 h-3.5 text-[#888888]" />
- <span>{isGlobal ? '100% Free Worldwide Access' : 'Local Wi-Fi Access'}</span>
- </div>
- <p className="leading-relaxed">
- {isGlobal
- ? 'The app automatically launches a secure Cloudflare HTTPS tunnel. A friend from any country can draw with you instantly right in their browser without installing anything.'
- : 'The server will be reachable only by devices connected to your same home Wi-Fi or virtual LAN (e.g. Tailscale).'}
- </p>
- </div>
-
- <button
- disabled={isStarting}
- onClick={handleStart}
- className="w-full flex items-center justify-center space-x-2 rounded border border-[#3e3e3e] bg-[#2a2a2a] hover:bg-[#333333] hover:border-[#4e4e4e] py-2.5 text-xs font-semibold text-white transition-colors shadow-xs disabled:opacity-50 cursor-pointer"
- >
- {isStarting ? (
- <>
- <Loader2 className="w-4 h-4 text-sky-400 animate-spin" />
- <span>{isGlobal ? 'Starting Worldwide Tunnel...' : 'Starting Server...'}</span>
- </>
- ) : (
- <>
- {isGlobal ? <Globe className="w-4 h-4 text-sky-400" /> : <Users className="w-4 h-4 text-[#cccccc]" />}
- <span>Start Server & Copy Link</span>
- </>
- )}
- </button>
</div>
)}
</div>
diff --git a/src/components/ModalHost.tsx b/src/components/ModalHost.tsx
index 6072dd4..7c59f28 100644
--- a/src/components/ModalHost.tsx
+++ b/src/components/ModalHost.tsx
@@ -8,6 +8,7 @@ import {
} from '../types/editor';
import { AppSettings, ResizeCanvasOptions } from '../types/settings';
import { CollabPeer, SessionHostInfo } from '../types/multiplayer';
+import { ParsedInviteLink } from '../services/multiplayerService';
import { CrashedSessionInfo } from '../services/recoveryService';
import { TonalCorrectionType } from '../utils/tonalEngine';
import { AnyTonalParams } from '../hooks/useTonalAndFilterActions';
@@ -29,14 +30,10 @@ import { WebLandingModal } from './WebLandingModal';
import { MangaEffectsModal } from './MangaEffectsModal';
import { WebtoonExportModal } from './WebtoonExportModal';
import { TimelapseExportModal } from './TimelapseExportModal';
+import { UpdateModal } from './UpdateModal';
+import { UpdateToast } from './UpdateToast';
-export interface InviteLinkPayload {
- roomName: string;
- host: string;
- port: number;
- url: string;
- token?: string;
-}
+export type InviteLinkPayload = ParsedInviteLink;
export interface ModalHostProps {
layers: LayerItem[];
@@ -79,15 +76,27 @@ export interface ModalHostProps {
roomName: string,
port: number,
hostNickname?: string,
- isGlobal?: boolean
+ isGlobal?: boolean,
+ onStatus?: (status: string) => void
) => Promise<boolean | SessionHostInfo>;
stopHosting: () => void;
+ joinByInviteUrl: (rawUrl: string, nickname?: string, persistName?: boolean) => Promise<boolean>;
+ leaveRoom: () => void;
clipboardInvite: InviteLinkPayload | null;
setClipboardInvite: (invite: InviteLinkPayload | null) => void;
webLandingInvite: InviteLinkPayload | null;
setWebLandingInvite: (invite: InviteLinkPayload | null) => void;
- joinRoom: (host: string, port: number, roomName: string, name: string, token?: string) => void;
+ joinRoom: (
+ host: string,
+ port: number,
+ roomName: string,
+ name?: string,
+ token?: string,
+ isSecureOverride?: boolean,
+ persistName?: boolean
+ ) => Promise<boolean>;
onCaptureTimelapseNow?: () => void;
+ handleSave?: () => void;
showToast: (msg: string) => void;
}
@@ -120,12 +129,15 @@ export const ModalHost: React.FC<ModalHostProps> = React.memo(
updateMyName,
handleStartHosting,
stopHosting,
+ joinByInviteUrl,
+ leaveRoom,
clipboardInvite,
setClipboardInvite,
webLandingInvite,
setWebLandingInvite,
joinRoom,
onCaptureTimelapseNow,
+ handleSave,
showToast,
}) => {
const dimensions = useDocumentStore((s) => s.dimensions);
@@ -274,20 +286,26 @@ export const ModalHost: React.FC<ModalHostProps> = React.memo(
onUpdateMyName={updateMyName}
onStartHosting={handleStartHosting}
onStopHosting={stopHosting}
+ onJoinByInviteUrl={joinByInviteUrl}
+ onLeaveRoom={leaveRoom}
showToast={showToast}
/>
<ClipboardInviteToast
invite={clipboardInvite}
- onJoin={(h, p, r, t) => joinRoom(h, p, r, collabMyPeer.name, t)}
+ onJoin={(h, p, r, t, isSecure) =>
+ void joinRoom(h, p, r, collabMyPeer.name, t, isSecure, false)
+ }
onDismiss={() => setClipboardInvite(null)}
/>
<WebLandingModal
invite={webLandingInvite}
- onJoinInBrowser={(name, h, p, r, t) => {
- updateMyName(name);
- joinRoom(h, p, r, name, t);
+ onJoinInBrowser={(name, h, p, r, t, isSecure, persistName) => {
+ if (persistName) {
+ updateMyName(name);
+ }
+ void joinRoom(h, p, r, name, t, isSecure, Boolean(persistName));
}}
onDismiss={() => setWebLandingInvite(null)}
/>
@@ -343,6 +361,13 @@ export const ModalHost: React.FC<ModalHostProps> = React.memo(
onCaptureNow={onCaptureTimelapseNow}
showToast={showToast}
/>
+
+ <UpdateModal
+ hasActiveCollabSession={Boolean(isCollabHost || collabHostInfo)}
+ onSaveFirst={handleSave}
+ />
+
+ <UpdateToast />
</>
);
}
diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsx
index d204c8a..b1bd1b6 100644
--- a/src/components/SettingsModal.tsx
+++ b/src/components/SettingsModal.tsx
@@ -1,4 +1,5 @@
import React, { useState, useEffect, useMemo } from 'react';
+import { version as APP_VERSION } from '../../package.json';
import { safeLocalStorageSetItem } from '../utils/safeStorage';
import {
X,
@@ -12,7 +13,13 @@ import {
Check,
Search,
AlertTriangle,
+ ArrowDownToLine,
+ Loader2,
+ RefreshCw,
} from 'lucide-react';
+import { isTauriEnvironment } from '../hooks/useMultiplayer';
+import { updaterService } from '../services/updaterService';
+import { useUpdaterStore } from '../stores/useUpdaterStore';
import {
AppSettings,
DEFAULT_APP_SETTINGS,
@@ -121,10 +128,23 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
conflicts: CommandDefinition[];
} | null>(null);
+ const isDesktopTauri = isTauriEnvironment();
+ const updaterStatus = useUpdaterStore((s) => s.status);
+ const runtimeAppVersion = useUpdaterStore((s) => s.currentVersion);
+ const availableUpdateVersion = useUpdaterStore((s) => s.availableVersion);
+ const updateProgressPercent = useUpdaterStore((s) => s.progressPercent);
+ const updateErrorMessage = useUpdaterStore((s) => s.errorMessage);
+
useEffect(() => {
setLocalSettings(settings);
}, [settings]);
+ useEffect(() => {
+ if (isOpen && isDesktopTauri) {
+ void updaterService.resolveCurrentVersion();
+ }
+ }, [isOpen, isDesktopTauri]);
+
useEffect(() => {
if (!isOpen) {
setRecordingCommandId(null);
@@ -511,6 +531,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
const val = e.target.value;
handleChange('userName', val);
safeLocalStorageSetItem('sora_paint_nickname', val, 'artist name');
+ safeLocalStorageSetItem('ink_nickname_customized', val.trim() ? '1' : '0', 'artist name flag');
}}
placeholder="Artist"
className="w-full bg-[#161616] px-3 py-1.5 rounded text-xs text-[#e5e5e5] placeholder-[#8a8a8a]/50"
@@ -952,12 +973,110 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
/>
<div>
<h2 className="text-sm font-semibold text-[#e5e5e5]">Ink Studio</h2>
- <p className="text-[11px] font-mono text-[#8a8a8a]">v0.1.0</p>
+ <p className="text-[11px] font-mono text-[#8a8a8a]">
+ v{runtimeAppVersion || APP_VERSION} · Collaborative Drawing Studio · by Sora
+ </p>
</div>
</div>
<p className="text-xs text-[#8a8a8a] leading-relaxed">
- Digital drawing and manga studio supporting layered PSD/CSP workflows, GPU tile compositing, stylus pressure dynamics, and 1-bit monochrome inking.
+ Collaborative Drawing Studio supporting layered PSD/CSP workflows, GPU tile compositing, stylus pressure dynamics, vector inking, and real-time multiplayer drawing.
</p>
+
+ {isDesktopTauri && (
+ <section className="space-y-2.5 pt-2 border-t border-[#2c2c2c]">
+ <div>
+ <h3 className="text-xs font-medium text-[#e5e5e5]">Updates</h3>
+ <p className="text-[11px] text-[#8a8a8a]">
+ Keep Ink Studio up to date with the latest desktop releases
+ </p>
+ </div>
+
+ <div className="bg-[#161616] rounded p-3 space-y-3">
+ <label className="flex items-center justify-between py-0.5 cursor-pointer">
+ <span className="text-xs text-[#e5e5e5]">
+ Automatically check for updates on startup
+ </span>
+ <input
+ type="checkbox"
+ checked={localSettings.autoCheckUpdates}
+ onChange={(e) => handleChange('autoCheckUpdates', e.target.checked)}
+ />
+ </label>
+
+ <div className="pt-2.5 border-t border-[#2c2c2c] flex items-center justify-between gap-3">
+ <div className="min-w-0 text-[11px]">
+ {updaterStatus === 'checking' && (
+ <span className="text-[#8a8a8a]">Checking for updates...</span>
+ )}
+ {updaterStatus === 'up-to-date' && (
+ <span className="text-emerald-400">Up to date</span>
+ )}
+ {updaterStatus === 'available' && availableUpdateVersion && (
+ <span className="text-[var(--accent)] font-medium">
+ Update v{availableUpdateVersion} available
+ </span>
+ )}
+ {updaterStatus === 'downloading' && (
+ <span className="text-[var(--accent)] font-mono">
+ Downloading update... {updateProgressPercent}%
+ </span>
+ )}
+ {updaterStatus === 'ready' && (
+ <span className="text-emerald-400">
+ Update ready — restarting...
+ </span>
+ )}
+ {updaterStatus === 'error' && (
+ <span className="text-red-400 break-words">
+ {updateErrorMessage || 'Failed to check for updates'}
+ </span>
+ )}
+ {updaterStatus === 'idle' && (
+ <span className="text-[#8a8a8a]">
+ Current version: <span className="font-mono">v{runtimeAppVersion || APP_VERSION}</span>
+ </span>
+ )}
+ </div>
+
+ <div className="flex items-center gap-2 shrink-0">
+ {(updaterStatus === 'available' || updaterStatus === 'downloading') && (
+ <button
+ type="button"
+ onClick={() => {
+ onClose();
+ updaterService.openUpdateModal();
+ }}
+ className="flex items-center gap-1.5 px-2.5 py-1.5 rounded bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 text-[11px] font-medium transition-opacity cursor-pointer"
+ >
+ <ArrowDownToLine className="w-3 h-3" />
+ <span>
+ {updaterStatus === 'downloading' ? 'View Progress' : 'View Update'}
+ </span>
+ </button>
+ )}
+
+ <button
+ type="button"
+ disabled={
+ updaterStatus === 'checking' ||
+ updaterStatus === 'downloading' ||
+ updaterStatus === 'ready'
+ }
+ onClick={() => void updaterService.checkForUpdates({ silent: false })}
+ className="flex items-center gap-1.5 px-2.5 py-1.5 rounded bg-[#2c2c2c] hover:bg-[#383838] disabled:opacity-50 disabled:cursor-not-allowed text-[#e5e5e5] text-[11px] font-medium transition-colors cursor-pointer"
+ >
+ {updaterStatus === 'checking' ? (
+ <Loader2 className="w-3 h-3 animate-spin text-[var(--accent)]" />
+ ) : (
+ <RefreshCw className="w-3 h-3" />
+ )}
+ <span>Check for Updates</span>
+ </button>
+ </div>
+ </div>
+ </div>
+ </section>
+ )}
</div>
)}
</div>
diff --git a/src/components/SubToolList.tsx b/src/components/SubToolList.tsx
index eea6d01..3ecdda6 100644
--- a/src/components/SubToolList.tsx
+++ b/src/components/SubToolList.tsx
@@ -46,7 +46,7 @@ function renderBuiltinIcon(icon: BuiltinBrushDefinition['icon']) {
export const SubToolList: React.FC<SubToolListProps> = React.memo(
({ customBrushes, setCustomBrushes }) => {
const currentTool = useToolStore((s) => s.tool);
- const activePreset = useToolStore((s) => s.brushSettings.preset);
+ const activePreset = useToolStore((s) => s.activePresetId);
const [isImportingSut, setIsImportingSut] = useState(false);
const [isDraggingFileOver, setIsDraggingFileOver] = useState(false);
diff --git a/src/components/UpdateModal.tsx b/src/components/UpdateModal.tsx
new file mode 100644
index 0000000..67866ec
--- /dev/null
+++ b/src/components/UpdateModal.tsx
@@ -0,0 +1,386 @@
+import React, { useEffect, useState } from 'react';
+import {
+ AlertTriangle,
+ ArrowDownToLine,
+ ArrowRight,
+ CheckCircle2,
+ Loader2,
+ RefreshCw,
+ Save,
+ X,
+} from 'lucide-react';
+import { isTauriEnvironment } from '../hooks/useMultiplayer';
+import { updaterService } from '../services/updaterService';
+import { useDocumentStore } from '../stores/useDocumentStore';
+import { useUpdaterStore } from '../stores/useUpdaterStore';
+
+export interface UpdateModalProps {
+ hasActiveCollabSession: boolean;
+ onSaveFirst?: () => void;
+}
+
+function formatMegabytes(bytes: number): string {
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
+}
+
+function formatReleaseDate(raw: string | null): string | null {
+ if (!raw) return null;
+ const parsed = new Date(raw);
+ if (Number.isNaN(parsed.getTime())) return raw;
+ return parsed.toLocaleDateString(undefined, {
+ year: 'numeric',
+ month: 'short',
+ day: 'numeric',
+ });
+}
+
+export const UpdateModal: React.FC<UpdateModalProps> = ({
+ hasActiveCollabSession,
+ onSaveFirst,
+}) => {
+ const isModalOpen = useUpdaterStore((s) => s.isModalOpen);
+ const status = useUpdaterStore((s) => s.status);
+ const currentVersion = useUpdaterStore((s) => s.currentVersion);
+ const availableVersion = useUpdaterStore((s) => s.availableVersion);
+ const releaseDate = useUpdaterStore((s) => s.releaseDate);
+ const releaseNotes = useUpdaterStore((s) => s.releaseNotes);
+ const downloadedBytes = useUpdaterStore((s) => s.downloadedBytes);
+ const totalBytes = useUpdaterStore((s) => s.totalBytes);
+ const progressPercent = useUpdaterStore((s) => s.progressPercent);
+ const errorMessage = useUpdaterStore((s) => s.errorMessage);
+
+ const hasUnsavedChanges = useDocumentStore((s) => s.documents.some((d) => d.isDirty));
+ const [confirmingGuard, setConfirmingGuard] = useState(false);
+
+ useEffect(() => {
+ if (!isModalOpen || status !== 'available') {
+ setConfirmingGuard(false);
+ }
+ }, [isModalOpen, status]);
+
+ if (!isTauriEnvironment() || !isModalOpen) {
+ return null;
+ }
+
+ const isBusy = status === 'downloading' || status === 'ready';
+ const hasSafetyRisk = hasUnsavedChanges || hasActiveCollabSession;
+ const formattedDate = formatReleaseDate(releaseDate);
+
+ const handleClose = () => {
+ if (isBusy) return;
+ setConfirmingGuard(false);
+ updaterService.closeUpdateModal();
+ };
+
+ const handleInstallClick = () => {
+ const dirtyNow = useDocumentStore.getState().documents.some((d) => d.isDirty);
+ if ((dirtyNow || hasActiveCollabSession) && !confirmingGuard) {
+ setConfirmingGuard(true);
+ return;
+ }
+ setConfirmingGuard(false);
+ void updaterService.downloadAndInstallUpdate();
+ };
+
+ const handleSaveFirst = () => {
+ setConfirmingGuard(false);
+ updaterService.closeUpdateModal();
+ onSaveFirst?.();
+ };
+
+ const handleLater = () => {
+ if (isBusy) return;
+ setConfirmingGuard(false);
+ updaterService.dismissBanner();
+ updaterService.closeUpdateModal();
+ };
+
+ const handleSkipVersion = () => {
+ if (isBusy) return;
+ setConfirmingGuard(false);
+ updaterService.skipAvailableVersion();
+ };
+
+ const safetyWarningParts: string[] = [];
+ if (hasUnsavedChanges) safetyWarningParts.push('unsaved changes');
+ if (hasActiveCollabSession) safetyWarningParts.push('an active multiplayer session');
+ const safetyWarningLabel = safetyWarningParts.join(' and ');
+
+ return (
+ <div
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby="update-modal-title"
+ className="fixed inset-0 z-50 flex items-center justify-center bg-black/75 p-4 select-none"
+ onClick={handleClose}
+ onKeyDown={(e) => {
+ if (e.key === 'Escape' && !isBusy) {
+ handleClose();
+ }
+ }}
+ >
+ <div
+ onClick={(e) => e.stopPropagation()}
+ className="bg-[#202020] rounded-lg shadow-[0_24px_64px_rgba(0,0,0,0.8)] w-full max-w-lg flex flex-col overflow-hidden text-xs text-[#e5e5e5] border border-[#2c2c2c]"
+ >
+ {/* Header */}
+ <div className="h-10 px-4 flex items-center justify-between bg-[#161616] shrink-0">
+ <div className="flex items-center gap-2">
+ <ArrowDownToLine className="w-3.5 h-3.5 text-[var(--accent)]" />
+ <span id="update-modal-title" className="text-xs font-medium text-[#e5e5e5]">
+ Software Update
+ </span>
+ </div>
+ {!isBusy && (
+ <button
+ type="button"
+ onClick={handleClose}
+ className="w-6 h-6 rounded flex items-center justify-center text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] transition-colors cursor-pointer"
+ title="Close (Esc)"
+ aria-label="Close update modal"
+ >
+ <X className="w-3.5 h-3.5" />
+ </button>
+ )}
+ </div>
+
+ {/* Body */}
+ <div className="p-5 space-y-4">
+ {status === 'checking' && (
+ <div className="py-8 flex flex-col items-center justify-center gap-3 text-center">
+ <Loader2 className="w-6 h-6 text-[var(--accent)] animate-spin" />
+ <div className="space-y-1">
+ <div className="text-xs font-medium text-[#e5e5e5]">
+ Checking for updates...
+ </div>
+ <div className="text-[11px] text-[#8a8a8a] font-mono">
+ Current version: v{currentVersion}
+ </div>
+ </div>
+ </div>
+ )}
+
+ {status === 'up-to-date' && (
+ <div className="py-6 flex flex-col items-center justify-center gap-3 text-center">
+ <div className="w-10 h-10 rounded-full bg-[#161616] flex items-center justify-center text-emerald-400">
+ <CheckCircle2 className="w-5 h-5" />
+ </div>
+ <div className="space-y-1">
+ <div className="text-xs font-medium text-[#e5e5e5]">
+ Ink Studio is up to date
+ </div>
+ <div className="text-[11px] text-[#8a8a8a] font-mono">
+ v{currentVersion} is the latest available version.
+ </div>
+ </div>
+ </div>
+ )}
+
+ {status === 'error' && (
+ <div className="space-y-3">
+ <div className="p-3.5 rounded bg-[#161616] border border-red-500/30 flex items-start gap-2.5">
+ <AlertTriangle className="w-4 h-4 text-red-400 shrink-0 mt-0.5" />
+ <div className="space-y-1 min-w-0">
+ <div className="text-xs font-medium text-[#e5e5e5]">
+ Update check failed
+ </div>
+ <div className="text-[11px] text-[#8a8a8a] break-words">
+ {errorMessage || 'Unable to reach the update server.'}
+ </div>
+ </div>
+ </div>
+ </div>
+ )}
+
+ {status === 'idle' && (
+ <div className="py-6 flex flex-col items-center justify-center gap-2 text-center">
+ <div className="text-xs font-medium text-[#e5e5e5]">
+ Check for Ink Studio updates
+ </div>
+ <div className="text-[11px] text-[#8a8a8a] font-mono">
+ Installed version: v{currentVersion}
+ </div>
+ </div>
+ )}
+
+ {(status === 'available' || status === 'downloading' || status === 'ready') && (
+ <>
+ {/* Version comparison card */}
+ <div className="p-3.5 rounded bg-[#161616] flex items-center justify-between gap-3">
+ <div className="space-y-0.5">
+ <div className="text-[10px] uppercase tracking-wider text-[#8a8a8a]">
+ Version Update
+ </div>
+ <div className="flex items-center gap-2 font-mono text-xs">
+ <span className="text-[#8a8a8a]">v{currentVersion}</span>
+ <ArrowRight className="w-3.5 h-3.5 text-[var(--accent)]" />
+ <span className="text-[#e5e5e5] font-semibold">
+ v{availableVersion}
+ </span>
+ </div>
+ </div>
+ {formattedDate && (
+ <span className="text-[10px] text-[#8a8a8a] font-mono shrink-0">
+ {formattedDate}
+ </span>
+ )}
+ </div>
+
+ {/* Scrollable plain-text release notes */}
+ <div className="space-y-1.5">
+ <div className="text-[11px] font-medium text-[#e5e5e5]">Release Notes</div>
+ <div className="bg-[#161616] rounded p-3 max-h-44 overflow-y-auto border border-[#2c2c2c] select-text">
+ <pre className="whitespace-pre-wrap break-words font-sans text-[11px] leading-relaxed text-[#e5e5e5]/90">
+ {releaseNotes?.trim() || 'Bug fixes and performance improvements.'}
+ </pre>
+ </div>
+ </div>
+
+ {/* Download progress bar */}
+ {(status === 'downloading' || status === 'ready') && (
+ <div className="space-y-1.5 bg-[#161616] rounded p-3 border border-[#2c2c2c]">
+ <div className="flex items-center justify-between text-[11px]">
+ <span className="text-[#e5e5e5] font-medium flex items-center gap-1.5">
+ <Loader2 className="w-3.5 h-3.5 text-[var(--accent)] animate-spin" />
+ {status === 'ready'
+ ? 'Installing update & restarting...'
+ : 'Downloading update...'}
+ </span>
+ <span className="font-mono text-[#8a8a8a]">
+ {totalBytes
+ ? `${formatMegabytes(downloadedBytes)} / ${formatMegabytes(totalBytes)} (${progressPercent}%)`
+ : downloadedBytes > 0
+ ? formatMegabytes(downloadedBytes)
+ : `${progressPercent}%`}
+ </span>
+ </div>
+ <div className="w-full h-1.5 rounded-full bg-[#2c2c2c] overflow-hidden">
+ <div
+ className="h-full bg-[var(--accent)] transition-all duration-150"
+ style={{ width: `${Math.max(2, Math.min(100, progressPercent))}%` }}
+ />
+ </div>
+ </div>
+ )}
+
+ {/* Safety warning for unsaved changes or active multiplayer session */}
+ {status === 'available' && hasSafetyRisk && (
+ <div
+ className={`p-3 rounded border flex items-start gap-2.5 ${
+ confirmingGuard
+ ? 'bg-amber-500/15 border-amber-500/50'
+ : 'bg-[#161616] border-amber-500/30'
+ }`}
+ >
+ <AlertTriangle className="w-4 h-4 text-amber-400 shrink-0 mt-0.5" />
+ <div className="space-y-1 text-[11px]">
+ <div className="font-medium text-amber-200">
+ {confirmingGuard
+ ? 'Confirm Restart Before Installing'
+ : 'Active Work Detected'}
+ </div>
+ <p className="text-[#e5e5e5]/85 leading-relaxed">
+ You have {safetyWarningLabel} — save your work before installing, because Ink
+ Studio will restart.
+ </p>
+ </div>
+ </div>
+ )}
+ </>
+ )}
+ </div>
+
+ {/* Footer actions */}
+ <div className="px-4 py-3 bg-[#161616] flex items-center justify-between gap-2 border-t border-[#2c2c2c]">
+ {status === 'available' ? (
+ confirmingGuard ? (
+ <>
+ <button
+ type="button"
+ onClick={() => setConfirmingGuard(false)}
+ className="px-2.5 py-1.5 rounded bg-[#202020] hover:bg-[#2c2c2c] text-[#8a8a8a] hover:text-[#e5e5e5] transition-colors cursor-pointer"
+ >
+ Back
+ </button>
+ <div className="flex items-center gap-2">
+ {hasUnsavedChanges && onSaveFirst && (
+ <button
+ type="button"
+ onClick={handleSaveFirst}
+ className="flex items-center gap-1.5 px-3 py-1.5 rounded bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] font-medium transition-colors cursor-pointer"
+ >
+ <Save className="w-3.5 h-3.5" />
+ <span>Save First</span>
+ </button>
+ )}
+ <button
+ type="button"
+ onClick={handleInstallClick}
+ className="flex items-center gap-1.5 px-3 py-1.5 rounded bg-amber-500 hover:bg-amber-400 text-[#161616] font-semibold transition-colors cursor-pointer"
+ >
+ <ArrowDownToLine className="w-3.5 h-3.5" />
+ <span>Install &amp; Restart Anyway</span>
+ </button>
+ </div>
+ </>
+ ) : (
+ <>
+ <button
+ type="button"
+ onClick={handleSkipVersion}
+ className="px-2.5 py-1.5 rounded text-[11px] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] transition-colors cursor-pointer"
+ >
+ Skip This Version
+ </button>
+ <div className="flex items-center gap-2">
+ <button
+ type="button"
+ onClick={handleLater}
+ className="px-3 py-1.5 rounded bg-[#202020] hover:bg-[#2c2c2c] text-[#e5e5e5] transition-colors cursor-pointer"
+ >
+ Later
+ </button>
+ <button
+ type="button"
+ onClick={handleInstallClick}
+ className="flex items-center gap-1.5 px-3.5 py-1.5 rounded bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 font-medium transition-opacity cursor-pointer"
+ >
+ <ArrowDownToLine className="w-3.5 h-3.5" />
+ <span>Download &amp; Install</span>
+ </button>
+ </div>
+ </>
+ )
+ ) : status === 'downloading' || status === 'ready' ? (
+ <div className="w-full text-right text-[11px] text-[#8a8a8a]">
+ Please keep Ink Studio open until the update completes.
+ </div>
+ ) : (
+ <>
+ <div />
+ <div className="flex items-center gap-2">
+ {(status === 'error' || status === 'up-to-date' || status === 'idle') && (
+ <button
+ type="button"
+ onClick={() => void updaterService.checkForUpdates({ silent: false })}
+ className="flex items-center gap-1.5 px-3 py-1.5 rounded bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] transition-colors cursor-pointer"
+ >
+ <RefreshCw className="w-3 h-3" />
+ <span>{status === 'error' ? 'Retry' : 'Check Again'}</span>
+ </button>
+ )}
+ <button
+ type="button"
+ onClick={handleClose}
+ className="px-3 py-1.5 rounded bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 font-medium transition-opacity cursor-pointer"
+ >
+ Close
+ </button>
+ </div>
+ </>
+ )}
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/src/components/UpdateToast.tsx b/src/components/UpdateToast.tsx
new file mode 100644
index 0000000..a310715
--- /dev/null
+++ b/src/components/UpdateToast.tsx
@@ -0,0 +1,66 @@
+import React from 'react';
+import { ArrowDownToLine, ArrowRight, X } from 'lucide-react';
+import { isTauriEnvironment } from '../hooks/useMultiplayer';
+import { updaterService } from '../services/updaterService';
+import { useUpdaterStore } from '../stores/useUpdaterStore';
+
+export const UpdateToast: React.FC = () => {
+ const status = useUpdaterStore((s) => s.status);
+ const availableVersion = useUpdaterStore((s) => s.availableVersion);
+ const isBannerDismissed = useUpdaterStore((s) => s.isBannerDismissed);
+ const isModalOpen = useUpdaterStore((s) => s.isModalOpen);
+
+ if (!isTauriEnvironment()) return null;
+ if (status !== 'available' || !availableVersion || isBannerDismissed || isModalOpen) {
+ return null;
+ }
+
+ return (
+ <div
+ role="status"
+ aria-live="polite"
+ className="fixed bottom-12 right-5 z-50 animate-in fade-in slide-in-from-bottom-4 duration-200 select-none"
+ >
+ <div className="flex items-center gap-3 rounded-lg border border-[var(--accent-border)] bg-[#202020]/95 backdrop-blur-md px-3.5 py-2.5 shadow-[0_12px_36px_rgba(0,0,0,0.7)] text-[#e5e5e5]">
+ <div className="flex items-center justify-center w-7 h-7 rounded-md bg-[#161616] text-[var(--accent)] shrink-0">
+ <ArrowDownToLine className="w-3.5 h-3.5" />
+ </div>
+
+ <div className="min-w-0">
+ <div className="flex items-center gap-1.5">
+ <span className="text-[11px] font-semibold text-[#e5e5e5]">
+ Update Available
+ </span>
+ <span className="px-1.5 py-0.5 rounded bg-[#161616] font-mono text-[10px] text-[var(--accent)]">
+ v{availableVersion}
+ </span>
+ </div>
+ <div className="text-[10px] text-[#8a8a8a] mt-0.5">
+ A new version of Ink Studio is ready to install
+ </div>
+ </div>
+
+ <div className="flex items-center gap-1.5 pl-1 shrink-0">
+ <button
+ type="button"
+ onClick={() => updaterService.openUpdateModal()}
+ className="flex items-center gap-1 rounded bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 px-2.5 py-1.5 text-[11px] font-medium transition-opacity cursor-pointer"
+ >
+ <span>View &amp; Install</span>
+ <ArrowRight className="w-3 h-3" />
+ </button>
+
+ <button
+ type="button"
+ onClick={() => updaterService.dismissBanner()}
+ className="w-6 h-6 rounded flex items-center justify-center text-[#8a8a8a] hover:bg-[#2c2c2c] hover:text-[#e5e5e5] transition-colors cursor-pointer"
+ title="Dismiss notification"
+ aria-label="Dismiss update notification"
+ >
+ <X className="w-3.5 h-3.5" />
+ </button>
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/src/components/WebLandingModal.tsx b/src/components/WebLandingModal.tsx
index 1e70c2d..1a1d5d4 100644
--- a/src/components/WebLandingModal.tsx
+++ b/src/components/WebLandingModal.tsx
@@ -1,17 +1,20 @@
import React, { useState } from 'react';
-import { Users, Globe, Monitor, ArrowRight, X } from 'lucide-react';
+import { Users, Globe, Monitor, ArrowRight, User, X } from 'lucide-react';
import { isTauriEnvironment } from '../hooks/useMultiplayer';
+import { ParsedInviteLink } from '../services/multiplayerService';
import { safeLocalStorageSetItem } from '../utils/safeStorage';
interface WebLandingModalProps {
- invite: {
- roomName: string;
- host: string;
- port: number;
- url: string;
- token?: string;
- } | null;
- onJoinInBrowser: (name: string, host: string, port: number, roomName: string, token?: string) => void;
+ invite: ParsedInviteLink | null;
+ onJoinInBrowser: (
+ name: string,
+ host: string,
+ port: number,
+ roomName: string,
+ token?: string,
+ isSecure?: boolean,
+ persistName?: boolean
+ ) => void;
onDismiss: () => void;
}
@@ -21,7 +24,14 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
onDismiss,
}) => {
const [userName, setUserName] = useState(() => {
- return (typeof window !== 'undefined' && localStorage.getItem('sora_paint_nickname')) || 'Guest';
+ if (typeof window === 'undefined') return '';
+ try {
+ const customized = localStorage.getItem('ink_nickname_customized') === '1';
+ const saved = (localStorage.getItem('sora_paint_nickname') || '').trim();
+ return customized && saved && saved !== 'Guest' ? saved : '';
+ } catch {
+ return '';
+ }
});
const isTauri = isTauriEnvironment();
@@ -29,16 +39,42 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
if (!invite || isTauri) return null;
const handleOpenInApp = () => {
- // Attempt deep link protocol
const tokenPart = invite.token ? `&token=${encodeURIComponent(invite.token)}` : '';
- const deepLink = `forsora://join?host=${encodeURIComponent(invite.host)}&port=${invite.port}&room=${encodeURIComponent(invite.roomName)}${tokenPart}`;
+ const protoPart = invite.isSecure ? '&protocol=https' : '';
+ const deepLink = `forsora://join?host=${encodeURIComponent(invite.host)}&port=${invite.port}&room=${encodeURIComponent(invite.roomName)}${tokenPart}${protoPart}`;
window.location.href = deepLink;
};
- const handleJoinBrowser = () => {
- const finalName = userName.trim() || 'Guest';
- safeLocalStorageSetItem('sora_paint_nickname', finalName, 'artist name');
- onJoinInBrowser(finalName, invite.host, invite.port, invite.roomName, invite.token);
+ const handleJoinWithNickname = (e?: React.FormEvent) => {
+ e?.preventDefault();
+ const trimmed = userName.trim();
+ if (!trimmed) {
+ handlePlayAsGuest();
+ return;
+ }
+ safeLocalStorageSetItem('sora_paint_nickname', trimmed, 'artist name');
+ safeLocalStorageSetItem('ink_nickname_customized', '1', 'artist name flag');
+ onJoinInBrowser(
+ trimmed,
+ invite.host,
+ invite.port,
+ invite.roomName,
+ invite.token,
+ invite.isSecure,
+ true
+ );
+ };
+
+ const handlePlayAsGuest = () => {
+ onJoinInBrowser(
+ 'Guest',
+ invite.host,
+ invite.port,
+ invite.roomName,
+ invite.token,
+ invite.isSecure,
+ false
+ );
};
return (
@@ -67,47 +103,69 @@ export const WebLandingModal: React.FC<WebLandingModalProps> = ({
<div className="text-[11px] font-medium text-[#99999e]">Connecting to canvas:</div>
<div className="text-xs font-semibold text-[#f0f0f4]">"{invite.roomName}"</div>
<div className="text-[10px] text-[#808085] font-mono">
- Host: {invite.host}{invite.port && invite.port !== 443 && invite.port !== 80 ? `:${invite.port}` : ''}
+ Host: {invite.host}
+ {invite.port && invite.port !== 443 && invite.port !== 80 ? `:${invite.port}` : ''}
</div>
</div>
- {/* Name input */}
- <div className="mb-4 space-y-1">
- <label className="block text-xs font-medium text-[#cccccc]">
- Artist Nickname:
- </label>
- <input
- type="text"
- value={userName}
- onChange={(e) => setUserName(e.target.value)}
- placeholder="Artist..."
- className="w-full rounded-[2px] border border-[#1e1e20] bg-[#2b2b2e] px-2.5 py-1.5 text-xs text-[#f0f0f4] placeholder-[#707075] outline-none focus:border-[#4a8fc7] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.5)]"
- />
- </div>
+ <form onSubmit={handleJoinWithNickname} className="space-y-4">
+ {/* Name input */}
+ <div className="space-y-1">
+ <label className="block text-xs font-medium text-[#cccccc]">
+ Choose a Nickname (optional):
+ </label>
+ <input
+ type="text"
+ autoFocus
+ maxLength={40}
+ value={userName}
+ onChange={(e) => setUserName(e.target.value)}
+ placeholder="Enter nickname..."
+ className="w-full rounded-[2px] border border-[#1e1e20] bg-[#2b2b2e] px-2.5 py-1.5 text-xs text-[#f0f0f4] placeholder-[#707075] outline-none focus:border-[#4a8fc7] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.5)]"
+ />
+ </div>
- {/* Action Buttons */}
- <div className="space-y-2">
- <button
- onClick={handleJoinBrowser}
- className="w-full flex items-center justify-between rounded-[2px] border border-[#242426] bg-gradient-to-b from-[#56565a] to-[#424245] hover:from-[#626266] hover:to-[#4b4b4e] px-3.5 py-2 text-xs font-medium text-[#f0f0f4] transition-colors shadow-[inset_0_1px_0_rgba(255,255,255,0.18),0_1px_1px_rgba(0,0,0,0.3)] cursor-pointer"
- >
- <div className="flex items-center space-x-2">
- <Globe className="w-3.5 h-3.5 text-[#93c5fd]" />
- <span>Connect in Web Browser</span>
- </div>
- <ArrowRight className="w-3.5 h-3.5" />
- </button>
+ {/* Action Buttons */}
+ <div className="space-y-2">
+ <button
+ type="submit"
+ className="w-full flex items-center justify-between rounded-[2px] border border-[#242426] bg-gradient-to-b from-[#56565a] to-[#424245] hover:from-[#626266] hover:to-[#4b4b4e] px-3.5 py-2 text-xs font-medium text-[#f0f0f4] transition-colors shadow-[inset_0_1px_0_rgba(255,255,255,0.18),0_1px_1px_rgba(0,0,0,0.3)] cursor-pointer"
+ >
+ <div className="flex items-center space-x-2">
+ <Globe className="w-3.5 h-3.5 text-[#93c5fd]" />
+ <span>
+ {userName.trim()
+ ? `Join as "${userName.trim()}"`
+ : 'Join in Browser'}
+ </span>
+ </div>
+ <ArrowRight className="w-3.5 h-3.5" />
+ </button>
- <button
- onClick={handleOpenInApp}
- className="w-full flex items-center justify-between rounded-[2px] border border-[#242426] bg-gradient-to-b from-[#48484c] to-[#38383b] hover:from-[#525256] hover:to-[#404043] px-3.5 py-2 text-xs font-medium text-[#d0d0d5] transition-colors shadow-[inset_0_1px_0_rgba(255,255,255,0.12)] cursor-pointer"
- >
- <div className="flex items-center space-x-2">
- <Monitor className="w-3.5 h-3.5 text-emerald-400" />
- <span>Launch Desktop Client (.exe)</span>
- </div>
- </button>
- </div>
+ <button
+ type="button"
+ onClick={handlePlayAsGuest}
+ className="w-full flex items-center justify-between rounded-[2px] border border-[#242426] bg-[#363639] hover:bg-[#404044] px-3.5 py-2 text-xs font-medium text-[#d6d6da] transition-colors cursor-pointer"
+ >
+ <div className="flex items-center space-x-2">
+ <User className="w-3.5 h-3.5 text-[#aaaaaa]" />
+ <span>Play as Guest</span>
+ </div>
+ <ArrowRight className="w-3.5 h-3.5 opacity-70" />
+ </button>
+
+ <button
+ type="button"
+ onClick={handleOpenInApp}
+ className="w-full flex items-center justify-between rounded-[2px] border border-[#242426] bg-gradient-to-b from-[#48484c] to-[#38383b] hover:from-[#525256] hover:to-[#404043] px-3.5 py-2 text-xs font-medium text-[#d0d0d5] transition-colors shadow-[inset_0_1px_0_rgba(255,255,255,0.12)] cursor-pointer"
+ >
+ <div className="flex items-center space-x-2">
+ <Monitor className="w-3.5 h-3.5 text-emerald-400" />
+ <span>Launch Desktop Client (.exe)</span>
+ </div>
+ </button>
+ </div>
+ </form>
<div className="mt-3.5 text-center">
<span className="text-[10px] text-[#808085]">
diff --git a/src/hooks/drawing/useBrushStrokeSession.ts b/src/hooks/drawing/useBrushStrokeSession.ts
index 9c0d2b0..3a6dbf8 100644
--- a/src/hooks/drawing/useBrushStrokeSession.ts
+++ b/src/hooks/drawing/useBrushStrokeSession.ts
@@ -2410,6 +2410,7 @@ export function useBrushStrokeSession({
);
if (clampedBakeRect) {
+ const strokeIdForHistory = currentStrokeIdRef.current || undefined;
const { x: sx, y: sy, width: dw, height: dh } = clampedBakeRect;
let label = 'Brush Stroke';
if (bs.isTransparentInk) {
@@ -2519,7 +2520,7 @@ export function useBrushStrokeSession({
undefined,
undefined,
undefined,
- undefined,
+ strokeIdForHistory,
true
);
});
@@ -2634,7 +2635,10 @@ export function useBrushStrokeSession({
null,
currentLayerId,
dirtyRect,
- tileDeltas
+ tileDeltas,
+ undefined,
+ undefined,
+ strokeIdForHistory
);
});
} else {
@@ -2830,7 +2834,10 @@ export function useBrushStrokeSession({
null,
currentLayerId,
dirtyRect,
- tileDeltas
+ tileDeltas,
+ undefined,
+ undefined,
+ strokeIdForHistory
);
});
};
@@ -2933,7 +2940,10 @@ export function useBrushStrokeSession({
null,
currentLayerId,
dirtyRect,
- tileDeltas
+ tileDeltas,
+ undefined,
+ undefined,
+ strokeIdForHistory
);
});
};
@@ -3097,7 +3107,10 @@ export function useBrushStrokeSession({
null,
currentLayerId,
dirtyRect,
- tileDeltas
+ tileDeltas,
+ undefined,
+ undefined,
+ strokeIdForHistory
);
});
};
diff --git a/src/hooks/drawing/useDrawingHistory.ts b/src/hooks/drawing/useDrawingHistory.ts
index e8f361a..b24070a 100644
--- a/src/hooks/drawing/useDrawingHistory.ts
+++ b/src/hooks/drawing/useDrawingHistory.ts
@@ -47,6 +47,12 @@ export interface UseDrawingHistoryParams {
abortActiveStrokeRef: React.MutableRefObject<() => void>;
}
+export interface SelectiveUndoResult {
+ strokeId?: string;
+ layerId: string;
+ tileDeltas?: TileDelta[];
+}
+
export interface UseDrawingHistoryResult {
activeSessionIdRef: React.MutableRefObject<string | null>;
activeTileGridRef: React.MutableRefObject<SparseTileGrid>;
@@ -61,7 +67,10 @@ export interface UseDrawingHistoryResult {
jumpToHistoryIndex: (targetIndex: number) => Promise<void>;
undo: () => void;
redo: () => void;
- selectiveUndo: (peerIdToUndo?: string | number) => Promise<void>;
+ selectiveUndo: (
+ peerIdToUndo?: string | number,
+ strokeIdToUndo?: string
+ ) => Promise<SelectiveUndoResult | null>;
clearCanvas: () => void;
resetHistory: (targetDocumentId?: string) => void;
}
@@ -193,6 +202,7 @@ export function useDrawingHistory({
strokeId?: string,
isMaskEdit?: boolean
) => {
+ ensureInitialHistory();
const now = Date.now();
const dims = dimensionsRef.current;
const grid = activeTileGridRef.current;
@@ -315,7 +325,7 @@ export function useDrawingHistory({
recoveryService.logStrokeDelta(sessionKey, tileDeltas, vectorDelta, targetLayerId);
}
},
- [colorModeRef, dimensionsRef, layersRef, persistSessionHistory, syncHistoryState]
+ [colorModeRef, dimensionsRef, ensureInitialHistory, layersRef, persistSessionHistory, syncHistoryState]
);
const pendingHistoryTasksRef = useRef<Array<() => void>>([]);
@@ -712,92 +722,170 @@ export function useDrawingHistory({
}, [abortActiveStrokeRef, flushPendingHistoryTasks, isDrawingRef, jumpToHistoryIndex]);
const selectiveUndo = useCallback(
- async (peerIdToUndo?: string | number) => {
+ (
+ peerIdToUndo?: string | number,
+ strokeIdToUndo?: string
+ ): Promise<SelectiveUndoResult | null> => {
flushPendingHistoryTasks();
if (isDrawingRef.current) {
abortActiveStrokeRef.current();
}
- const history = historyRef.current;
- const currIdx = historyIndexRef.current;
- if (currIdx < 0 || history.length === 0) return;
-
- let targetItemIdx = -1;
- for (let i = currIdx; i >= 0; i--) {
- const item = history[i];
- if (
- !peerIdToUndo ||
- item.peerId === peerIdToUndo ||
- (peerIdToUndo === 'local' && !item.peerId)
- ) {
- targetItemIdx = i;
- break;
+ let result: SelectiveUndoResult | null = null;
+ const nextOp = historyQueueRef.current.then(async () => {
+ const history = historyRef.current;
+ const currIdx = historyIndexRef.current;
+ if (currIdx <= 0 || history.length <= 1) return;
+
+ let targetItemIdx = -1;
+
+ // 1. Exact strokeId match when provided (reliable collaborative selective undo)
+ if (strokeIdToUndo) {
+ for (let i = currIdx; i >= 1; i--) {
+ const item = history[i];
+ if (item.type !== 'initial' && item.strokeId === strokeIdToUndo) {
+ targetItemIdx = i;
+ break;
+ }
+ }
}
- }
- if (targetItemIdx === -1) return;
+ // 2. Fallback to most recent matching peerId (or local actions where item.peerId is unset)
+ if (targetItemIdx === -1) {
+ for (let i = currIdx; i >= 1; i--) {
+ const item = history[i];
+ if (item.type === 'initial') continue;
+ if (
+ !peerIdToUndo ||
+ item.peerId === peerIdToUndo ||
+ (peerIdToUndo === 'local' && (!item.peerId || item.peerId === 'local'))
+ ) {
+ targetItemIdx = i;
+ break;
+ }
+ }
+ }
- const item = history[targetItemIdx];
- const targetLayerId = item.layerId || activeLayerId;
- const canvas = layerCanvasesRef.current.get(targetLayerId) || null;
- const targetLayer = layersRef.current?.find((l) => l.id === targetLayerId);
- const grid = activeTileGridRef.current;
- const undoCache = activeUndoCacheRef.current;
- const dims = dimensionsRef.current;
+ if (targetItemIdx === -1) return;
- if (item.vectorStrokesDelta && targetLayer) {
- targetLayer.vectorStrokes = item.vectorStrokesDelta.before;
- const tempVec = canvas || document.createElement('canvas');
- if (!canvas) {
- tempVec.width = dims.width;
- tempVec.height = dims.height;
- }
- const cCtx = get2DContext(tempVec);
- if (cCtx) {
- cCtx.clearRect(0, 0, tempVec.width, tempVec.height);
- renderVectorLayer(cCtx, targetLayer.vectorStrokes);
- const isMono = targetLayer.expressionColor === 'monochrome';
- grid.clearLayer(targetLayerId);
- grid.ingestCanvas(targetLayerId, tempVec, isMono ? 'monochrome-1bit' : 'color-32bit');
- }
- if (!canvas) releaseTemporaryCanvas(tempVec);
- } else {
- const deltas = await undoCache.resolveDeltas(item);
- if (deltas && deltas.length > 0) {
- grid.applyTileDeltas(deltas, 'undo');
- if (canvas) {
- grid.renderLayerToCanvas(targetLayerId, canvas, item.dirtyRect);
+ const item = history[targetItemIdx];
+ const targetLayerId = item.layerId || activeLayerId;
+ const canvas = layerCanvasesRef.current.get(targetLayerId) || null;
+ const sourceCanvas = layerSourceCanvasesRef?.current?.get(targetLayerId);
+ const targetLayer = layersRef.current?.find((l) => l.id === targetLayerId);
+ const isToneStep = Boolean(targetLayer?.toneEnabled && sourceCanvas);
+ const grid = activeTileGridRef.current;
+ const undoCache = activeUndoCacheRef.current;
+ const dims = dimensionsRef.current;
+ let resolvedDeltas: TileDelta[] | null = null;
+
+ if (item.isMaskEdit && targetLayer?.maskCanvas) {
+ const mCtx = get2DContext(targetLayer.maskCanvas);
+ if (mCtx && item.beforeImageData) {
+ const mx =
+ item.dirtyRect && item.beforeImageData.width === item.dirtyRect.width
+ ? item.dirtyRect.x
+ : 0;
+ const my =
+ item.dirtyRect && item.beforeImageData.height === item.dirtyRect.height
+ ? item.dirtyRect.y
+ : 0;
+ mCtx.putImageData(item.beforeImageData, mx, my);
+ targetLayer.maskVersion = (targetLayer.maskVersion || 0) + 1;
+ onUpdateMaskThumbnailRef.current?.(targetLayerId);
}
- } else if (item.beforeImageData) {
- const isMono =
- !isBackgroundLayerId(targetLayerId) &&
- (targetLayer?.expressionColor === 'monochrome' ||
- colorModeRef.current === 'monochrome');
- const bx = item.dirtyRect ? item.dirtyRect.x : 0;
- const by = item.dirtyRect ? item.dirtyRect.y : 0;
- grid.writeImageData(
- targetLayerId,
- item.beforeImageData,
- bx,
- by,
- isMono ? 'monochrome-1bit' : 'color-32bit'
- );
- if (canvas) {
- grid.renderLayerToCanvas(targetLayerId, canvas, item.dirtyRect);
+ } else if (item.vectorStrokesDelta && targetLayer) {
+ targetLayer.vectorStrokes = item.vectorStrokesDelta.before;
+ const tempVec = canvas || document.createElement('canvas');
+ if (!canvas) {
+ tempVec.width = dims.width;
+ tempVec.height = dims.height;
+ }
+ const cCtx = get2DContext(tempVec);
+ if (cCtx) {
+ cCtx.clearRect(0, 0, tempVec.width, tempVec.height);
+ renderVectorLayer(cCtx, targetLayer.vectorStrokes);
+ const isMono = targetLayer.expressionColor === 'monochrome';
+ grid.clearLayer(targetLayerId);
+ grid.ingestCanvas(targetLayerId, tempVec, isMono ? 'monochrome-1bit' : 'color-32bit');
+ }
+ if (!canvas) releaseTemporaryCanvas(tempVec);
+ } else {
+ resolvedDeltas = await undoCache.resolveDeltas(item);
+ if (resolvedDeltas && resolvedDeltas.length > 0) {
+ grid.applyTileDeltas(resolvedDeltas, 'undo');
+ if (isToneStep && sourceCanvas) {
+ grid.renderLayerToCanvas(targetLayerId, sourceCanvas, item.dirtyRect);
+ if (canvas && targetLayer) {
+ applyLayerEffects(
+ sourceCanvas,
+ canvas,
+ targetLayer,
+ dimensionsRef.current.dpi ?? 600,
+ item.dirtyRect
+ );
+ }
+ } else if (canvas) {
+ grid.renderLayerToCanvas(targetLayerId, canvas, item.dirtyRect);
+ if (sourceCanvas) {
+ grid.renderLayerToCanvas(targetLayerId, sourceCanvas, item.dirtyRect);
+ }
+ }
+ } else if (item.beforeImageData) {
+ const isMono =
+ !isBackgroundLayerId(targetLayerId) &&
+ (targetLayer?.expressionColor === 'monochrome' ||
+ colorModeRef.current === 'monochrome');
+ const bx =
+ item.dirtyRect &&
+ item.beforeImageData.width === item.dirtyRect.width &&
+ item.beforeImageData.height === item.dirtyRect.height
+ ? item.dirtyRect.x
+ : 0;
+ const by =
+ item.dirtyRect &&
+ item.beforeImageData.width === item.dirtyRect.width &&
+ item.beforeImageData.height === item.dirtyRect.height
+ ? item.dirtyRect.y
+ : 0;
+ grid.writeImageData(
+ targetLayerId,
+ item.beforeImageData,
+ bx,
+ by,
+ isMono ? 'monochrome-1bit' : 'color-32bit'
+ );
+ if (canvas) {
+ grid.renderLayerToCanvas(targetLayerId, canvas, item.dirtyRect);
+ }
+ if (sourceCanvas) {
+ grid.renderLayerToCanvas(targetLayerId, sourceCanvas, item.dirtyRect);
+ }
}
}
- }
- historyRef.current.splice(targetItemIdx, 1);
- historyIndexRef.current = Math.min(
- historyIndexRef.current - 1,
- historyRef.current.length - 1
- );
- persistSessionHistory();
- syncHistoryState();
+ historyRef.current.splice(targetItemIdx, 1);
+ historyIndexRef.current = Math.max(
+ 0,
+ Math.min(historyIndexRef.current - 1, historyRef.current.length - 1)
+ );
+ persistSessionHistory();
+ syncHistoryState();
+
+ onUpdateLayerThumbnail(targetLayerId);
+ grid.notifyChange(true);
- onUpdateLayerThumbnail(targetLayerId);
- grid.notifyChange(true);
+ result = {
+ strokeId: item.strokeId,
+ layerId: targetLayerId,
+ tileDeltas: resolvedDeltas ?? undefined,
+ };
+ });
+
+ historyQueueRef.current = nextOp.catch((err) => {
+ console.warn('[History] Error during selectiveUndo:', err);
+ });
+ return historyQueueRef.current.then(() => result);
},
[
abortActiveStrokeRef,
@@ -807,8 +895,10 @@ export function useDrawingHistory({
flushPendingHistoryTasks,
isDrawingRef,
layerCanvasesRef,
+ layerSourceCanvasesRef,
layersRef,
onUpdateLayerThumbnail,
+ onUpdateMaskThumbnailRef,
persistSessionHistory,
syncHistoryState,
]
diff --git a/src/hooks/useAppMenuSections.tsx b/src/hooks/useAppMenuSections.tsx
index 71c5400..7c4c5c9 100644
--- a/src/hooks/useAppMenuSections.tsx
+++ b/src/hooks/useAppMenuSections.tsx
@@ -37,6 +37,9 @@ import {
WorkspacePresetId,
} from '../types/workspace';
import { listVisiblePanelIds } from '../utils/workspacePresets';
+import { isTauriEnvironment } from './useMultiplayer';
+import { updaterService } from '../services/updaterService';
+import { useUpdaterStore } from '../stores/useUpdaterStore';
export interface UseAppMenuSectionsParams {
hasOpenDocument: boolean;
@@ -1277,6 +1280,22 @@ export function useAppMenuSections(params: UseAppMenuSectionsParams): MenuSectio
id: 'help',
label: 'Help',
items: [
+ ...(isTauriEnvironment()
+ ? [
+ {
+ id: 'help-check-updates',
+ label: 'Check for Updates...',
+ onClick: () => {
+ updaterService.openUpdateModal();
+ const st = useUpdaterStore.getState().status;
+ if (st !== 'downloading' && st !== 'ready') {
+ void updaterService.checkForUpdates({ silent: false });
+ }
+ },
+ },
+ { id: 'help-div-1', label: '', divider: true },
+ ]
+ : []),
{
id: 'help-about',
label: 'About Ink Studio',
diff --git a/src/hooks/useCollabSync.ts b/src/hooks/useCollabSync.ts
index a86b621..a08a1f8 100644
--- a/src/hooks/useCollabSync.ts
+++ b/src/hooks/useCollabSync.ts
@@ -30,7 +30,8 @@ import {
import { drawPencilBezierSegment, drawPencilDot, PencilGrade } from '../utils/pencilEngine';
import { renderVectorStroke } from '../utils/vectorEngine';
import { documentStore } from '../utils/documentStore';
-import { documentStoreActions } from '../stores';
+import { documentStoreActions, uiStoreActions } from '../stores';
+import { PushHistoryStepFn } from './drawing/types';
interface LayerActionMessageBase {
type: string;
@@ -50,7 +51,12 @@ export interface UseCollabSyncParams {
activeLayerId: string;
selectedLayerIds: string[];
layerCanvasesRef: React.MutableRefObject<Map<string, HTMLCanvasElement>>;
- selectiveUndoRef: React.MutableRefObject<(peerId?: string | number) => void>;
+ materializeLayerCanvas: (id: string) => HTMLCanvasElement | null;
+ pushHistoryStepRef: React.MutableRefObject<PushHistoryStepFn | null>;
+ selectiveUndoRef: React.MutableRefObject<
+ (peerId?: string | number, strokeId?: string) => unknown
+ >;
+ resetZoomAndCenter: (dims?: CanvasDimensions) => void;
setActiveLayerId: (id: string) => void;
addLayer: (
type?: 'raster' | 'folder' | 'vector',
@@ -64,7 +70,13 @@ export interface UseCollabSyncParams {
deleteRemoteLayer: (id: string) => void;
deleteSelectedLayers: () => void;
groupSelectedLayers: () => void;
- syncRemoteDocument: (layers: LayerItem[], dataUrls: Record<string, string>) => void;
+ syncRemoteDocument: (
+ layers: LayerItem[],
+ dataUrls: Record<string, string>,
+ assignedLayerId?: string,
+ targetDocumentId?: string,
+ syncDims?: CanvasDimensions
+ ) => void;
renameLayer: (id: string, newName: string) => void;
toggleVisibility: (id: string) => void;
setOpacity: (id: string, opacity: number) => void;
@@ -81,7 +93,10 @@ export function useCollabSync({
activeLayerId,
selectedLayerIds,
layerCanvasesRef,
+ materializeLayerCanvas,
+ pushHistoryStepRef,
selectiveUndoRef,
+ resetZoomAndCenter,
setActiveLayerId,
addLayer,
addRemoteLayer,
@@ -98,6 +113,7 @@ export function useCollabSync({
showToast,
}: UseCollabSyncParams) {
const remoteDraftCanvasesRef = useRef<Map<string | number, HTMLCanvasElement>>(new Map());
+ const pendingAssignedLayerIdRef = useRef<string | undefined>(undefined);
const remoteStrokeStatesRef = useRef<
Map<
string,
@@ -284,16 +300,21 @@ export function useCollabSync({
strokeState.points.push(msg.endPoint);
}
- let targetCanvas = layerCanvasesRef.current.get(msg.layerId);
let targetLayerId = msg.layerId;
+ let targetCanvas =
+ layerCanvasesRef.current.get(targetLayerId) ??
+ (layersRef.current.some((l) => l.id === targetLayerId)
+ ? materializeLayerCanvas(targetLayerId)
+ : null);
if (!targetCanvas) {
const byPeerId = layersRef.current.find(
(l) => l.type === 'raster' && l.id.includes(String(msg.peerId))
);
if (byPeerId) {
- targetCanvas = layerCanvasesRef.current.get(byPeerId.id);
targetLayerId = byPeerId.id;
+ targetCanvas =
+ layerCanvasesRef.current.get(byPeerId.id) ?? materializeLayerCanvas(byPeerId.id);
}
}
@@ -303,28 +324,42 @@ export function useCollabSync({
(l) => l.type === 'raster' && l.id !== 'layer-bg' && !l.id.startsWith('layer-bg')
) || layersRef.current.find((l) => l.type === 'raster');
if (fallback) {
- targetCanvas = layerCanvasesRef.current.get(fallback.id);
targetLayerId = fallback.id;
+ targetCanvas =
+ layerCanvasesRef.current.get(fallback.id) ?? materializeLayerCanvas(fallback.id);
}
}
if (targetCanvas && strokeState.points.length > 0) {
+ const activeGrid = documentStore.getActiveTileGrid();
const targetLayer = layersRef.current.find((l) => l.id === targetLayerId);
const isMono =
colorMode === 'monochrome' || targetLayer?.expressionColor === 'monochrome';
const targetFormat = isMono ? 'monochrome-1bit' : 'color-32bit';
if (msg.vectorStroke && targetLayer?.type === 'vector') {
- targetLayer.vectorStrokes = [...(targetLayer.vectorStrokes || []), msg.vectorStroke];
+ const beforeStrokes = [...(targetLayer.vectorStrokes || [])];
+ const afterStrokes = [...beforeStrokes, msg.vectorStroke];
+ targetLayer.vectorStrokes = afterStrokes;
const ctx = get2DContext(targetCanvas);
if (ctx) {
renderVectorStroke(ctx, msg.vectorStroke);
const fullData = ctx.getImageData(0, 0, targetCanvas.width, targetCanvas.height);
- documentStore
- .getActiveTileGrid()
- .writeImageData(targetLayerId, fullData, 0, 0, targetFormat);
+ activeGrid.writeImageData(targetLayerId, fullData, 0, 0, targetFormat);
}
- documentStore.getActiveTileGrid().notifyChange(true);
+ pushHistoryStepRef.current?.(
+ 'brush',
+ 'Remote Vector Stroke',
+ null,
+ null,
+ targetLayerId,
+ undefined,
+ undefined,
+ { before: beforeStrokes, after: afterStrokes },
+ msg.peerId,
+ msg.strokeId
+ );
+ activeGrid.notifyChange(true);
updateLayerThumbnail(targetLayerId, true);
} else {
const ctx = get2DContext(targetCanvas);
@@ -337,6 +372,48 @@ export function useCollabSync({
const isAlphaLocked = Boolean(targetLayer?.alphaLocked);
const isTransparentInk = Boolean(bs.isTransparentInk);
+ const pad = Math.ceil(Math.max(32, (bs.size || 10) * 1.5));
+ let dirtyX = 0;
+ let dirtyY = 0;
+ let dirtyW = targetCanvas.width;
+ let dirtyH = targetCanvas.height;
+
+ if (msg.dirtyRect) {
+ dirtyX = Math.max(0, Math.floor(msg.dirtyRect.x));
+ dirtyY = Math.max(0, Math.floor(msg.dirtyRect.y));
+ dirtyW = Math.min(targetCanvas.width - dirtyX, Math.ceil(msg.dirtyRect.width));
+ dirtyH = Math.min(targetCanvas.height - dirtyY, Math.ceil(msg.dirtyRect.height));
+ } else if (strokeState.points.length > 0) {
+ let minX = Infinity;
+ let minY = Infinity;
+ let maxX = -Infinity;
+ let maxY = -Infinity;
+ for (const pt of strokeState.points) {
+ if (pt.x < minX) minX = pt.x;
+ if (pt.y < minY) minY = pt.y;
+ if (pt.x > maxX) maxX = pt.x;
+ if (pt.y > maxY) maxY = pt.y;
+ }
+ dirtyX = Math.max(0, Math.floor(minX - pad));
+ dirtyY = Math.max(0, Math.floor(minY - pad));
+ dirtyW = Math.min(targetCanvas.width - dirtyX, Math.ceil(maxX + pad) - dirtyX);
+ dirtyH = Math.min(targetCanvas.height - dirtyY, Math.ceil(maxY + pad) - dirtyY);
+ }
+
+ const dirtyRect =
+ dirtyW > 0 && dirtyH > 0
+ ? { x: dirtyX, y: dirtyY, width: dirtyW, height: dirtyH }
+ : undefined;
+
+ // Keep display canvas synced with authoritative grid before baking remote stroke
+ if (dirtyRect && activeGrid.hasLayerTiles(targetLayerId)) {
+ activeGrid.renderLayerToCanvas(targetLayerId, targetCanvas, dirtyRect);
+ }
+
+ const beforeSnapshot = dirtyRect
+ ? activeGrid.snapshotTilesInRect(targetLayerId, dirtyRect)
+ : null;
+
if (isTranslucentBrush || isTransparentInk || isAlphaLocked) {
const bakeCanvas = getReusableBakeCanvas(targetCanvas.width, targetCanvas.height);
const bCtx = get2DContext(bakeCanvas);
@@ -377,42 +454,33 @@ export function useCollabSync({
);
}
- const pad = Math.ceil(Math.max(32, (bs.size || 10) * 1.5));
- let dirtyX = 0;
- let dirtyY = 0;
- let dirtyW = targetCanvas.width;
- let dirtyH = targetCanvas.height;
-
- if (msg.dirtyRect) {
- dirtyX = Math.max(0, Math.floor(msg.dirtyRect.x));
- dirtyY = Math.max(0, Math.floor(msg.dirtyRect.y));
- dirtyW = Math.min(targetCanvas.width - dirtyX, Math.ceil(msg.dirtyRect.width));
- dirtyH = Math.min(targetCanvas.height - dirtyY, Math.ceil(msg.dirtyRect.height));
- } else if (strokeState.points.length > 0) {
- let minX = Infinity;
- let minY = Infinity;
- let maxX = -Infinity;
- let maxY = -Infinity;
- for (const pt of strokeState.points) {
- if (pt.x < minX) minX = pt.x;
- if (pt.y < minY) minY = pt.y;
- if (pt.x > maxX) maxX = pt.x;
- if (pt.y > maxY) maxY = pt.y;
- }
- dirtyX = Math.max(0, Math.floor(minX - pad));
- dirtyY = Math.max(0, Math.floor(minY - pad));
- dirtyW = Math.min(targetCanvas.width - dirtyX, Math.ceil(maxX + pad) - dirtyX);
- dirtyH = Math.min(targetCanvas.height - dirtyY, Math.ceil(maxY + pad) - dirtyY);
- }
-
- if (dirtyW > 0 && dirtyH > 0) {
+ if (dirtyRect) {
const afterData = ctx.getImageData(dirtyX, dirtyY, dirtyW, dirtyH);
- documentStore
- .getActiveTileGrid()
- .writeImageData(targetLayerId, afterData, dirtyX, dirtyY, targetFormat);
+ activeGrid.writeImageData(targetLayerId, afterData, dirtyX, dirtyY, targetFormat);
+ if (beforeSnapshot) {
+ const tileDeltas = activeGrid.computeDeltasFromSnapshot(
+ beforeSnapshot,
+ targetLayerId,
+ dirtyRect
+ );
+ if (tileDeltas.length > 0) {
+ pushHistoryStepRef.current?.(
+ isEraser ? 'eraser' : 'brush',
+ isEraser ? 'Remote Eraser' : 'Remote Brush',
+ null,
+ null,
+ targetLayerId,
+ dirtyRect,
+ tileDeltas,
+ undefined,
+ msg.peerId,
+ msg.strokeId
+ );
+ }
+ }
}
- documentStore.getActiveTileGrid().notifyChange(true);
+ activeGrid.notifyChange(true);
updateLayerThumbnail(targetLayerId, true);
}
}
@@ -428,7 +496,7 @@ export function useCollabSync({
remoteStrokeStatesRef.current.delete(msg.strokeId);
},
- [colorMode, layerCanvasesRef, updateLayerThumbnail]
+ [colorMode, layerCanvasesRef, materializeLayerCanvas, pushHistoryStepRef, updateLayerThumbnail]
);
const handleRemoteDocSync = useCallback(
@@ -436,31 +504,55 @@ export function useCollabSync({
syncDims: CanvasDimensions,
syncMode: CanvasColorMode,
syncLayers: LayerItem[],
- syncDataUrls: Record<string, string>
+ syncDataUrls: Record<string, string>,
+ assignedLayerId?: string,
+ roomName?: string
) => {
+ const newDocId = `doc-collab-${Date.now()}`;
+ const effectiveAssignedId = assignedLayerId || pendingAssignedLayerIdRef.current;
+ pendingAssignedLayerIdRef.current = undefined;
+
+ const resolvedActiveLayerId =
+ effectiveAssignedId && syncLayers.some((l) => l.id === effectiveAssignedId)
+ ? effectiveAssignedId
+ : syncLayers.find(
+ (l) => l.type === 'raster' && l.id !== 'layer-bg' && !l.id.startsWith('layer-bg')
+ )?.id ||
+ syncLayers[0]?.id ||
+ 'layer-1';
+
+ const tabName = (roomName || '').trim() || 'Collab Session';
+
+ // Bind new documentStore session BEFORE any BINARY_TILE packets arrive
+ syncRemoteDocument(syncLayers, syncDataUrls, resolvedActiveLayerId, newDocId, syncDims);
+
documentStoreActions.setDimensions(syncDims);
documentStoreActions.setColorMode(syncMode);
- syncRemoteDocument(syncLayers, syncDataUrls);
- const newDocId = `doc-collab-${Date.now()}`;
const newDoc: DocumentTab = {
id: newDocId,
- name: 'Collab Session',
+ name: tabName,
dimensions: syncDims,
colorMode: syncMode,
layers: syncLayers,
- activeLayerId: syncLayers[0]?.id || 'layer-1',
+ activeLayerId: resolvedActiveLayerId,
perspectiveRuler: null,
};
documentStoreActions.setPerspectiveRuler(null);
documentStoreActions.setDocuments([newDoc]);
documentStoreActions.setActiveDocumentId(newDocId);
- documentStoreActions.setDocumentName('Collab Session');
+ documentStoreActions.setDocumentName(tabName);
+ uiStoreActions.setAppView('workspace');
+
+ requestAnimationFrame(() => {
+ resetZoomAndCenter(syncDims);
+ });
},
- [syncRemoteDocument]
+ [resetZoomAndCenter, syncRemoteDocument]
);
const handleRemoteAssignedLayer = useCallback(
(layerId: string) => {
+ pendingAssignedLayerIdRef.current = layerId;
setActiveLayerId(layerId);
},
[setActiveLayerId]
@@ -553,19 +645,25 @@ export function useCollabSync({
onRemoteJoinRequest: handleRemoteJoinRequest,
onRemoteAssignedLayer: handleRemoteAssignedLayer,
onRemoteLayerAction: handleRemoteLayerAction,
- onRemoteSelectiveUndo: (_strokeId, peerId) => {
- selectiveUndoRef.current(peerId);
+ onRemoteSelectiveUndo: (strokeId, peerId) => {
+ selectiveUndoRef.current(peerId, strokeId);
},
showToast,
});
const handleStartHosting = useCallback(
- async (roomName: string, port: number, hostNickname?: string, isGlobal?: boolean) => {
+ async (
+ roomName: string,
+ port: number,
+ hostNickname?: string,
+ isGlobal?: boolean,
+ onStatus?: (status: string) => void
+ ) => {
if (!hasOpenDocument) {
showToast('Please create or open a canvas before hosting a session.');
return false;
}
- const finalHostName = (hostNickname || mp.myPeer.name || 'Sora').trim();
+ const finalHostName = (hostNickname || mp.myPeer.name || 'Artist').trim();
const defaultLayer =
layersRef.current.find((l) => l.id === activeLayerId) ||
layersRef.current.find(
@@ -582,7 +680,7 @@ export function useCollabSync({
);
renameLayer(defaultLayer.id, hostLayerName);
}
- return await mp.startHosting(roomName, port, finalHostName, isGlobal);
+ return await mp.startHosting(roomName, port, finalHostName, isGlobal, onStatus);
},
[hasOpenDocument, showToast, mp.myPeer.name, activeLayerId, renameLayer, mp.startHosting]
);
diff --git a/src/hooks/useLayerManager.ts b/src/hooks/useLayerManager.ts
index fabf814..367eee2 100644
--- a/src/hooks/useLayerManager.ts
+++ b/src/hooks/useLayerManager.ts
@@ -807,17 +807,49 @@ export function useLayerManager({ dimensions: _dimensions, activeSessionId, tile
(
syncedLayers: LayerItem[],
layerDataUrls: Record<string, string>,
- assignedLayerId?: string
+ assignedLayerId?: string,
+ targetDocumentId?: string,
+ syncDims?: CanvasDimensions
) => {
- const grid = activeTileGridRef.current;
+ for (const timer of thumbDebounceTimersRef.current.values()) {
+ clearTimeout(timer);
+ }
+ thumbDebounceTimersRef.current.clear();
+
+ let grid = activeTileGridRef.current;
+ if (targetDocumentId) {
+ const session =
+ documentStore.setActiveDocument(targetDocumentId) ??
+ documentStore.getOrCreateSession(targetDocumentId);
+ activeSessionIdRef.current = targetDocumentId;
+ activeTileGridRef.current = session.tileGrid;
+ layerCanvasesRef.current = session.layerCanvases;
+ layerSourceCanvasesRef.current = session.layerSourceCanvases;
+ grid = session.tileGrid;
+ }
+ if (syncDims) {
+ dimensionsRef.current = syncDims;
+ }
+
+ grid.clearAll();
+ pendingCanvasCopiesRef.current.clear();
+ pendingInitialDataRef.current.clear();
+ for (const c of layerCanvasesRef.current.values()) releaseTemporaryCanvas(c);
+ layerCanvasesRef.current.clear();
+ for (const c of layerSourceCanvasesRef.current.values()) releaseTemporaryCanvas(c);
+ layerSourceCanvasesRef.current.clear();
+
setLayers(syncedLayers);
+ layersRef.current = syncedLayers;
- if (assignedLayerId) {
+ if (assignedLayerId && syncedLayers.some((l) => l.id === assignedLayerId)) {
setActiveLayerId(assignedLayerId);
} else {
const topRaster = syncedLayers.find((l) => l.type === 'raster' && !isBackgroundLayerId(l.id));
if (topRaster) {
setActiveLayerId(topRaster.id);
+ } else if (syncedLayers[0]) {
+ setActiveLayerId(syncedLayers[0].id);
}
}
@@ -850,6 +882,8 @@ export function useLayerManager({ dimensions: _dimensions, activeSessionId, tile
img.src = dataUrl;
}
});
+
+ grid.notifyChange(true);
},
[setActiveLayerId, updateLayerThumbnail]
);
diff --git a/src/hooks/useMultiplayer.ts b/src/hooks/useMultiplayer.ts
index dbbfd6b..dd76ce5 100644
--- a/src/hooks/useMultiplayer.ts
+++ b/src/hooks/useMultiplayer.ts
@@ -12,10 +12,18 @@ import {
TileStreamMessage,
SelectiveUndoMessage,
} from '../types/multiplayer';
-import { multiplayerService } from '../services/multiplayerService';
+import {
+ multiplayerService,
+ ParsedInviteLink,
+ parseInviteUrl,
+} from '../services/multiplayerService';
import { LayerItem, CanvasDimensions, CanvasColorMode } from '../types/editor';
import { TILE_SIZE, TileBuffer } from '../utils/tileEngine';
import { documentStore } from '../utils/documentStore';
+import { uiStoreActions, useUiStore } from '../stores';
+
+const NICKNAME_KEY = 'sora_paint_nickname';
+const NICKNAME_CUSTOMIZED_KEY = 'ink_nickname_customized';
const PEER_COLORS = [
'#f43f5e', // Rose
@@ -34,7 +42,27 @@ function getRandomColor(): string {
export function isTauriEnvironment(): boolean {
if (typeof window === 'undefined') return false;
- return Boolean((window as any).__TAURI_INTERNALS__ || (window as any).__TAURI__ || (window as any).isTauri);
+ return Boolean(
+ (window as any).__TAURI_INTERNALS__ || (window as any).__TAURI__ || (window as any).isTauri
+ );
+}
+
+function getInitialPeerName(): string {
+ if (typeof window === 'undefined') return 'Guest';
+ try {
+ const isCustomized = localStorage.getItem(NICKNAME_CUSTOMIZED_KEY) === '1';
+ const saved = (localStorage.getItem(NICKNAME_KEY) || '').trim();
+ if (isCustomized && saved) {
+ return saved;
+ }
+ if (!isTauriEnvironment()) {
+ return 'Guest';
+ }
+ // Desktop: will be replaced by OS username via get_os_username on mount
+ return 'Artist';
+ } catch {
+ return isTauriEnvironment() ? 'Artist' : 'Guest';
+ }
}
export interface UseMultiplayerProps {
@@ -46,8 +74,17 @@ export interface UseMultiplayerProps {
onRemoteStrokeChunk?: (msg: StrokeChunkMessage) => void;
onRemoteStrokeFinish?: (msg: StrokeFinishMessage) => void;
onRemoteLayerAction?: (msg: MultiplayerMessage) => void;
- onRemoteDocSync?: (dimensions: CanvasDimensions, colorMode: CanvasColorMode, layers: LayerItem[], dataUrls: Record<string, string>) => void;
- onRemoteJoinRequest?: (peer: CollabPeer) => { assignedLayerId: string; updatedLayers: LayerItem[] } | void;
+ onRemoteDocSync?: (
+ dimensions: CanvasDimensions,
+ colorMode: CanvasColorMode,
+ layers: LayerItem[],
+ dataUrls: Record<string, string>,
+ assignedLayerId?: string,
+ roomName?: string
+ ) => void;
+ onRemoteJoinRequest?: (
+ peer: CollabPeer
+ ) => { assignedLayerId: string; updatedLayers: LayerItem[] } | void;
onRemoteAssignedLayer?: (layerId: string) => void;
onRemoteSelectiveUndo?: (strokeId: string, peerId: string | number) => void;
showToast: (msg: string) => void;
@@ -74,37 +111,24 @@ export function useMultiplayer({
const [peers, setPeers] = useState<CollabPeer[]>([]);
const peersRef = useRef<CollabPeer[]>([]);
- const [myPeer, setMyPeer] = useState<CollabPeer>(() => {
- const savedName = (typeof window !== 'undefined' && localStorage.getItem('sora_paint_nickname')) || 'Sora';
- return {
- id: `peer-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`,
- name: savedName,
- color: getRandomColor(),
- };
- });
+ const [myPeer, setMyPeer] = useState<CollabPeer>(() => ({
+ id: `peer-${Date.now()}-${Math.random().toString(36).substring(2, 6)}`,
+ name: getInitialPeerName(),
+ color: getRandomColor(),
+ }));
const myPeerRef = useRef(myPeer);
- const [activePings, setActivePings] = useState<Array<{ id: string; x: number; y: number; color: string; name: string }>>([]);
+ const [activePings, setActivePings] = useState<
+ Array<{ id: string; x: number; y: number; color: string; name: string }>
+ >([]);
const [isHostModalOpen, setIsHostModalOpen] = useState(false);
// Smart Clipboard Invitation Prompt
- const [clipboardInvite, setClipboardInvite] = useState<{
- roomName: string;
- host: string;
- port: number;
- url: string;
- token?: string;
- } | null>(null);
+ const [clipboardInvite, setClipboardInvite] = useState<ParsedInviteLink | null>(null);
const lastProcessedClipboardUrlRef = useRef<string | null>(null);
// Web Landing modal for browser guests visiting via ?room=...
- const [webLandingInvite, setWebLandingInvite] = useState<{
- roomName: string;
- host: string;
- port: number;
- url: string;
- token?: string;
- } | null>(null);
+ const [webLandingInvite, setWebLandingInvite] = useState<ParsedInviteLink | null>(null);
// Synchronous refs for event handlers
const dimensionsRef = useRef(dimensions);
@@ -142,6 +166,99 @@ export function useMultiplayer({
onRemoteSelectiveUndoRef.current = onRemoteSelectiveUndo;
showToastRef.current = showToast;
+ // Desktop: resolve default peer name from OS account name unless explicitly customized
+ useEffect(() => {
+ if (!isTauriEnvironment()) return;
+ try {
+ if (
+ localStorage.getItem(NICKNAME_CUSTOMIZED_KEY) === '1' &&
+ (localStorage.getItem(NICKNAME_KEY) || '').trim()
+ ) {
+ return;
+ }
+ } catch {
+ // ignore storage errors
+ }
+
+ let cancelled = false;
+ (async () => {
+ try {
+ const { invoke } = await import('@tauri-apps/api/core');
+ const osName = await invoke<string>('get_os_username');
+ const trimmed = (osName || '').trim();
+ if (!cancelled && trimmed) {
+ setMyPeer((prev) => {
+ const next = { ...prev, name: trimmed };
+ myPeerRef.current = next;
+ return next;
+ });
+ const curSettings = useUiStore.getState().appSettings;
+ if (!curSettings.userName || curSettings.userName === 'Sora') {
+ uiStoreActions.updateAppSettings({ ...curSettings, userName: trimmed });
+ }
+ }
+ } catch {
+ // Fallback stays 'Artist'
+ }
+ })();
+
+ return () => {
+ cancelled = true;
+ };
+ }, []);
+
+ // Keep myPeer.name synchronized when changed via SettingsModal
+ useEffect(() => {
+ return useUiStore.subscribe(() => {
+ const configured = (useUiStore.getState().appSettings.userName || '').trim();
+ if (configured && configured !== myPeerRef.current.name) {
+ setMyPeer((prev) => {
+ if (prev.name === configured) return prev;
+ const next = { ...prev, name: configured };
+ myPeerRef.current = next;
+ return next;
+ });
+ }
+ });
+ }, []);
+
+ // Paced async tile streaming so large canvases never saturate WS or server mpsc buffers
+ const streamTilesPaced = useCallback((layersToStream: LayerItem[]) => {
+ const activeGrid = documentStore.getActiveTileGrid();
+ const queue: Array<{ layerId: string; tile: TileBuffer }> = [];
+ for (const layer of layersToStream) {
+ const tiles = activeGrid.getLayerTiles(layer.id);
+ for (const tile of tiles) {
+ if (tile.data && tile.data.byteLength > 0) {
+ queue.push({ layerId: layer.id, tile });
+ }
+ }
+ }
+ if (queue.length === 0) return;
+
+ let idx = 0;
+ const BATCH_SIZE = 16;
+ const MAX_BUFFERED_BYTES = 2 * 1024 * 1024;
+
+ const pump = () => {
+ if (!multiplayerService.isConnected()) return;
+ if (multiplayerService.getBufferedAmount() > MAX_BUFFERED_BYTES) {
+ setTimeout(pump, 20);
+ return;
+ }
+ const end = Math.min(idx + BATCH_SIZE, queue.length);
+ for (; idx < end; idx++) {
+ const entry = queue[idx];
+ multiplayerService.sendTileDelta(entry.layerId, entry.tile);
+ }
+ if (idx < queue.length) {
+ setTimeout(pump, 4);
+ }
+ };
+
+ pump();
+ }, []);
+
// Handle incoming messages
useEffect(() => {
const unsubscribe = multiplayerService.onMessage((msg: MultiplayerMessage) => {
@@ -156,8 +273,8 @@ export function useMultiplayer({
const guestPeer = msg.peer;
setPeers((prev) => {
- if (prev.some((p) => p.id === guestPeer.id)) return prev;
- const next = [...prev, guestPeer];
+ const filtered = prev.filter((p) => p.id !== guestPeer.id);
+ const next = [...filtered, guestPeer];
peersRef.current = next;
return next;
});
@@ -176,11 +293,13 @@ export function useMultiplayer({
}
}
+ const roomName = hostInfoRef.current?.roomName || 'Studio';
+
// Send JOIN_ACCEPTED to the joining guest
const joinAcceptedMsg: JoinAcceptedMessage = {
type: 'JOIN_ACCEPTED',
targetPeerId: guestPeer.id,
- roomName: hostInfoRef.current?.roomName || 'Studio',
+ roomName,
peers: [...peersRef.current.filter((p) => p.id !== guestPeer.id), myPeerRef.current],
hostId: myPeerRef.current.id,
docDimensions: dimensionsRef.current,
@@ -189,24 +308,20 @@ export function useMultiplayer({
};
multiplayerService.sendMessage(joinAcceptedMsg);
- // Send document synchronization
+ // Send document synchronization (carries assignedLayerId & roomName so there is no race)
multiplayerService.sendMessage({
type: 'DOC_SYNC_RESPONSE',
targetPeerId: guestPeer.id,
+ roomName,
+ assignedLayerId,
dimensions: dimensionsRef.current,
colorMode: colorModeRef.current,
layers: effectiveLayers,
layerDataUrls: {},
});
- // Progressive Tile Streaming: stream active layer tiles progressively from active document's sparse tile grid
- const activeGrid = documentStore.getActiveTileGrid();
- for (const layer of effectiveLayers) {
- const tiles = activeGrid.getLayerTiles(layer.id);
- for (const tile of tiles) {
- multiplayerService.sendTileDelta(layer.id, tile);
- }
- }
+ // Progressive paced tile streaming from active document's sparse tile grid
+ streamTilesPaced(effectiveLayers);
// Broadcast PEER_JOINED to other already connected peers
multiplayerService.sendMessage({
@@ -232,7 +347,7 @@ export function useMultiplayer({
onRemoteAssignedLayerRef.current?.(accMsg.assignedLayerId);
}
- showToastRef.current(`Connected to room "${accMsg.roomName}"!`);
+ showToastRef.current(`Connected to room "${accMsg.roomName}"`);
break;
}
@@ -243,20 +358,21 @@ export function useMultiplayer({
peersRef.current = next;
return next;
});
- showToastRef.current(`🎨 ${msg.peer.name} joined the canvas`);
+ showToastRef.current(`${msg.peer.name} joined the canvas`);
}
break;
}
case 'PEER_LEFT':
case 'PEER_DISCONNECTED': {
- const id = (msg as any).peerId || (msg as any).clientId;
+ const id = (msg as any).peerId ?? (msg as any).clientId;
+ if (id === undefined || id === null) break;
setPeers((prev) => {
- const leaving = prev.find((p) => p.id === id);
+ const leaving = prev.find((p) => String(p.id) === String(id));
if (leaving) {
- showToastRef.current(`👋 ${leaving.name} left the canvas`);
+ showToastRef.current(`${leaving.name} left the canvas`);
}
- const next = prev.filter((p) => p.id !== id);
+ const next = prev.filter((p) => String(p.id) !== String(id));
peersRef.current = next;
return next;
});
@@ -268,10 +384,9 @@ export function useMultiplayer({
setPeers((prev) => {
const existing = prev.find((p) => p.id === cMsg.peerId);
if (!existing) {
- // Dynamically register peer if not yet in list so cursor and draft canvas exist
const newPeer: CollabPeer = {
id: cMsg.peerId,
- name: cMsg.peerName || 'Friend',
+ name: cMsg.peerName || 'Guest',
color: cMsg.peerColor || getRandomColor(),
x: cMsg.x,
y: cMsg.y,
@@ -310,7 +425,7 @@ export function useMultiplayer({
if (prev.some((p) => p.id === sMsg.peerId)) return prev;
const newPeer: CollabPeer = {
id: sMsg.peerId,
- name: sMsg.peerName || 'Friend',
+ name: sMsg.peerName || 'Guest',
color: sMsg.peerColor || getRandomColor(),
isDrawing: true,
tool: sMsg.tool,
@@ -349,7 +464,14 @@ export function useMultiplayer({
return;
}
if (onRemoteDocSyncRef.current && msg.layers) {
- onRemoteDocSyncRef.current(msg.dimensions, msg.colorMode, msg.layers, msg.layerDataUrls || {});
+ onRemoteDocSyncRef.current(
+ msg.dimensions,
+ msg.colorMode,
+ msg.layers,
+ msg.layerDataUrls || {},
+ msg.assignedLayerId,
+ msg.roomName
+ );
}
break;
}
@@ -405,15 +527,17 @@ export function useMultiplayer({
const unsubClose = multiplayerService.onClose(() => {
setIsConnected(false);
+ setIsHost(false);
setPeers([]);
peersRef.current = [];
+ showToastRef.current('Disconnected from collaborative session');
});
return () => {
unsubscribe();
unsubClose();
};
- }, [layerCanvasesRef]);
+ }, [layerCanvasesRef, streamTilesPaced]);
// SMART CLIPBOARD INVITATION DETECTION
useEffect(() => {
@@ -425,39 +549,13 @@ export function useMultiplayer({
const text = await navigator.clipboard.readText();
if (!text || text === lastProcessedClipboardUrlRef.current) return;
- const trimmed = text.trim();
- let parsedUrl: URL | null = null;
- try {
- parsedUrl = new URL(trimmed);
- } catch {
- parsedUrl = null;
- }
-
- if (parsedUrl && (parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:')) {
- const roomParam = parsedUrl.searchParams.get('room');
- if (roomParam) {
- const host = parsedUrl.hostname;
- const isHttps = parsedUrl.protocol === 'https:';
- const port = parsedUrl.port ? parseInt(parsedUrl.port, 10) : (isHttps ? 443 : 80);
- const token = parsedUrl.searchParams.get('token') || undefined;
- lastProcessedClipboardUrlRef.current = text;
- setClipboardInvite({ roomName: roomParam, host, port, url: trimmed, token });
- }
- } else if (parsedUrl && parsedUrl.protocol === 'forsora:') {
- const host = parsedUrl.searchParams.get('host');
- const portParam = parsedUrl.searchParams.get('port');
- if (host && portParam) {
- const port = parseInt(portParam, 10);
- const roomName = parsedUrl.searchParams.get('room') || 'Studio';
- const token = parsedUrl.searchParams.get('token') || undefined;
- if (Number.isFinite(port)) {
- lastProcessedClipboardUrlRef.current = text;
- setClipboardInvite({ roomName, host, port, url: trimmed, token });
- }
- }
+ const parsed = parseInviteUrl(text);
+ if (parsed) {
+ lastProcessedClipboardUrlRef.current = text;
+ setClipboardInvite(parsed);
}
} catch {
- // Clipboard read permission might be denied or window not focused, ignore silently
+ // Clipboard read permission might be denied or window not focused
}
};
@@ -468,43 +566,41 @@ export function useMultiplayer({
// Check URL query parameters on initial page load (for Web Browser joins)
useEffect(() => {
if (typeof window === 'undefined') return;
-
- const params = new URLSearchParams(window.location.search);
- const room = params.get('room');
- if (room) {
- const host = window.location.hostname || '127.0.0.1';
- const isHttps = window.location.protocol === 'https:';
- const port = window.location.port ? parseInt(window.location.port, 10) : (isHttps ? 443 : 80);
- const token = params.get('token') || undefined;
- setWebLandingInvite({
- roomName: room,
- host,
- port,
- url: window.location.href,
- token,
- });
+ const parsed = parseInviteUrl(window.location.href);
+ if (parsed) {
+ setWebLandingInvite(parsed);
}
}, []);
// START HOSTING
const startHosting = useCallback(
async (
- roomName: string = "Ink Studio Session",
+ roomName: string = 'Ink Studio Session',
port: number = 30303,
hostNickname?: string,
- isGlobal: boolean = true
+ isGlobal: boolean = true,
+ onStatus?: (status: string) => void
) => {
try {
- let currentName = myPeer.name;
+ let currentName = myPeerRef.current.name;
if (hostNickname && hostNickname.trim()) {
currentName = hostNickname.trim();
- safeLocalStorageSetItem('sora_paint_nickname', currentName, 'artist name');
}
let serverInfo: SessionHostInfo;
if (isTauriEnvironment()) {
const { invoke } = await import('@tauri-apps/api/core');
+ if (isGlobal) {
+ const installed = await invoke<boolean>('is_cloudflared_installed').catch(() => true);
+ if (!installed) {
+ onStatus?.('Downloading Cloudflare Tunnel (first time)...');
+ } else {
+ onStatus?.('Starting Worldwide Tunnel...');
+ }
+ } else {
+ onStatus?.('Starting Local Server...');
+ }
serverInfo = await invoke<SessionHostInfo>('start_collab_server', {
port,
roomName,
@@ -527,7 +623,9 @@ export function useMultiplayer({
const resolvedIp = serverInfo.localIp || (serverInfo as any).local_ip || '127.0.0.1';
const resolvedRoomName = serverInfo.roomName || (serverInfo as any).room_name || roomName;
const resolvedRoomToken = serverInfo.roomToken || (serverInfo as any).room_token || '';
- const tokenQuery = resolvedRoomToken ? `&token=${encodeURIComponent(resolvedRoomToken)}` : '';
+ const tokenQuery = resolvedRoomToken
+ ? `&token=${encodeURIComponent(resolvedRoomToken)}`
+ : '';
const resolvedInviteUrl =
serverInfo.inviteUrl ||
(serverInfo as any).invite_url ||
@@ -549,9 +647,11 @@ export function useMultiplayer({
setHostInfo(normalizedServerInfo);
setIsHost(true);
+ isHostRef.current = true;
+ hostInfoRef.current = normalizedServerInfo;
const hostPeer: CollabPeer = {
- ...myPeer,
+ ...myPeerRef.current,
name: currentName,
isHost: true,
};
@@ -566,10 +666,11 @@ export function useMultiplayer({
// Auto-copy invite link
try {
await navigator.clipboard.writeText(normalizedServerInfo.inviteUrl);
+ lastProcessedClipboardUrlRef.current = normalizedServerInfo.inviteUrl;
showToast(
isGlobalServer
- ? '🌍 Global room invite link copied! Friends worldwide can join.'
- : '🔗 Local room invite link copied to clipboard!'
+ ? 'Worldwide invite link copied to clipboard.'
+ : 'Local Wi-Fi invite link copied to clipboard.'
);
} catch {
showToast(`Room created: ${normalizedServerInfo.inviteUrl}`);
@@ -583,23 +684,25 @@ export function useMultiplayer({
throw err;
}
},
- [myPeer, showToast]
+ [showToast]
);
// STOP HOSTING
const stopHosting = useCallback(async () => {
try {
+ multiplayerService.disconnect();
if (isTauriEnvironment()) {
const { invoke } = await import('@tauri-apps/api/core');
await invoke('stop_collab_server');
}
- multiplayerService.disconnect();
setIsConnected(false);
setIsHost(false);
+ isHostRef.current = false;
setHostInfo(null);
+ hostInfoRef.current = null;
setPeers([]);
peersRef.current = [];
- showToast('Collaborative drawing session stopped');
+ showToast('Collaborative session stopped');
} catch (err) {
console.error('Failed to stop collab server:', err);
}
@@ -607,22 +710,36 @@ export function useMultiplayer({
// JOIN ROOM
const joinRoom = useCallback(
- async (host: string, port: number, roomName: string, guestNickname?: string, token?: string) => {
+ async (
+ host: string,
+ port: number,
+ roomName: string,
+ guestNickname?: string,
+ token?: string,
+ isSecureOverride?: boolean,
+ persistName: boolean = false
+ ): Promise<boolean> => {
try {
- let currentName = myPeer.name;
+ let currentName = myPeerRef.current.name;
if (guestNickname && guestNickname.trim()) {
currentName = guestNickname.trim();
- safeLocalStorageSetItem('sora_paint_nickname', currentName, 'artist name');
+ if (persistName) {
+ safeLocalStorageSetItem(NICKNAME_KEY, currentName, 'artist name');
+ safeLocalStorageSetItem(NICKNAME_CUSTOMIZED_KEY, '1', 'artist name flag');
+ }
}
const isHttps = typeof window !== 'undefined' && window.location.protocol === 'https:';
- const isSecure = isHttps || port === 443 || host.includes('trycloudflare.com');
+ const isSecure =
+ isSecureOverride !== undefined
+ ? isSecureOverride
+ : isHttps || port === 443 || host.toLowerCase().endsWith('.trycloudflare.com');
const proto = isSecure ? 'wss' : 'ws';
const portPart = port === 80 || port === 443 || !port ? '' : `:${port}`;
const wsUrl = `${proto}://${host}${portPart}/ws`;
const guestPeer: CollabPeer = {
- ...myPeer,
+ ...myPeerRef.current,
name: currentName,
isHost: false,
};
@@ -632,9 +749,10 @@ export function useMultiplayer({
await multiplayerService.connect(wsUrl, guestPeer, token);
setIsConnected(true);
setIsHost(false);
+ isHostRef.current = false;
const inviteProto = isSecure ? 'https' : 'http';
const tokenQuery = token ? `&token=${encodeURIComponent(token)}` : '';
- setHostInfo({
+ const nextHostInfo: SessionHostInfo = {
isRunning: true,
port,
localIp: host,
@@ -643,35 +761,76 @@ export function useMultiplayer({
inviteUrl: `${inviteProto}://${host}${portPart}/?room=${encodeURIComponent(roomName)}${tokenQuery}`,
peerCount: 1,
isGlobal: isSecure,
- });
+ };
+ setHostInfo(nextHostInfo);
+ hostInfoRef.current = nextHostInfo;
setClipboardInvite(null);
setWebLandingInvite(null);
- showToast(`Connecting to room "${roomName}"...`);
+ return true;
} catch (err: any) {
showToast(`Failed to connect: ${err?.message || err}`);
+ return false;
+ }
+ },
+ [showToast]
+ );
+
+ const joinByInviteUrl = useCallback(
+ async (rawUrl: string, nickname?: string, persistName: boolean = false): Promise<boolean> => {
+ const parsed = parseInviteUrl(rawUrl);
+ if (!parsed) {
+ showToast('Invalid invite link. Paste the full room URL.');
+ return false;
}
+ return joinRoom(
+ parsed.host,
+ parsed.port,
+ parsed.roomName,
+ nickname,
+ parsed.token,
+ parsed.isSecure,
+ persistName
+ );
},
- [myPeer, showToast]
+ [joinRoom, showToast]
);
const leaveRoom = useCallback(() => {
multiplayerService.disconnect();
setIsConnected(false);
setIsHost(false);
+ isHostRef.current = false;
setHostInfo(null);
+ hostInfoRef.current = null;
setPeers([]);
peersRef.current = [];
- showToast('You left the room');
+ showToast('Left the collaborative session');
}, [showToast]);
- const updateMyName = useCallback((name: string) => {
- const trimmed = name.trim() || 'Artist';
- safeLocalStorageSetItem('sora_paint_nickname', trimmed, 'artist name');
- setMyPeer((prev) => ({ ...prev, name: trimmed }));
+ const updateMyName = useCallback((name: string, markCustomized: boolean = true) => {
+ const fallback = isTauriEnvironment() ? 'Artist' : 'Guest';
+ const trimmed = name.trim() || fallback;
+ if (markCustomized) {
+ safeLocalStorageSetItem(NICKNAME_KEY, trimmed, 'artist name');
+ safeLocalStorageSetItem(NICKNAME_CUSTOMIZED_KEY, '1', 'artist name flag');
+ const curSettings = useUiStore.getState().appSettings;
+ if (curSettings.userName !== trimmed) {
+ uiStoreActions.updateAppSettings({ ...curSettings, userName: trimmed });
+ }
+ }
+ setMyPeer((prev) => {
+ const next = { ...prev, name: trimmed };
+ myPeerRef.current = next;
+ return next;
+ });
}, []);
const updateMyColor = useCallback((color: string) => {
- setMyPeer((prev) => ({ ...prev, color }));
+ setMyPeer((prev) => {
+ const next = { ...prev, color };
+ myPeerRef.current = next;
+ return next;
+ });
}, []);
const sendPing = useCallback((x: number, y: number) => {
@@ -694,6 +853,7 @@ export function useMultiplayer({
startHosting,
stopHosting,
joinRoom,
+ joinByInviteUrl,
leaveRoom,
updateMyName,
updateMyColor,
diff --git a/src/services/__tests__/updaterService.test.ts b/src/services/__tests__/updaterService.test.ts
new file mode 100644
index 0000000..5f0ad52
--- /dev/null
+++ b/src/services/__tests__/updaterService.test.ts
@@ -0,0 +1,304 @@
+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
+import type { DownloadEvent } from '@tauri-apps/plugin-updater';
+import { DEFAULT_APP_SETTINGS } from '../../types/settings';
+import {
+ selectIsAnyModalOpen,
+ uiStoreActions,
+ useUiStore,
+ useUpdaterStore,
+} from '../../stores';
+import { updaterService } from '../updaterService';
+
+const mockCheck = vi.fn();
+const mockRelaunch = vi.fn();
+const mockGetVersion = vi.fn();
+
+vi.mock('@tauri-apps/plugin-updater', () => ({
+ check: (...args: unknown[]) => mockCheck(...args),
+}));
+
+vi.mock('@tauri-apps/plugin-process', () => ({
+ relaunch: (...args: unknown[]) => mockRelaunch(...args),
+}));
+
+vi.mock('@tauri-apps/api/app', () => ({
+ getVersion: (...args: unknown[]) => mockGetVersion(...args),
+}));
+
+interface MockUpdateHandle {
+ version: string;
+ currentVersion: string;
+ date?: string;
+ body?: string;
+ downloadAndInstall: ReturnType<typeof vi.fn>;
+ close: ReturnType<typeof vi.fn>;
+}
+
+function createMockUpdate(overrides: Partial<MockUpdateHandle> = {}): MockUpdateHandle {
+ return {
+ version: '1.1.0',
+ currentVersion: '1.0.0',
+ date: '2026-11-20T00:00:00Z',
+ body: '- Added auto-updater\n- Improved brush engine',
+ downloadAndInstall: vi.fn(async (onEvent?: (event: DownloadEvent) => void) => {
+ onEvent?.({ event: 'Started', data: { contentLength: 1000 } });
+ onEvent?.({ event: 'Progress', data: { chunkLength: 400 } });
+ onEvent?.({ event: 'Progress', data: { chunkLength: 600 } });
+ onEvent?.({ event: 'Finished' });
+ }),
+ close: vi.fn(async () => {}),
+ ...overrides,
+ };
+}
+
+function setTauriWindow(enabled: boolean): void {
+ const g = globalThis as unknown as Record<string, unknown>;
+ if (enabled) {
+ g.window = { __TAURI_INTERNALS__: {} };
+ } else {
+ g.window = {};
+ }
+}
+
+describe('updaterService & useUpdaterStore', () => {
+ const originalWindow = (globalThis as unknown as Record<string, unknown>).window;
+ const originalLocalStorage = (globalThis as unknown as Record<string, unknown>).localStorage;
+
+ beforeEach(async () => {
+ const storage: Record<string, string> = {};
+ (globalThis as unknown as Record<string, unknown>).localStorage = {
+ getItem: (k: string) => storage[k] ?? null,
+ setItem: (k: string, v: string) => {
+ storage[k] = String(v);
+ },
+ removeItem: (k: string) => {
+ delete storage[k];
+ },
+ clear: () => {
+ Object.keys(storage).forEach((k) => delete storage[k]);
+ },
+ };
+
+ mockCheck.mockReset();
+ mockRelaunch.mockReset();
+ mockGetVersion.mockReset();
+ mockGetVersion.mockResolvedValue('1.0.0');
+ mockRelaunch.mockResolvedValue(undefined);
+
+ useUiStore.reset();
+ uiStoreActions.updateAppSettings({ ...DEFAULT_APP_SETTINGS });
+ await updaterService.resetUpdaterService();
+ setTauriWindow(true);
+ });
+
+ afterEach(async () => {
+ await updaterService.resetUpdaterService();
+ vi.restoreAllMocks();
+ const g = globalThis as unknown as Record<string, unknown>;
+ if (originalWindow === undefined) {
+ delete g.window;
+ } else {
+ g.window = originalWindow;
+ }
+ if (originalLocalStorage === undefined) {
+ delete g.localStorage;
+ } else {
+ g.localStorage = originalLocalStorage;
+ }
+ });
+
+ it('is a complete no-op outside Tauri runtime', async () => {
+ setTauriWindow(false);
+
+ const checkResult = await updaterService.checkForUpdates({ silent: false });
+ const installResult = await updaterService.downloadAndInstallUpdate();
+ const cancel = updaterService.scheduleStartupUpdateCheck(10);
+ cancel();
+
+ expect(checkResult).toBe(false);
+ expect(installResult).toBe(false);
+ expect(mockCheck).not.toHaveBeenCalled();
+ expect(mockRelaunch).not.toHaveBeenCalled();
+ expect(mockGetVersion).not.toHaveBeenCalled();
+ expect(useUpdaterStore.getState().status).toBe('idle');
+ });
+
+ it('silent startup check respects autoCheckUpdates = false', async () => {
+ uiStoreActions.updateAppSettings({
+ ...DEFAULT_APP_SETTINGS,
+ autoCheckUpdates: false,
+ });
+
+ const found = await updaterService.checkForUpdates({ silent: true });
+ expect(found).toBe(false);
+ expect(mockCheck).not.toHaveBeenCalled();
+ expect(useUpdaterStore.getState().status).toBe('idle');
+ });
+
+ it('silent check suppresses banner when update version matches skippedUpdateVersion', async () => {
+ uiStoreActions.updateAppSettings({
+ ...DEFAULT_APP_SETTINGS,
+ autoCheckUpdates: true,
+ skippedUpdateVersion: '1.1.0',
+ });
+ const update = createMockUpdate({ version: '1.1.0' });
+ mockCheck.mockResolvedValueOnce(update);
+
+ const found = await updaterService.checkForUpdates({ silent: true });
+ expect(found).toBe(true);
+ const state = useUpdaterStore.getState();
+ expect(state.status).toBe('available');
+ expect(state.availableVersion).toBe('1.1.0');
+ expect(state.isBannerDismissed).toBe(true);
+ expect(useUiStore.getState().toastMessage).toBeNull();
+ });
+
+ it('manual check ignores skippedUpdateVersion, shows update info, and disposes previous Update handle', async () => {
+ uiStoreActions.updateAppSettings({
+ ...DEFAULT_APP_SETTINGS,
+ skippedUpdateVersion: '1.1.0',
+ });
+
+ const firstUpdate = createMockUpdate({ version: '1.1.0' });
+ const secondUpdate = createMockUpdate({ version: '1.1.0', body: 'Fresh notes' });
+ mockCheck.mockResolvedValueOnce(firstUpdate).mockResolvedValueOnce(secondUpdate);
+
+ await updaterService.checkForUpdates({ silent: true });
+ expect(useUpdaterStore.getState().isBannerDismissed).toBe(true);
+
+ const foundManual = await updaterService.checkForUpdates({ silent: false });
+ expect(foundManual).toBe(true);
+ expect(firstUpdate.close).toHaveBeenCalledTimes(1);
+
+ const state = useUpdaterStore.getState();
+ expect(state.status).toBe('available');
+ expect(state.availableVersion).toBe('1.1.0');
+ expect(state.releaseNotes).toBe('Fresh notes');
+ expect(state.isBannerDismissed).toBe(false);
+ expect(useUiStore.getState().toastMessage).toContain('1.1.0');
+ });
+
+ it('manual check reports up-to-date when no newer release exists', async () => {
+ mockCheck.mockResolvedValueOnce(null);
+
+ const found = await updaterService.checkForUpdates({ silent: false });
+ expect(found).toBe(false);
+ expect(useUpdaterStore.getState().status).toBe('up-to-date');
+ expect(useUpdaterStore.getState().availableVersion).toBeNull();
+ expect(useUiStore.getState().toastMessage).toBe('Ink Studio is up to date');
+ });
+
+ it('handles network errors silently in silent mode and surfaces them in manual mode', async () => {
+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
+ mockCheck.mockRejectedValueOnce(new Error('Network offline'));
+
+ const silentResult = await updaterService.checkForUpdates({ silent: true });
+ expect(silentResult).toBe(false);
+ expect(warnSpy).toHaveBeenCalled();
+ expect(useUpdaterStore.getState().status).toBe('idle');
+ expect(useUpdaterStore.getState().errorMessage).toBeNull();
+ expect(useUiStore.getState().toastMessage).toBeNull();
+
+ mockCheck.mockRejectedValueOnce(new Error('DNS lookup failed'));
+ const manualResult = await updaterService.checkForUpdates({ silent: false });
+ expect(manualResult).toBe(false);
+ expect(useUpdaterStore.getState().status).toBe('error');
+ expect(useUpdaterStore.getState().errorMessage).toBe('DNS lookup failed');
+ expect(useUiStore.getState().toastMessage).toContain('DNS lookup failed');
+ });
+
+ it('guards against concurrent update checks', async () => {
+ let resolveCheck!: (val: MockUpdateHandle | null) => void;
+ mockCheck.mockImplementationOnce(
+ () =>
+ new Promise<MockUpdateHandle | null>((resolve) => {
+ resolveCheck = resolve;
+ })
+ );
+
+ const first = updaterService.checkForUpdates({ silent: false });
+ const second = updaterService.checkForUpdates({ silent: false });
+
+ expect(await second).toBe(false);
+ await vi.waitFor(() => {
+ expect(mockCheck).toHaveBeenCalledTimes(1);
+ });
+
+ resolveCheck(null);
+ await first;
+ expect(useUpdaterStore.getState().status).toBe('up-to-date');
+ });
+
+ it('tracks download progress accurately, transitions to ready, disposes handle, and relaunches', async () => {
+ const observedProgress: number[] = [];
+ const unsub = useUpdaterStore.subscribe(() => {
+ const s = useUpdaterStore.getState();
+ if (s.status === 'downloading') {
+ observedProgress.push(s.progressPercent);
+ }
+ });
+
+ const update = createMockUpdate({
+ version: '1.2.0',
+ downloadAndInstall: vi.fn(async (onEvent?: (e: DownloadEvent) => void) => {
+ onEvent?.({ event: 'Started', data: { contentLength: 2000 } });
+ onEvent?.({ event: 'Progress', data: { chunkLength: 500 } });
+ onEvent?.({ event: 'Progress', data: { chunkLength: 1000 } });
+ onEvent?.({ event: 'Progress', data: { chunkLength: 500 } });
+ onEvent?.({ event: 'Finished' });
+ }),
+ });
+ mockCheck.mockResolvedValueOnce(update);
+
+ await updaterService.checkForUpdates({ silent: true });
+ const installed = await updaterService.downloadAndInstallUpdate();
+ unsub();
+
+ expect(installed).toBe(true);
+ expect(observedProgress).toContain(25);
+ expect(observedProgress).toContain(75);
+ expect(observedProgress).toContain(100);
+ expect(useUpdaterStore.getState().status).toBe('ready');
+ expect(useUpdaterStore.getState().progressPercent).toBe(100);
+ expect(useUpdaterStore.getState().downloadedBytes).toBe(2000);
+ expect(useUpdaterStore.getState().totalBytes).toBe(2000);
+ expect(update.close).toHaveBeenCalledTimes(1);
+ expect(mockRelaunch).toHaveBeenCalledTimes(1);
+ });
+
+ it('handles download failure cleanly with error state and toast', async () => {
+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
+ const update = createMockUpdate({
+ downloadAndInstall: vi.fn(async () => {
+ throw new Error('Signature verification failed');
+ }),
+ });
+ mockCheck.mockResolvedValueOnce(update);
+
+ await updaterService.checkForUpdates({ silent: true });
+ const installed = await updaterService.downloadAndInstallUpdate();
+
+ expect(installed).toBe(false);
+ expect(warnSpy).toHaveBeenCalled();
+ expect(useUpdaterStore.getState().status).toBe('error');
+ expect(useUpdaterStore.getState().errorMessage).toBe('Signature verification failed');
+ expect(useUiStore.getState().toastMessage).toContain('Signature verification failed');
+ expect(mockRelaunch).not.toHaveBeenCalled();
+ });
+
+ it('skipAvailableVersion persists skippedUpdateVersion and hides modal/banner', async () => {
+ const update = createMockUpdate({ version: '1.3.0' });
+ mockCheck.mockResolvedValueOnce(update);
+
+ await updaterService.checkForUpdates({ silent: true });
+ updaterService.openUpdateModal();
+ expect(useUpdaterStore.getState().isModalOpen).toBe(true);
+ expect(selectIsAnyModalOpen(useUiStore.getState())).toBe(true);
+
+ updaterService.skipAvailableVersion();
+ expect(useUiStore.getState().appSettings.skippedUpdateVersion).toBe('1.3.0');
+ expect(useUpdaterStore.getState().isModalOpen).toBe(false);
+ expect(useUpdaterStore.getState().isBannerDismissed).toBe(true);
+ expect(selectIsAnyModalOpen(useUiStore.getState())).toBe(false);
+ });
+});
diff --git a/src/services/multiplayerService.ts b/src/services/multiplayerService.ts
index 362f31c..76004eb 100644
--- a/src/services/multiplayerService.ts
+++ b/src/services/multiplayerService.ts
@@ -29,6 +29,70 @@ export const CODE_SELECTIVE_UNDO = 0x06;
const MAX_BINARY_PACKET_BYTES = 16 * 1024 * 1024;
const MAX_JSON_MESSAGE_CHARS = 8 * 1024 * 1024;
const MAX_STROKE_CHUNK_POINTS = 4096;
+const WS_CONNECT_TIMEOUT_MS = 15000;
+
+export interface ParsedInviteLink {
+ roomName: string;
+ host: string;
+ port: number;
+ url: string;
+ token?: string;
+ isSecure: boolean;
+}
+
+export function parseInviteUrl(raw: string): ParsedInviteLink | null {
+ const trimmed = raw.trim();
+ if (!trimmed) return null;
+
+ let parsedUrl: URL;
+ try {
+ parsedUrl = new URL(trimmed);
+ } catch {
+ return null;
+ }
+
+ if (parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:') {
+ const roomParam = parsedUrl.searchParams.get('room');
+ if (!roomParam) return null;
+ const isSecure = parsedUrl.protocol === 'https:';
+ const port = parsedUrl.port ? parseInt(parsedUrl.port, 10) : isSecure ? 443 : 80;
+ if (!Number.isFinite(port) || port <= 0 || port > 65535) return null;
+ const token = parsedUrl.searchParams.get('token') || undefined;
+ return {
+ roomName: roomParam,
+ host: parsedUrl.hostname,
+ port,
+ url: trimmed,
+ token,
+ isSecure,
+ };
+ }
+
+ if (parsedUrl.protocol === 'forsora:') {
+ const host = parsedUrl.searchParams.get('host');
+ const portParam = parsedUrl.searchParams.get('port');
+ if (!host) return null;
+ const protoParam = parsedUrl.searchParams.get('protocol');
+ const isSecure =
+ protoParam === 'https' ||
+ portParam === '443' ||
+ host.toLowerCase().endsWith('.trycloudflare.com');
+ const port = portParam ? parseInt(portParam, 10) : isSecure ? 443 : 30303;
+ if (!Number.isFinite(port) || port <= 0 || port > 65535) return null;
+ const roomName = parsedUrl.searchParams.get('room') || 'Studio';
+ const token = parsedUrl.searchParams.get('token') || undefined;
+ return {
+ roomName,
+ host,
+ port,
+ url: trimmed,
+ token,
+ isSecure,
+ };
+ }
+
+ return null;
+}
function sanitizeRemoteBrushSettings(raw: unknown): BrushSettings | null {
if (!raw || typeof raw !== 'object') return null;
@@ -104,6 +168,10 @@ class MultiplayerService {
return this.currentPeer;
}
+ public getBufferedAmount(): number {
+ return this.ws ? this.ws.bufferedAmount : 0;
+ }
+
public connect(url: string, peer: CollabPeer, token?: string): Promise<void> {
return new Promise((resolve, reject) => {
this.disconnect();
@@ -126,21 +194,54 @@ class MultiplayerService {
}
}
+ let settled = false;
+ const settleResolve = () => {
+ if (settled) return;
+ settled = true;
+ if (timeoutId !== null) clearTimeout(timeoutId);
+ resolve();
+ };
+ const settleReject = (err: Error) => {
+ if (settled) return;
+ settled = true;
+ if (timeoutId !== null) clearTimeout(timeoutId);
+ reject(err);
+ };
+
+ let timeoutId: ReturnType<typeof setTimeout> | null = null;
+
try {
const ws = new WebSocket(connectUrl);
ws.binaryType = 'arraybuffer';
this.ws = ws;
+ timeoutId = setTimeout(() => {
+ if (this.ws === ws && !settled) {
+ try {
+ ws.close();
+ } catch {
+ // ignore
+ }
+ this.ws = null;
+ settleReject(new Error(`Connection timed out (${displayUrl})`));
+ }
+ }, WS_CONNECT_TIMEOUT_MS);
+
ws.onopen = () => {
+ if (this.ws !== ws) {
+ ws.close();
+ return;
+ }
// Send join handshake
this.sendMessage({
type: 'JOIN_REQUEST',
peer: this.currentPeer!,
});
- resolve();
+ settleResolve();
};
ws.onmessage = async (event) => {
+ if (this.ws !== ws) return;
try {
if (event.data instanceof ArrayBuffer) {
const parsed = this.decodeBinaryPacket(event.data);
@@ -165,31 +266,48 @@ class MultiplayerService {
}
};
- ws.onclose = () => {
- this.ws = null;
- this.closeHandlers.forEach((h) => h());
+ ws.onclose = (ev) => {
+ if (this.ws === ws) {
+ this.ws = null;
+ }
+ if (!settled) {
+ const detail = ev.reason ? `: ${ev.reason}` : '';
+ settleReject(new Error(`Failed to connect to socket server (${displayUrl})${detail}`));
+ } else {
+ this.closeHandlers.forEach((h) => h());
+ }
};
ws.onerror = (err) => {
+ if (this.ws !== ws) return;
this.errorHandlers.forEach((h) => h(err));
- reject(new Error(`Failed to connect to socket server (${displayUrl})`));
+ settleReject(new Error(`Failed to connect to socket server (${displayUrl})`));
};
} catch (err: any) {
- reject(new Error(err?.message || `WebSocket initialization error (${displayUrl})`));
+ settleReject(new Error(err?.message || `WebSocket initialization error (${displayUrl})`));
}
});
}
public disconnect() {
if (this.ws) {
- if (this.currentPeer) {
+ const closingWs = this.ws;
+ if (this.currentPeer && closingWs.readyState === WebSocket.OPEN) {
this.sendMessage({
type: 'PEER_LEFT',
peerId: this.currentPeer.id,
});
}
- this.ws.close();
this.ws = null;
+ try {
+ closingWs.onopen = null;
+ closingWs.onmessage = null;
+ closingWs.onclose = null;
+ closingWs.onerror = null;
+ closingWs.close();
+ } catch {
+ // ignore close errors
+ }
}
this.currentPeer = null;
if (this.cursorThrottleRaf) {
diff --git a/src/services/updaterService.ts b/src/services/updaterService.ts
new file mode 100644
index 0000000..7d4990c
--- /dev/null
+++ b/src/services/updaterService.ts
@@ -0,0 +1,335 @@
+import type { DownloadEvent, Update } from '@tauri-apps/plugin-updater';
+import { version as PACKAGE_VERSION } from '../../package.json';
+import { isTauriEnvironment } from '../hooks/useMultiplayer';
+import { uiStoreActions, useUiStore } from '../stores/useUiStore';
+import { updaterStoreActions, useUpdaterStore } from '../stores/useUpdaterStore';
+
+export interface CheckForUpdatesOptions {
+ silent?: boolean;
+}
+
+let pendingUpdate: Update | null = null;
+let isCheckInFlight = false;
+let isDownloadInFlight = false;
+
+function formatErrorMessage(err: unknown, fallback: string): string {
+ if (err instanceof Error && err.message.trim()) {
+ return err.message.trim();
+ }
+ if (typeof err === 'string' && err.trim()) {
+ return err.trim();
+ }
+ return fallback;
+}
+
+async function disposePendingUpdate(): Promise<void> {
+ const existing = pendingUpdate;
+ pendingUpdate = null;
+ if (existing) {
+ try {
+ await existing.close();
+ } catch {
+ // Ignore disposal errors from already-closed updater resources
+ }
+ }
+}
+
+export async function resolveCurrentVersion(): Promise<string> {
+ if (!isTauriEnvironment()) {
+ useUpdaterStore.setState({ currentVersion: PACKAGE_VERSION });
+ return PACKAGE_VERSION;
+ }
+
+ try {
+ const { getVersion } = await import('@tauri-apps/api/app');
+ const runtimeVersion = await getVersion();
+ const resolved = runtimeVersion?.trim() || PACKAGE_VERSION;
+ useUpdaterStore.setState({ currentVersion: resolved });
+ return resolved;
+ } catch {
+ useUpdaterStore.setState({ currentVersion: PACKAGE_VERSION });
+ return PACKAGE_VERSION;
+ }
+}
+
+export async function checkForUpdates(
+ options: CheckForUpdatesOptions = {}
+): Promise<boolean> {
+ const { silent = false } = options;
+
+ if (!isTauriEnvironment()) {
+ return false;
+ }
+
+ const currentState = useUpdaterStore.getState();
+ if (
+ isCheckInFlight ||
+ isDownloadInFlight ||
+ currentState.status === 'checking' ||
+ currentState.status === 'downloading'
+ ) {
+ return false;
+ }
+
+ const appSettings = useUiStore.getState().appSettings;
+ if (silent && !appSettings.autoCheckUpdates) {
+ return false;
+ }
+
+ const prevStatus = currentState.status;
+ isCheckInFlight = true;
+
+ useUpdaterStore.setState({
+ status: 'checking',
+ errorMessage: null,
+ });
+
+ try {
+ await resolveCurrentVersion();
+
+ const { check } = await import('@tauri-apps/plugin-updater');
+ const update = await check();
+
+ await disposePendingUpdate();
+
+ if (update) {
+ pendingUpdate = update;
+ const latestSettings = useUiStore.getState().appSettings;
+ const isSkippedInSilentMode =
+ silent &&
+ Boolean(latestSettings.skippedUpdateVersion) &&
+ update.version === latestSettings.skippedUpdateVersion;
+ const modalCurrentlyOpen = useUpdaterStore.getState().isModalOpen;
+
+ useUpdaterStore.setState({
+ status: 'available',
+ currentVersion: update.currentVersion || useUpdaterStore.getState().currentVersion,
+ availableVersion: update.version,
+ releaseDate: update.date ?? null,
+ releaseNotes: update.body ?? null,
+ downloadedBytes: 0,
+ totalBytes: null,
+ progressPercent: 0,
+ errorMessage: null,
+ isBannerDismissed: isSkippedInSilentMode || modalCurrentlyOpen,
+ });
+
+ if (!silent && !modalCurrentlyOpen) {
+ uiStoreActions.showToast(`Update v${update.version} is available`);
+ }
+
+ return true;
+ }
+
+ useUpdaterStore.setState({
+ status: 'up-to-date',
+ availableVersion: null,
+ releaseDate: null,
+ releaseNotes: null,
+ downloadedBytes: 0,
+ totalBytes: null,
+ progressPercent: 0,
+ errorMessage: null,
+ isBannerDismissed: true,
+ });
+
+ if (!silent) {
+ uiStoreActions.showToast('Ink Studio is up to date');
+ }
+
+ return false;
+ } catch (err: unknown) {
+ const message = formatErrorMessage(err, 'Unable to check for updates');
+
+ if (silent) {
+ console.warn('[Updater] Silent update check failed:', err);
+ useUpdaterStore.setState({
+ status: prevStatus,
+ errorMessage: null,
+ });
+ } else {
+ console.warn('[Updater] Update check failed:', err);
+ useUpdaterStore.setState({
+ status: 'error',
+ errorMessage: message,
+ });
+ uiStoreActions.showToast(`Update check failed: ${message}`);
+ }
+
+ return false;
+ } finally {
+ isCheckInFlight = false;
+ }
+}
+
+export async function downloadAndInstallUpdate(): Promise<boolean> {
+ if (!isTauriEnvironment()) {
+ return false;
+ }
+
+ const currentState = useUpdaterStore.getState();
+ if (isDownloadInFlight || currentState.status === 'downloading') {
+ return false;
+ }
+
+ if (!pendingUpdate) {
+ const message = 'No pending update found. Please check for updates again.';
+ useUpdaterStore.setState({
+ status: 'error',
+ errorMessage: message,
+ });
+ uiStoreActions.showToast(message);
+ return false;
+ }
+
+ isDownloadInFlight = true;
+ let downloadedBytes = 0;
+ let totalBytes: number | null = null;
+
+ useUpdaterStore.setState({
+ status: 'downloading',
+ downloadedBytes: 0,
+ totalBytes: null,
+ progressPercent: 0,
+ errorMessage: null,
+ isBannerDismissed: true,
+ });
+
+ try {
+ const updateHandle = pendingUpdate;
+
+ await updateHandle.downloadAndInstall((event: DownloadEvent) => {
+ switch (event.event) {
+ case 'Started': {
+ totalBytes =
+ typeof event.data.contentLength === 'number' && event.data.contentLength > 0
+ ? event.data.contentLength
+ : null;
+ downloadedBytes = 0;
+ useUpdaterStore.setState({
+ totalBytes,
+ downloadedBytes: 0,
+ progressPercent: 0,
+ });
+ break;
+ }
+ case 'Progress': {
+ const chunk =
+ typeof event.data.chunkLength === 'number' && event.data.chunkLength > 0
+ ? event.data.chunkLength
+ : 0;
+ downloadedBytes += chunk;
+ const progressPercent =
+ totalBytes && totalBytes > 0
+ ? Math.min(100, Math.round((downloadedBytes / totalBytes) * 100))
+ : 0;
+ useUpdaterStore.setState({
+ downloadedBytes,
+ progressPercent,
+ });
+ break;
+ }
+ case 'Finished': {
+ useUpdaterStore.setState({
+ downloadedBytes: totalBytes ?? downloadedBytes,
+ progressPercent: 100,
+ });
+ break;
+ }
+ }
+ });
+
+ useUpdaterStore.setState({
+ status: 'ready',
+ progressPercent: 100,
+ errorMessage: null,
+ });
+
+ await disposePendingUpdate();
+
+ // On Windows (NSIS passive mode), the installer may exit the app automatically during
+ // downloadAndInstall. On macOS/Linux (and Windows if still alive), explicitly relaunch.
+ try {
+ const { relaunch } = await import('@tauri-apps/plugin-process');
+ await relaunch();
+ } catch (relaunchErr: unknown) {
+ console.warn('[Updater] Automatic relaunch did not complete:', relaunchErr);
+ uiStoreActions.showToast('Update installed — please restart Ink Studio to apply it');
+ }
+
+ return true;
+ } catch (err: unknown) {
+ const message = formatErrorMessage(err, 'Failed to download and install update');
+ console.warn('[Updater] Download/install failed:', err);
+ useUpdaterStore.setState({
+ status: 'error',
+ errorMessage: message,
+ });
+ uiStoreActions.showToast(`Update failed: ${message}`);
+ return false;
+ } finally {
+ isDownloadInFlight = false;
+ }
+}
+
+export function skipAvailableVersion(): void {
+ const { availableVersion } = useUpdaterStore.getState();
+ if (availableVersion) {
+ const currentSettings = useUiStore.getState().appSettings;
+ uiStoreActions.updateAppSettings({
+ ...currentSettings,
+ skippedUpdateVersion: availableVersion,
+ });
+ }
+ useUpdaterStore.setState({
+ isBannerDismissed: true,
+ isModalOpen: false,
+ });
+}
+
+export function dismissBanner(): void {
+ updaterStoreActions.dismissBanner();
+}
+
+export function openUpdateModal(): void {
+ updaterStoreActions.openUpdateModal();
+}
+
+export function closeUpdateModal(): void {
+ updaterStoreActions.closeUpdateModal();
+}
+
+export function scheduleStartupUpdateCheck(delayMs = 4500): () => void {
+ if (!isTauriEnvironment()) {
+ return () => {};
+ }
+
+ void resolveCurrentVersion();
+
+ const timer = setTimeout(() => {
+ void checkForUpdates({ silent: true });
+ }, delayMs);
+
+ return () => {
+ clearTimeout(timer);
+ };
+}
+
+export async function resetUpdaterService(): Promise<void> {
+ isCheckInFlight = false;
+ isDownloadInFlight = false;
+ await disposePendingUpdate();
+ updaterStoreActions.reset();
+}
+
+export const updaterService = {
+ resolveCurrentVersion,
+ checkForUpdates,
+ downloadAndInstallUpdate,
+ skipAvailableVersion,
+ dismissBanner,
+ openUpdateModal,
+ closeUpdateModal,
+ scheduleStartupUpdateCheck,
+ resetUpdaterService,
+};
diff --git a/src/stores/__tests__/storesAndRerenderIsolation.test.tsx b/src/stores/__tests__/storesAndRerenderIsolation.test.tsx
index 09742b0..48df0c6 100644
--- a/src/stores/__tests__/storesAndRerenderIsolation.test.tsx
+++ b/src/stores/__tests__/storesAndRerenderIsolation.test.tsx
@@ -17,6 +17,11 @@ import { Header } from '../../components/Header';
import { RightSidebar, RightSidebarColorSection } from '../../components/RightSidebar';
import { ToolStrip } from '../../components/ToolStrip';
import { LayerItem, MenuSection } from '../../types/editor';
+import {
+ ERASER_PRESET_ID,
+ NEUTRAL_BRUSH_DEFAULTS,
+ getEffectiveBrushSettings,
+} from '../../utils/brushPresetManager';
interface MiniNode {
nodeType: number;
@@ -396,6 +401,87 @@ describe('External stores (useToolStore, useDocumentStore, useUiStore)', () => {
expect(useToolStore.getState().quickModifiers.isAltActive).toBe(true);
});
+ it('preserves selected builtin and custom brush presets across tool switches instead of resetting', () => {
+ // Select a non-default builtin brush and tweak its settings
+ const charcoalCfg = getEffectiveBrushSettings('charcoal-pencil');
+ toolStoreActions.updateBrushSettings({
+ ...NEUTRAL_BRUSH_DEFAULTS,
+ ...charcoalCfg,
+ preset: 'charcoal-pencil',
+ size: 19,
+ opacity: 0.65,
+ });
+ expect(useToolStore.getState().activePresetId).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.preset).toBe('charcoal-pencil');
+
+ // Brush -> Eraser -> Brush preserves charcoal-pencil and keeps eraser settings independent
+ toolStoreActions.selectTool('eraser');
+ expect(useToolStore.getState().tool).toBe('eraser');
+ expect(useToolStore.getState().brushSettings.preset).toBe(ERASER_PRESET_ID);
+ expect(useToolStore.getState().activePresetId).toBe('charcoal-pencil');
+
+ toolStoreActions.updateBrushSettings({ size: 52 });
+ expect(useToolStore.getState().brushSettings.size).toBe(52);
+ expect(useToolStore.getState().activePresetId).toBe('charcoal-pencil');
+
+ toolStoreActions.selectTool('brush');
+ expect(useToolStore.getState().tool).toBe('brush');
+ expect(useToolStore.getState().activePresetId).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.preset).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.size).toBe(19);
+ expect(useToolStore.getState().brushSettings.opacity).toBe(0.65);
+
+ // Returning to eraser still remembers eraser size
+ toolStoreActions.selectTool('eraser');
+ expect(useToolStore.getState().brushSettings.size).toBe(52);
+
+ // Eraser -> another non-brush tool -> Brush still restores charcoal-pencil
+ toolStoreActions.selectTool('fill');
+ expect(useToolStore.getState().tool).toBe('fill');
+ expect(useToolStore.getState().activePresetId).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.preset).toBe('charcoal-pencil');
+
+ toolStoreActions.selectTool('select-rect');
+ toolStoreActions.selectTool('pipette');
+ toolStoreActions.selectTool('brush');
+ expect(useToolStore.getState().tool).toBe('brush');
+ expect(useToolStore.getState().activePresetId).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.preset).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.size).toBe(19);
+
+ // Eraser -> setPrimaryColor / swapColors returns to brush with selected preset intact
+ toolStoreActions.selectTool('eraser');
+ toolStoreActions.setPrimaryColor('#2266cc');
+ expect(useToolStore.getState().tool).toBe('brush');
+ expect(useToolStore.getState().activePresetId).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.preset).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.color).toBe('#2266cc');
+
+ toolStoreActions.selectTool('eraser');
+ toolStoreActions.swapColors();
+ expect(useToolStore.getState().tool).toBe('brush');
+ expect(useToolStore.getState().activePresetId).toBe('charcoal-pencil');
+ expect(useToolStore.getState().brushSettings.preset).toBe('charcoal-pencil');
+
+ // Custom .sut brush not yet in storage cache is preserved across Eraser -> Brush
+ const fakeTipImg = { complete: true } as unknown as HTMLImageElement;
+ toolStoreActions.updateBrushSettings({
+ ...NEUTRAL_BRUSH_DEFAULTS,
+ preset: 'csp-custom-ink-test',
+ brushName: 'Custom Manga Ink',
+ size: 14,
+ customTipDataUrl: 'data:image/png;base64,AAAA',
+ customTipImage: fakeTipImg,
+ });
+ toolStoreActions.selectTool('eraser');
+ toolStoreActions.selectTool('brush');
+ expect(useToolStore.getState().activePresetId).toBe('csp-custom-ink-test');
+ expect(useToolStore.getState().brushSettings.preset).toBe('csp-custom-ink-test');
+ expect(useToolStore.getState().brushSettings.brushName).toBe('Custom Manga Ink');
+ expect(useToolStore.getState().brushSettings.size).toBe(14);
+ expect(useToolStore.getState().brushSettings.customTipImage).toBe(fakeTipImg);
+ });
+
it('useDocumentStore manages tabs, dimensions, active layer, and soft proof metadata', () => {
expect(selectHasOpenDocument(useDocumentStore.getState())).toBe(false);
diff --git a/src/stores/index.ts b/src/stores/index.ts
index a72f163..6ad8147 100644
--- a/src/stores/index.ts
+++ b/src/stores/index.ts
@@ -28,3 +28,6 @@ export type { SubViewStoreState, SubViewImageItem, SubViewTransform } from './us
export { useAutoActionStore, autoActionStoreActions } from './useAutoActionStore';
export type { AutoActionStoreState } from './useAutoActionStore';
+
+export { useUpdaterStore, updaterStoreActions } from './useUpdaterStore';
+export type { UpdaterStoreState, UpdaterStatus } from './useUpdaterStore';
diff --git a/src/stores/useToolStore.ts b/src/stores/useToolStore.ts
index 6ebf54c..219f56e 100644
--- a/src/stores/useToolStore.ts
+++ b/src/stores/useToolStore.ts
@@ -35,6 +35,7 @@ export interface ToolStoreState {
tool: ToolType;
activePresetId: BrushPresetId;
brushSettings: BrushSettings;
+ lastBrushSettings: BrushSettings | null;
primaryColor: string;
secondaryColor: string;
isTransparentColor: boolean;
@@ -107,6 +108,7 @@ const createInitialToolState = (): ToolStoreState => {
tool: 'brush',
activePresetId: presetId,
brushSettings,
+ lastBrushSettings: brushSettings,
primaryColor: '#000000',
secondaryColor: '#ffffff',
isTransparentColor: false,
@@ -173,6 +175,59 @@ const createInitialToolState = (): ToolStoreState => {
export const useToolStore = createStore<ToolStoreState>(createInitialToolState);
+function isValidBrushPresetId(presetId?: string | null): presetId is BrushPresetId {
+ return Boolean(presetId && presetId !== ERASER_PRESET_ID && presetId !== 'eraser');
+}
+
+function resolveBrushPresetId(state: ToolStoreState): BrushPresetId {
+ if (isValidBrushPresetId(state.activePresetId)) {
+ return state.activePresetId;
+ }
+ if (isValidBrushPresetId(state.brushSettings.preset)) {
+ return state.brushSettings.preset;
+ }
+ if (isValidBrushPresetId(state.lastBrushSettings?.preset)) {
+ return state.lastBrushSettings.preset;
+ }
+ return getActivePresetId();
+}
+
+function buildRestoredBrushSettings(
+ state: ToolStoreState,
+ presetId: BrushPresetId
+): BrushSettings {
+ const effective = getEffectiveBrushSettings(presetId);
+ const snapshot =
+ state.lastBrushSettings && state.lastBrushSettings.preset === presetId
+ ? state.lastBrushSettings
+ : null;
+
+ // If getEffectiveBrushSettings couldn't resolve a custom brush from storage/cache
+ // and fell back to the default preset, restore the in-memory snapshot instead.
+ if (snapshot && effective.preset !== presetId) {
+ return {
+ ...snapshot,
+ preset: presetId,
+ color: state.primaryColor,
+ secondaryColor: state.secondaryColor,
+ isTransparentInk: state.isTransparentColor,
+ };
+ }
+
+ return {
+ ...state.brushSettings,
+ ...effective,
+ preset: (effective.preset || presetId) as BrushPresetId,
+ customTipImage: effective.customTipImage ?? snapshot?.customTipImage,
+ dualTipImage: effective.dualTipImage ?? snapshot?.dualTipImage,
+ paperTextureImage: effective.paperTextureImage ?? snapshot?.paperTextureImage,
+ subTipImages: effective.subTipImages ?? snapshot?.subTipImages,
+ color: state.primaryColor,
+ secondaryColor: state.secondaryColor,
+ isTransparentInk: state.isTransparentColor,
+ };
+}
+
export const toolStoreActions = {
selectTool(newTool: ToolType): void {
const state = useToolStore.getState();
@@ -180,29 +235,41 @@ export const toolStoreActions = {
if (prevTool === newTool) return;
if (newTool === 'eraser') {
+ const preservedPresetId = resolveBrushPresetId(state);
+ const preservedBrushSettings = isValidBrushPresetId(state.brushSettings.preset)
+ ? state.brushSettings
+ : state.lastBrushSettings;
const eraserSettings = getEffectiveBrushSettings(ERASER_PRESET_ID);
useToolStore.setState({
tool: newTool,
+ activePresetId: preservedPresetId,
+ lastBrushSettings: preservedBrushSettings,
brushSettings: {
...state.brushSettings,
...eraserSettings,
- color: state.brushSettings.color,
+ preset: ERASER_PRESET_ID,
+ color: state.primaryColor,
+ secondaryColor: state.secondaryColor,
+ isTransparentInk: state.isTransparentColor,
},
});
return;
}
- if (prevTool === 'eraser' && newTool === 'brush') {
- const activePreset = state.brushSettings.preset || getActivePresetId();
- const brushCfg = getEffectiveBrushSettings(activePreset);
+ const activePreset = resolveBrushPresetId(state);
+ const needsBrushRestore =
+ prevTool === 'eraser' ||
+ state.brushSettings.preset === ERASER_PRESET_ID ||
+ state.brushSettings.preset === 'eraser' ||
+ (newTool === 'brush' && state.brushSettings.preset !== activePreset);
+
+ if (needsBrushRestore) {
+ const restoredBrush = buildRestoredBrushSettings(state, activePreset);
useToolStore.setState({
tool: newTool,
- activePresetId: activePreset,
- brushSettings: {
- ...state.brushSettings,
- ...brushCfg,
- color: state.brushSettings.color,
- },
+ activePresetId: (restoredBrush.preset || activePreset) as BrushPresetId,
+ brushSettings: restoredBrush,
+ lastBrushSettings: restoredBrush,
});
return;
}
@@ -216,21 +283,26 @@ export const toolStoreActions = {
updateBrushSettings(newSettings: Partial<BrushSettings>): void {
const state = useToolStore.getState();
+ const isEraser = state.tool === 'eraser';
const next: BrushSettings = { ...state.brushSettings, ...newSettings };
- const targetPresetId =
- state.tool === 'eraser'
- ? ERASER_PRESET_ID
- : next.preset || state.brushSettings.preset || DEFAULT_BRUSH_PRESET_ID;
+ const nextValidPreset = isValidBrushPresetId(next.preset) ? next.preset : null;
+ const targetPresetId = isEraser
+ ? ERASER_PRESET_ID
+ : nextValidPreset || resolveBrushPresetId(state);
saveBrushSettingsDebounced(targetPresetId, next);
- if (next.preset && state.tool === 'brush') {
- saveActivePresetId(next.preset);
+ if (!isEraser && nextValidPreset && state.tool === 'brush') {
+ saveActivePresetId(nextValidPreset);
}
useToolStore.setState({
brushSettings: next,
activePresetId:
- next.preset && state.tool === 'brush' ? next.preset : state.activePresetId,
+ !isEraser && nextValidPreset && state.tool === 'brush'
+ ? nextValidPreset
+ : state.activePresetId,
+ lastBrushSettings:
+ !isEraser && nextValidPreset ? next : state.lastBrushSettings,
});
},
@@ -247,16 +319,18 @@ export const toolStoreActions = {
const mode = colorModeOverride ?? useDocumentStore.getState().colorMode;
const effective = enforceColorMode(color, mode);
const state = useToolStore.getState();
+ const isEraser = state.tool === 'eraser';
const nextBrush: BrushSettings = {
...state.brushSettings,
color: effective,
isTransparentInk: false,
};
- const targetPresetId =
- state.tool === 'eraser'
- ? ERASER_PRESET_ID
- : nextBrush.preset || DEFAULT_BRUSH_PRESET_ID;
+ const targetPresetId = isEraser
+ ? ERASER_PRESET_ID
+ : isValidBrushPresetId(nextBrush.preset)
+ ? nextBrush.preset
+ : resolveBrushPresetId(state);
saveBrushSettingsDebounced(targetPresetId, nextBrush);
const nextRecent = commit
@@ -270,10 +344,14 @@ export const toolStoreActions = {
primaryColor: effective,
isTransparentColor: false,
brushSettings: nextBrush,
+ lastBrushSettings:
+ !isEraser && isValidBrushPresetId(nextBrush.preset)
+ ? nextBrush
+ : state.lastBrushSettings,
recentColors: nextRecent,
});
- if (state.tool === 'eraser') {
+ if (isEraser) {
toolStoreActions.selectTool('brush');
}
},
@@ -282,15 +360,17 @@ export const toolStoreActions = {
const mode = colorModeOverride ?? useDocumentStore.getState().colorMode;
const effective = enforceColorMode(color, mode);
const state = useToolStore.getState();
+ const isEraser = state.tool === 'eraser';
const nextBrush: BrushSettings = {
...state.brushSettings,
secondaryColor: effective,
};
- const targetPresetId =
- state.tool === 'eraser'
- ? ERASER_PRESET_ID
- : nextBrush.preset || DEFAULT_BRUSH_PRESET_ID;
+ const targetPresetId = isEraser
+ ? ERASER_PRESET_ID
+ : isValidBrushPresetId(nextBrush.preset)
+ ? nextBrush.preset
+ : resolveBrushPresetId(state);
saveBrushSettingsDebounced(targetPresetId, nextBrush);
const nextRecent = commit
@@ -303,6 +383,10 @@ export const toolStoreActions = {
useToolStore.setState({
secondaryColor: effective,
brushSettings: nextBrush,
+ lastBrushSettings:
+ !isEraser && isValidBrushPresetId(nextBrush.preset)
+ ? nextBrush
+ : state.lastBrushSettings,
recentColors: nextRecent,
});
},
@@ -310,6 +394,7 @@ export const toolStoreActions = {
swapColors(colorModeOverride?: CanvasColorMode): void {
const mode = colorModeOverride ?? useDocumentStore.getState().colorMode;
const state = useToolStore.getState();
+ const isEraser = state.tool === 'eraser';
const prevPrimary = state.primaryColor;
const effectivePrimary = enforceColorMode(state.secondaryColor, mode);
const nextBrush: BrushSettings = {
@@ -318,10 +403,11 @@ export const toolStoreActions = {
secondaryColor: prevPrimary,
isTransparentInk: false,
};
- const targetPresetId =
- state.tool === 'eraser'
- ? ERASER_PRESET_ID
- : nextBrush.preset || DEFAULT_BRUSH_PRESET_ID;
+ const targetPresetId = isEraser
+ ? ERASER_PRESET_ID
+ : isValidBrushPresetId(nextBrush.preset)
+ ? nextBrush.preset
+ : resolveBrushPresetId(state);
saveBrushSettingsDebounced(targetPresetId, nextBrush);
const nextRecent = [
@@ -336,30 +422,40 @@ export const toolStoreActions = {
secondaryColor: prevPrimary,
isTransparentColor: false,
brushSettings: nextBrush,
+ lastBrushSettings:
+ !isEraser && isValidBrushPresetId(nextBrush.preset)
+ ? nextBrush
+ : state.lastBrushSettings,
recentColors: nextRecent,
});
- if (state.tool === 'eraser') {
+ if (isEraser) {
toolStoreActions.selectTool('brush');
}
},
toggleTransparentColor(): boolean {
const state = useToolStore.getState();
+ const isEraser = state.tool === 'eraser';
const next = !state.isTransparentColor;
const nextBrush: BrushSettings = {
...state.brushSettings,
isTransparentInk: next,
};
- const targetPresetId =
- state.tool === 'eraser'
- ? ERASER_PRESET_ID
- : nextBrush.preset || DEFAULT_BRUSH_PRESET_ID;
+ const targetPresetId = isEraser
+ ? ERASER_PRESET_ID
+ : isValidBrushPresetId(nextBrush.preset)
+ ? nextBrush.preset
+ : resolveBrushPresetId(state);
saveBrushSettingsDebounced(targetPresetId, nextBrush);
useToolStore.setState({
isTransparentColor: next,
brushSettings: nextBrush,
+ lastBrushSettings:
+ !isEraser && isValidBrushPresetId(nextBrush.preset)
+ ? nextBrush
+ : state.lastBrushSettings,
});
return next;
},
diff --git a/src/stores/useUiStore.ts b/src/stores/useUiStore.ts
index be9334d..0ff3d96 100644
--- a/src/stores/useUiStore.ts
+++ b/src/stores/useUiStore.ts
@@ -3,6 +3,7 @@ import { CrashedSessionInfo } from '../services/recoveryService';
import { TonalCorrectionType, ProcessingBounds } from '../utils/tonalEngine';
import { safeLocalStorageSetItem, setStorageQuotaNotifier } from '../utils/safeStorage';
import { createStore } from './createStore';
+import { useUpdaterStore } from './useUpdaterStore';
export interface TonalModalState {
isOpen: boolean;
@@ -256,7 +257,11 @@ export const uiStoreActions = {
setStorageQuotaNotifier((msg) => uiStoreActions.showToast(msg));
-export function selectIsAnyModalOpen(state: UiStoreState, isHostModalOpen = false): boolean {
+export function selectIsAnyModalOpen(
+ state: UiStoreState,
+ isHostModalOpen = false,
+ isUpdateModalOpen = useUpdaterStore.getState().isModalOpen
+): boolean {
return (
state.isNewCanvasModalOpen ||
state.isResizeCanvasModalOpen ||
@@ -269,6 +274,7 @@ export function selectIsAnyModalOpen(state: UiStoreState, isHostModalOpen = fals
state.tonalModalState.isOpen ||
state.adjustmentModalState.isOpen ||
state.layerStylesModalState.isOpen ||
- isHostModalOpen
+ isHostModalOpen ||
+ isUpdateModalOpen
);
}
diff --git a/src/stores/useUpdaterStore.ts b/src/stores/useUpdaterStore.ts
new file mode 100644
index 0000000..e1a9227
--- /dev/null
+++ b/src/stores/useUpdaterStore.ts
@@ -0,0 +1,59 @@
+import { version as PACKAGE_VERSION } from '../../package.json';
+import { createStore } from './createStore';
+
+export type UpdaterStatus =
+ | 'idle'
+ | 'checking'
+ | 'available'
+ | 'up-to-date'
+ | 'downloading'
+ | 'ready'
+ | 'error';
+
+export interface UpdaterStoreState {
+ status: UpdaterStatus;
+ currentVersion: string;
+ availableVersion: string | null;
+ releaseDate: string | null;
+ releaseNotes: string | null;
+ downloadedBytes: number;
+ totalBytes: number | null;
+ progressPercent: number;
+ errorMessage: string | null;
+ isBannerDismissed: boolean;
+ isModalOpen: boolean;
+}
+
+const createInitialUpdaterState = (): UpdaterStoreState => ({
+ status: 'idle',
+ currentVersion: PACKAGE_VERSION,
+ availableVersion: null,
+ releaseDate: null,
+ releaseNotes: null,
+ downloadedBytes: 0,
+ totalBytes: null,
+ progressPercent: 0,
+ errorMessage: null,
+ isBannerDismissed: false,
+ isModalOpen: false,
+});
+
+export const useUpdaterStore = createStore<UpdaterStoreState>(createInitialUpdaterState);
+
+export const updaterStoreActions = {
+ dismissBanner(): void {
+ useUpdaterStore.setState({ isBannerDismissed: true });
+ },
+
+ openUpdateModal(): void {
+ useUpdaterStore.setState({ isModalOpen: true, isBannerDismissed: true });
+ },
+
+ closeUpdateModal(): void {
+ useUpdaterStore.setState({ isModalOpen: false });
+ },
+
+ reset(): void {
+ useUpdaterStore.reset();
+ },
+};
diff --git a/src/types/multiplayer.ts b/src/types/multiplayer.ts
index 19971d7..7cff5dc 100644
--- a/src/types/multiplayer.ts
+++ b/src/types/multiplayer.ts
@@ -135,6 +135,8 @@ export interface DocSyncRequestMessage extends BaseMultiplayerMessage {
export interface DocSyncResponseMessage extends BaseMultiplayerMessage {
type: 'DOC_SYNC_RESPONSE';
targetPeerId: string | number;
+ roomName?: string;
+ assignedLayerId?: string;
dimensions: CanvasDimensions;
colorMode: CanvasColorMode;
layers: LayerItem[];
diff --git a/src/types/settings.ts b/src/types/settings.ts
index a28bc04..dc25148 100644
--- a/src/types/settings.ts
+++ b/src/types/settings.ts
@@ -215,6 +215,10 @@ export interface AppSettings {
// Performance & Scratch Disk
tileMemoryBudgetMb: number;
+
+ // Auto-Updater (Desktop)
+ autoCheckUpdates: boolean;
+ skippedUpdateVersion: string;
}
export const DEFAULT_APP_SETTINGS: AppSettings = {
@@ -249,6 +253,9 @@ export const DEFAULT_APP_SETTINGS: AppSettings = {
},
tileMemoryBudgetMb: 1024,
+
+ autoCheckUpdates: true,
+ skippedUpdateVersion: '',
};
const VALID_MODIFIER_ACTIONS = new Set<ModifierAction>([
@@ -400,6 +407,14 @@ export function loadAppSettings(): AppSettings {
typeof parsed.tileMemoryBudgetMb === 'number' && parsed.tileMemoryBudgetMb >= 256 && parsed.tileMemoryBudgetMb <= 8192
? parsed.tileMemoryBudgetMb
: 1024;
+ const validAutoCheckUpdates: boolean =
+ typeof parsed.autoCheckUpdates === 'boolean'
+ ? parsed.autoCheckUpdates
+ : DEFAULT_APP_SETTINGS.autoCheckUpdates;
+ const validSkippedUpdateVersion: string =
+ typeof parsed.skippedUpdateVersion === 'string'
+ ? parsed.skippedUpdateVersion.trim()
+ : DEFAULT_APP_SETTINGS.skippedUpdateVersion;
return {
...DEFAULT_APP_SETTINGS,
...parsed,
@@ -410,6 +425,8 @@ export function loadAppSettings(): AppSettings {
modernCustomColor: validCustomColor,
uiTone: validTone,
tileMemoryBudgetMb: validBudget,
+ autoCheckUpdates: validAutoCheckUpdates,
+ skippedUpdateVersion: validSkippedUpdateVersion,
shortcuts: sanitizeShortcuts(parsed.shortcuts),
modifierKeys: sanitizeModifierKeys(parsed.modifierKeys),
pressureCurve: sanitizePressureCurve(parsed.pressureCurve),
diff --git a/src/utils/__tests__/multiplayerFixes.test.ts b/src/utils/__tests__/multiplayerFixes.test.ts
new file mode 100644
index 0000000..d0f9c46
--- /dev/null
+++ b/src/utils/__tests__/multiplayerFixes.test.ts
@@ -0,0 +1,50 @@
+import { describe, it, expect } from 'vitest';
+import { parseInviteUrl } from '../../services/multiplayerService';
+
+describe('Multiplayer Invite URL Parsing', () => {
+ it('parses worldwide Cloudflare HTTPS invite links with secure flag and port 443', () => {
+ const parsed = parseInviteUrl(
+ 'https://warm-ink-42.trycloudflare.com/?room=My%20Canvas&token=abc123'
+ );
+ expect(parsed).toEqual({
+ roomName: 'My Canvas',
+ host: 'warm-ink-42.trycloudflare.com',
+ port: 443,
+ url: 'https://warm-ink-42.trycloudflare.com/?room=My%20Canvas&token=abc123',
+ token: 'abc123',
+ isSecure: true,
+ });
+ });
+
+ it('parses local LAN HTTP invite links with explicit port', () => {
+ const parsed = parseInviteUrl('http://192.168.1.42:30303/?room=LAN%20Room&token=tok999');
+ expect(parsed).toEqual({
+ roomName: 'LAN Room',
+ host: '192.168.1.42',
+ port: 30303,
+ url: 'http://192.168.1.42:30303/?room=LAN%20Room&token=tok999',
+ token: 'tok999',
+ isSecure: false,
+ });
+ });
+
+ it('parses forsora:// deep links and preserves HTTPS protocol flag', () => {
+ const parsed = parseInviteUrl(
+ 'forsora://join?host=cool-cat.trycloudflare.com&port=443&room=Collab&token=xyz&protocol=https'
+ );
+ expect(parsed).toMatchObject({
+ roomName: 'Collab',
+ host: 'cool-cat.trycloudflare.com',
+ port: 443,
+ token: 'xyz',
+ isSecure: true,
+ });
+ });
+
+ it('rejects invalid or non-room URLs', () => {
+ expect(parseInviteUrl('')).toBeNull();
+ expect(parseInviteUrl('not-a-url')).toBeNull();
+ expect(parseInviteUrl('https://example.com/no-room')).toBeNull();
+ expect(parseInviteUrl('javascript:alert(1)')).toBeNull();
+ });
+});
diff --git a/src/utils/__tests__/settings.test.ts b/src/utils/__tests__/settings.test.ts
index 314f2a0..4e82615 100644
--- a/src/utils/__tests__/settings.test.ts
+++ b/src/utils/__tests__/settings.test.ts
@@ -86,4 +86,44 @@ describe('settings theme & accent system', () => {
});
expect(loadAppSettings().uiTone).toBe('charcoal');
});
+
+ it('defaults and sanitizes autoCheckUpdates and skippedUpdateVersion safely for legacy storage', () => {
+ const defaults = loadAppSettings();
+ expect(defaults.autoCheckUpdates).toBe(true);
+ expect(defaults.skippedUpdateVersion).toBe('');
+
+ // Legacy user settings missing updater fields
+ localStorage.setItem(
+ 'ink_studio_app_settings',
+ JSON.stringify({
+ themePreset: 'modern',
+ modernAccent: 'blue',
+ })
+ );
+ const migrated = loadAppSettings();
+ expect(migrated.autoCheckUpdates).toBe(true);
+ expect(migrated.skippedUpdateVersion).toBe('');
+
+ // Corrupted updater field types fall back safely
+ localStorage.setItem(
+ 'ink_studio_app_settings',
+ JSON.stringify({
+ autoCheckUpdates: 'yes',
+ skippedUpdateVersion: 12345,
+ })
+ );
+ const sanitized = loadAppSettings();
+ expect(sanitized.autoCheckUpdates).toBe(true);
+ expect(sanitized.skippedUpdateVersion).toBe('');
+
+ // Valid persisted values round-trip cleanly
+ saveAppSettings({
+ ...DEFAULT_APP_SETTINGS,
+ autoCheckUpdates: false,
+ skippedUpdateVersion: ' 1.2.3 ',
+ });
+ const roundTripped = loadAppSettings();
+ expect(roundTripped.autoCheckUpdates).toBe(false);
+ expect(roundTripped.skippedUpdateVersion).toBe('1.2.3');
+ });
});
diff --git a/src/utils/__tests__/shortcutManager.test.ts b/src/utils/__tests__/shortcutManager.test.ts
index e9fea4a..ef33ee5 100644
--- a/src/utils/__tests__/shortcutManager.test.ts
+++ b/src/utils/__tests__/shortcutManager.test.ts
@@ -51,6 +51,19 @@ describe('Shortcut Parsing, Normalization & Matching', () => {
matchesKeyboardEvent({ key: 'я', code: 'KeyZ', ctrlKey: true }, 'Ctrl+Z')
).toBe(true);
+ // QWERTZ layout pressing Z (located on physical KeyY) triggers Ctrl+Z, not Ctrl+Y
+ expect(
+ matchesKeyboardEvent({ key: 'z', code: 'KeyY', ctrlKey: true }, 'Ctrl+Z')
+ ).toBe(true);
+ expect(
+ matchesKeyboardEvent({ key: 'z', code: 'KeyY', ctrlKey: true }, 'Ctrl+Y')
+ ).toBe(false);
+
+ // AZERTY layout pressing Z (located on physical KeyW) triggers Ctrl+Z
+ expect(
+ matchesKeyboardEvent({ key: 'z', code: 'KeyW', ctrlKey: true }, 'Ctrl+Z')
+ ).toBe(true);
+
// Rejects extra modifiers
expect(
matchesKeyboardEvent({ key: 'z', code: 'KeyZ', ctrlKey: true, shiftKey: true }, 'Ctrl+Z')
diff --git a/src/utils/brushPresetManager.ts b/src/utils/brushPresetManager.ts
index 78639cd..5106374 100644
--- a/src/utils/brushPresetManager.ts
+++ b/src/utils/brushPresetManager.ts
@@ -379,6 +379,7 @@ export function getActivePresetId(): string {
}
export function saveActivePresetId(presetId: string): void {
+ if (!presetId || presetId === ERASER_PRESET_ID || presetId === 'eraser') return;
safeLocalStorageSetItem(STORAGE_KEY_ACTIVE_PRESET, presetId, 'active brush preset');
}
diff --git a/src/utils/shortcutManager.ts b/src/utils/shortcutManager.ts
index c7cc22b..5e1228a 100644
--- a/src/utils/shortcutManager.ts
+++ b/src/utils/shortcutManager.ts
@@ -725,10 +725,16 @@ export function matchesKeyboardEvent(e: KeyboardEventLike, shortcutStr: string):
return false;
}
+ // For single ASCII letters (e.g. QWERTY, QWERTZ, AZERTY, Dvorak), respect the layout's
+ // actual letter so Ctrl+Z on QWERTZ/AZERTY triggers Undo instead of Redo/nothing.
+ // For non-Latin layouts (e.g. Cyrillic 'я' on KeyZ), fall through to layout-independent e.code.
+ if (e.key && /^[a-zA-Z]$/.test(e.key) && /^Key[A-Z]$/.test(parsed.code)) {
+ return e.key.toUpperCase() === parsed.key;
+ }
+
if (e.code) {
if (e.code === parsed.code) return true;
if (parsed.altCodes && parsed.altCodes.includes(e.code)) return true;
- // Allow e.key match only when code does not contradict a different known letter/digit
return false;
}