From 22fa5d7bd75eead66ca9a69f928ed3851437aae0 Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Wed, 25 Nov 2026 15:12:09 +0800 Subject: [PATCH] release: prepare Shift 0.1.14 Add the changelog and an install/first-run guide, and relicense the project under GPL-3.0 with copyright held by mula.liu. --- CHANGELOG.md | 177 +++++++ LICENSE | 692 ++++++++++++++++++++++++++- README.md | 16 +- README.zh-CN.md | 16 +- THIRD_PARTY_NOTICES.md | 3 +- artifacts/README-macOS-universal.txt | 10 +- docs/ENGINEERING-NOTES.md | 3 +- docs/INSTALL.md | 138 ++++++ docs/MOBILE.md | 2 +- docs/README.md | 2 + docs/RELEASE.md | 29 +- docs/SECURITY.md | 5 +- package.json | 3 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 5 +- src-tauri/src/update.rs | 116 +++-- src-tauri/tauri.conf.json | 2 +- 17 files changed, 1128 insertions(+), 93 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 docs/INSTALL.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c652c83 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,177 @@ +# Changelog + +All notable changes to Shift are recorded here. The format follows +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses +[Semantic Versioning](https://semver.org/spec/v2.0.0.html). Shift is at `0.x`, +so a minor bump may still change behaviour. + +Installers and the update manifest live on the `releases` branch of the upstream +repository, not in the source tree. See [`docs/INSTALL.md`](docs/INSTALL.md) +for installation and [`docs/RELEASE.md`](docs/RELEASE.md) for the channel +itself. + +## 0.1.14 — 2026-11-20 + +### Fixed + +- **In-app updates on Windows now actually run.** The handoff script receives + the process id, installer and log paths in its own body, and `cmd.exe` gets a + single quoted script path. Profiles whose folder names contain spaces no + longer lose the script's quotes and silently skip the install. +- The app icon is the orange ground with the white mark, matching the identity + the product has shipped with, rather than a re-tinted variant. + +### Changed + +- Relicensed from MIT to GPL-3.0. Copyright is now held by mula.liu. + +## 0.1.13 — 2026-11-19 + +### Added + +- **Release banner in the main window.** A new version shows as + “Shift *x.y.z* is available” with a button that opens Settings → Software + updates. The notice is stored on disk, so it survives the launch that + installs the update instead of disappearing with the process. + +### Changed + +- One icon mark drawn twice: a tinted version for the shell and tray, and the + full-colour version for the dock. + +## 0.1.12 — 2026-11-19 + +### Fixed + +- **One-click component install works on Windows.** Missing Pandoc, FFmpeg, + Poppler, ImageMagick or Typst can be installed from Settings → Runtime + components and are re-detected when the install finishes. +- A pinned image has a working enlarge control again. +- Favourites are visible without hovering, and thumbnails are only decoded for + rows that are actually on screen. +- The tray uses a black/white system mark instead of the colour wheel. + +### Changed + +- Sampling stops when no window is looking at the history, cutting idle cost. + The measured A/B is recorded in `docs/ENGINEERING-NOTES.md`. + +## 0.1.11 — 2026-11-06 + +### Fixed + +- **Dropping onto a button now finishes the same way on Windows.** A row dragged + from the Recent list, and a file dragged from Explorer, spend the button they + land on instead of one path falling back to a different action. +- A button that cannot serve the dragged file is disabled for the gesture, and + the prohibition is carried by the cursor instead of a second icon drawn on the + button. +- The drag-end fallback no longer consumes the drop it was waiting for. + +### Changed + +- The OCR button is spent instead of explaining a refusal, and the app uses one + voice across its panels. + +## 0.1.10 — 2026-11-01 + +### Changed + +- The drop gesture is quieter: only the three drop targets respond while a drag + is in flight, and the panel around them stays still. +- OCR only accepts images; a non-image drop is refused during the gesture + rather than opening an empty ring. + +## 0.1.9 — 2026-11-01 + +### Added + +- **Drop a file onto a button.** Convert files, File tools and OCR are drop + targets in the main window, and the button you release on decides the action. + +### Fixed + +- The document renderer reports the bundled companion binary on macOS instead + of a path that only exists on the build machine. + +## 0.1.8 — 2026-10-27 + +### Added + +- The release public key is baked into macOS packages, so a signed manifest can + be verified by the build that ships it. +- `pnpm mac:release` produces the versioned DMG and its checksums in one step. + +### Changed + +- macOS ships a DMG only. The `.pkg` published for 0.1.7 is retired; the DMG is + both the first-install path and the in-app update payload. + +## 0.1.7 — 2026-10-26 + +### Fixed + +- **Device discovery survives networks that drop both multicast and broadcast.** + Instances fall back to a unicast scan of the local subnet, and every ordinary + beacon is answered with a unicast reply so a device no longer appears once and + then expires. +- The device list keeps an entry for 15 seconds, which clears stale peers after + a network change while leaving room for older builds to answer. + +## 0.1.6 — 2026-10-26 + +### Fixed + +- Peers are discovered on Wi-Fi networks that filter multicast: each instance + also sends a directed broadcast to every enabled IPv4 subnet. + +## 0.1.5 — 2026-10-26 + +### Fixed + +- Device discovery survives an upgrade, and the app declares the macOS local + network usage description so the permission prompt names the feature. + +## 0.1.4 — 2026-10-26 + +### Fixed + +- **Figures survive every conversion.** Images referenced by relative paths are + kept when a DOCX is printed to PDF and when a Markdown document is converted. +- Install and discard read as one decision in the update panel. + +### Changed + +- macOS builds are ad-hoc signed so a fresh machine can open them, and the DMG + replaces the `.pkg` as the shipped artifact. + +## 0.1.3 — 2026-10-26 + +### Added + +- **The Recent list survives an upgrade.** History moved from Webview storage + into `history.json` in the app data directory, and the first launch after the + upgrade adopts records left in the old store. + +## 0.1.2 — 2026-10-26 + +### Added + +- **Install an update in place.** macOS replaces its own `.app` from the + downloaded DMG, and Windows runs the installer after the process exits; both + relaunch the new version. +- The update tab leads with the host, architecture, current version and feed it + actually reads. + +## 0.1.1 — 2026-10-26 + +First tagged release. + +### Added + +- **Git-backed update channel.** A `releases` branch carries the manifest and + installers; the app checks it daily and verifies size and SHA256 before + handing a download to the installer. +- macOS universal and Windows x64 installers, with a Linux source-build target + that is not a shipped product. +- Settings and UI trims, plus the documentation set this file belongs to. diff --git a/LICENSE b/LICENSE index 8c27c9b..c1b3de4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,691 @@ -MIT License +Shift +Copyright (C) 2026 mula.liu -Copyright (c) 2026 Shift Contributors +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, version 3. + +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 . + +--- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff --git a/README.md b/README.md index 2970b9a..ecf1092 100644 --- a/README.md +++ b/README.md @@ -294,13 +294,15 @@ Each is overridable in Settings. File actions offer a *collect everything in one ## Updates -A new macOS machine installs **`Shift-0.1.13-macOS-universal.dmg`**: builds are ad-hoc signed and not notarized, so Gatekeeper calls Shift an unidentified developer. Double-click the image, drag `Shift.app` to /Applications, then allow the first launch once (right-click → Open, or 允许 in System Settings → Privacy & Security). In-app updates download the same image without a browser, so they never prompt. Details in `docs/RELEASE.md`. +Installing for the first time? [`docs/INSTALL.md`](docs/INSTALL.md) covers both platforms, first-run permissions and troubleshooting. -The update channel is this repository: a `releases` branch holding the installers plus `shift-update.json`, which names each artifact, its size and its SHA256. The feed URL is derived from the git remote at build time - Gitea, GitHub and GitLab forms are known, and `SHIFT_UPDATE_URL` overrides it - so no update service has to be deployed anywhere. +A new macOS machine installs **`Shift-0.1.14-macOS-universal.dmg`**: builds are ad-hoc signed and not notarized, so Gatekeeper calls Shift an unidentified developer. Double-click the image, drag `Shift.app` to /Applications, then allow the first launch once (right-click → Open, or Allow in System Settings → Privacy & Security). In-app updates download the same image without a browser, so they never prompt. Details in `docs/RELEASE.md`. + +The update channel is the upstream repository: a `releases` branch holding the installers plus `shift-update.json`, which names each artifact, its size and its SHA256. The feed URL is derived from the git remote at build time - Gitea, GitHub and GitLab forms are known, and `SHIFT_UPDATE_URL` overrides it - so no update service has to be deployed anywhere. Once a day at startup, and on demand from Settings -> **Updates**, Shift reads the manifest, compares versions with semver rules including prereleases, and offers a download. A release that has been found is announced at the top of the main window - **Shift x.y.z is available**, with one button that opens Settings -> Updates - and it stays announced across restarts, including the restart that follows an update, because the notice is remembered on disk rather than held in memory. Since the probe itself runs at most once a day, a notice that only lived in RAM would be visible on the morning it was discovered and invisible every launch after. A downloaded installer must match the manifest's exact byte length and recomputed SHA256, and both checks run again immediately before the handoff that installs it. A mismatch deletes the file and reports the error, so a truncated or replaced installer never launches. **Discard** removes the downloaded installer as well as the status. Publishing is one command, `scripts/publish-release.sh`, and `docs/RELEASE.md` covers the manifest format, the flags, and the difference between the integrity the hash proves and the authenticity a signed manifest adds (`--key` plus a key baked in with `SHIFT_UPDATE_PUBKEY`). -**Install & relaunch** finishes the update without leaving the app. macOS replaces its own `.app` bundle from the downloaded disk image and Windows runs the same installer silently, both from a helper script that starts once Shift has quit and then opens the new copy - so a conversion is interrupted, but nothing is left half-installed and a failed swap reopens the copy you had. The helper receives its paths as process arguments or environment variables, never by splicing them into the shell or batch script; the Windows launcher also keeps the outer quote layer `cmd.exe /C` otherwise strips from a path containing spaces. The tab states your operating system, architecture, running version and the feed it reads above everything else, so one screenshot explains any report about an update. +**Install & relaunch** finishes the update without leaving the app. macOS replaces its own `.app` bundle from the downloaded disk image and Windows runs the same installer silently, both from a helper script that starts once Shift has quit and then opens the new copy - so a conversion is interrupted, but nothing is left half-installed and a failed swap reopens the copy you had. The Windows helper follows the same launch contract as Squid: `cmd.exe` receives only one quoted script path, and the pid, installer and log paths are written into that script, so a temp path containing spaces is never split into extra command-line tokens. The tab states your operating system, architecture, running version and the feed it reads above everything else, so one screenshot explains any report about an update. ## External dependencies @@ -379,7 +381,7 @@ pnpm mac:release scripts/build-windows-release.sh ``` -The release pipeline deliberately emits exactly two installers: `Shift-0.1.13-macOS-universal.dmg` and `Shift-Setup-0.1.13-win-x64.exe`. The macOS app is one universal Mach-O including universal drag, PDF-render and doc-render sidecars. Windows ARM64 uses the x64 installer through the update manifest's compatibility fallback. Full details are in `docs/BUILD_WINDOWS.md` and `docs/RELEASE.md`. +The release pipeline deliberately emits exactly two installers: `Shift-0.1.14-macOS-universal.dmg` and `Shift-Setup-0.1.14-win-x64.exe`. The macOS app is one universal Mach-O including universal drag, PDF-render and doc-render sidecars. Windows ARM64 uses the x64 installer through the update manifest's compatibility fallback. Full details are in `docs/BUILD_WINDOWS.md` and `docs/RELEASE.md`. **Permissions (macOS).** Screen Recording for capture, Files & Folders for the output folders you choose, Microphone when recording with audio, and Local Network for **Send to a device**. Shift checks Screen Recording before opening the overlay, so a denial surfaces an actionable error rather than a black screenshot. A denied Local Network grant is quieter: Shift still sends its beacons and still answers anyone who addresses it directly, but it receives no group traffic, so the device list simply stays empty. Ad-hoc signed builds get a new code identity on every rebuild and macOS keys these grants to that identity, so an upgrade can ask again; distribution with Developer ID keeps them stable. @@ -423,6 +425,8 @@ The radial hit-test is pure geometry — one polar calculation shared by native ## Documentation +- [`docs/INSTALL.md`](docs/INSTALL.md) — installation, first-run permissions, optional components, troubleshooting and uninstall. +- [`CHANGELOG.md`](CHANGELOG.md) — what changed in each version. - [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — process/window model, module boundaries, event and data flows. - [`docs/SPECIFICATION.md`](docs/SPECIFICATION.md) — product behaviour, output naming, platform differences and acceptance criteria. - [`docs/SECURITY.md`](docs/SECURITY.md) — trust boundaries, update integrity, LAN-transfer limits and residual risks. @@ -518,10 +522,10 @@ Adding a format is one entry in `conversionFormats` in `src/lib/conversionFormat `.github/workflows/ci.yml` defines macOS, Windows and Linux jobs. The workflow runs type checks, TypeScript tests, Rust formatting and tests on every job, plus Clippy and a universal macOS app build. Whether the current forge executes it depends on whether that forge has a runner configured; a local run remains the release gate, and no CI result should be inferred without a linked log. Full setup and the pre-push checklist are in [`CONTRIBUTING.md`](CONTRIBUTING.md). -**Forks and derivative works are welcome.** You may use, modify, redistribute, and build on this code commercially, provided you keep the copyright notice and the LICENSE file. +**Forks and derivative works are welcome.** You may use, modify and redistribute this code, including commercially, under the terms of the GNU GPL v3: derivative works must stay under the same license and ship their source. ## License -Released under the **MIT License** — see [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). +Released under the **GNU General Public License v3.0**. Copyright (C) 2026 mula.liu. See [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). The app builds against Tauri (MIT / Apache-2.0), React (MIT), Lucide (ISC), and Tesseract.js with its English and Simplified Chinese models (Apache-2.0). diff --git a/README.zh-CN.md b/README.zh-CN.md index 3388949..c4ad3cd 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -296,13 +296,15 @@ Shift 会持续维护局域网内其他 Shift 实例的列表,并据此提供 ## 软件更新 -新的 macOS 机器请安装 **`Shift-0.1.13-macOS-universal.dmg`**:本项目的构建采用 ad-hoc 签名且未做公证,Gatekeeper 会把 Shift 判为身份不明的开发者。双击挂载镜像,把 `Shift.app` 拖进「应用程序」,然后允许首次启动一次(右键 → 打开,或在「系统设置 → 隐私与安全性」中点「允许」)。软件内升级自己下载的是同一个镜像、不经浏览器,因此不会弹窗。详见 `docs/RELEASE.md`。 +第一次安装?macOS 与 Windows 的安装步骤、首次运行授权与故障排查见 [`docs/INSTALL.md`](docs/INSTALL.md)。 -更新通道就是这个仓库:一条 `releases` 分支保存安装包以及 `shift-update.json` 清单,清单写明每个安装包的名称、体积与 SHA256。更新源地址在构建时由 git 远端推导——已适配 Gitea、GitHub、GitLab 三种形式,也可用 `SHIFT_UPDATE_URL` 覆盖——因此无需额外部署任何更新服务。 +新的 macOS 机器请安装 **`Shift-0.1.14-macOS-universal.dmg`**:本项目的构建采用 ad-hoc 签名且未做公证,Gatekeeper 会把 Shift 判为身份不明的开发者。双击挂载镜像,把 `Shift.app` 拖进「应用程序」,然后允许首次启动一次(右键 → 打开,或在「系统设置 → 隐私与安全性」中点「允许」)。软件内升级自己下载的是同一个镜像、不经浏览器,因此不会弹窗。详见 `docs/RELEASE.md`。 + +更新通道就是上游仓库:一条 `releases` 分支保存安装包以及 `shift-update.json` 清单,清单写明每个安装包的名称、体积与 SHA256。更新源地址在构建时由 git 远端推导——已适配 Gitea、GitHub、GitLab 三种形式,也可用 `SHIFT_UPDATE_URL` 覆盖——因此无需额外部署任何更新服务。 Shift 每天启动时检查一次(也可在设置 → **软件更新** 中手动检查),读取清单、按含预发布规则的 semver 比较版本,然后提供下载。发现的版本会显示在主窗口顶部——「Shift x.y.z 可以升级了」,旁边一个按钮直接跳到设置 → 软件更新——并且**跨启动保留**,包括升级装完之后的那一次启动:提示是记在磁盘上的,不是只存在内存里。探测本身一天最多跑一次,所以只活在内存里的话,新版本只在被发现的问题当天出现,之后每次启动都再也看不到。下载完成的安装包必须与清单的体积和重新计算的 SHA256 一致,而且这两项会在交接给安装脚本前**再次校验**。任一不符即删除文件并明确报错,因此半成品或被替换的安装包永远不会启动。点击「丢弃」会同时删除已下载的安装包和状态。发布只需一条命令 `scripts/publish-release.sh`;`docs/RELEASE.md` 说明清单格式、参数,以及可选的 ed25519 清单签名——签名用来证明清单的来源,而不只是下载内容与清单一致。 -**「安装并重启」让你在应用内完成升级**:macOS 会用下载好的磁盘镜像替换自己的 `.app`,Windows 会静默运行同一个安装程序,两者都由一个在 Shift 退出后才启动的辅助脚本执行,完成后自动打开新版本——正在进行的转换会被中断,但不会装到一半卡住,替换失败也会重新打开原来的版本。辅助脚本通过进程参数或环境变量接收路径,路径不会被拼接进 shell 或批处理脚本文本;Windows 启动器还保留了一层外层引号,否则 `cmd.exe /C` 会把含空格路径的首尾引号剥掉。该标签页最上方依次显示本机系统、架构、当前版本与更新源,截一张图就能说明升级问题出在哪里。 +**「安装并重启」让你在应用内完成升级**:macOS 会用下载好的磁盘镜像替换自己的 `.app`,Windows 会静默运行同一个安装程序,两者都由一个在 Shift 退出后才启动的辅助脚本执行,完成后自动打开新版本——正在进行的转换会被中断,但不会装到一半卡住,替换失败也会重新打开原来的版本。Windows 交接与 Squid 使用同一套启动契约:`cmd.exe` 只接收一个带引号的脚本路径,pid、安装包与日志路径直接写进脚本,因此含空格的临时目录不会被拆成额外的命令行参数。该标签页最上方依次显示本机系统、架构、当前版本与更新源,截一张图就能说明升级问题出在哪里。 ## 外部依赖 @@ -370,7 +372,7 @@ pnpm mac:release scripts/build-windows-release.sh ``` -发布链只产出两个安装包:`Shift-0.1.13-macOS-universal.dmg` 与 `Shift-Setup-0.1.13-win-x64.exe`。macOS 是单个通用 Mach-O,内含通用版的拖拽、PDF 渲染与文档渲染伴生进程;Windows ARM64 通过更新清单的兼容回退使用 x64 安装包。完整步骤见 `docs/BUILD_WINDOWS.md` 与 `docs/RELEASE.md`。 +发布链只产出两个安装包:`Shift-0.1.14-macOS-universal.dmg` 与 `Shift-Setup-0.1.14-win-x64.exe`。macOS 是单个通用 Mach-O,内含通用版的拖拽、PDF 渲染与文档渲染伴生进程;Windows ARM64 通过更新清单的兼容回退使用 x64 安装包。完整步骤见 `docs/BUILD_WINDOWS.md` 与 `docs/RELEASE.md`。 **权限(macOS)。** 截图与录屏需要「屏幕录制」,输出目录需要「文件与文件夹」授权,带声音录屏需要「麦克风」,「发送到设备」需要「本地网络」。Shift 会在打开截图遮罩前先检查屏幕录制权限,因此被拒绝时给出的是可操作的提示,而不是一张全黑的截图。「本地网络」被拒绝时比较安静:Shift 仍会发出广播、也能回应主动找它的实例,但收不到组播,设备列表于是始终为空。ad-hoc 签名每次重新构建都会得到新的代码身份,而 macOS 正是按这个身份记录上述授权,所以升级后可能重新询问;改用 Developer ID 签名即可保持稳定。 @@ -413,6 +415,8 @@ OCR:Tesseract.js WASM + 内置 eng/chi_sim,进程内运行,完全离线 ## 技术文档 +- [`docs/INSTALL.md`](docs/INSTALL.md) —— 安装、首次运行授权、可选组件、故障排查与卸载。 +- [`CHANGELOG.md`](CHANGELOG.md) —— 每个版本改了什么。 - [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) —— 进程/窗口模型、模块边界、事件与数据流。 - [`docs/SPECIFICATION.md`](docs/SPECIFICATION.md) —— 产品行为规范、输出命名、平台差异与验收标准。 - [`docs/SECURITY.md`](docs/SECURITY.md) —— 信任边界、更新完整性、局域网传输限制与剩余风险。 @@ -507,10 +511,10 @@ Shift 对文件做的任何处理都不会发起互联网请求。文件在本 `.github/workflows/ci.yml` 定义了 macOS、Windows、Linux 三个任务。每个任务都会运行类型检查、TypeScript 测试、Rust 格式检查与单元测试;macOS 任务还运行 Clippy 和通用应用构建。当前托管平台是否真正执行这些任务,取决于它是否配置了执行器;本地运行仍是发布门禁,没有链接到实际日志时不得声称 CI 已通过。完整环境与推送前检查见 [`CONTRIBUTING.md`](CONTRIBUTING.md)。 -**欢迎二次开发。** 你可以免费使用、修改、再发布本代码,也可用于商业项目,只需保留原版权声明与 LICENSE 文件。 +**欢迎二次开发。** 你可以免费使用、修改、再发布本代码,也可用于商业项目,但衍生作品必须同样以 GNU GPL v3 发布并提供源码。 ## 许可证 -以 **MIT 许可证**发布——见 [LICENSE](LICENSE) 与 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。 +以 **GNU 通用公共许可证 v3.0** 发布。版权所有 (C) 2026 mula.liu。见 [LICENSE](LICENSE) 与 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。 本应用构建使用了 Tauri(MIT / Apache-2.0)、React(MIT)、Lucide(ISC),以及 Tesseract.js 与其英文、简体中文模型(Apache-2.0)。 diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 05f5bf5..23e4ae2 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -1,6 +1,7 @@ # Third-party notices -Shift includes or builds against the following open-source components: +Shift itself is licensed under GPL-3.0; see `LICENSE`. It includes or builds +against the following open-source components: - Tauri: MIT or Apache-2.0. - React: MIT. diff --git a/artifacts/README-macOS-universal.txt b/artifacts/README-macOS-universal.txt index 7477673..bf1c02b 100644 --- a/artifacts/README-macOS-universal.txt +++ b/artifacts/README-macOS-universal.txt @@ -1,4 +1,4 @@ -Shift 0.1.13 - macOS 通用(universal) +Shift 0.1.14 - macOS 通用(universal) 本文件说明 macOS 安装包是怎么打出来的、在其它机器上会遇到什么,以及如何自己校验。 完整细节见仓库 docs/RELEASE.md 的「macOS packaging」和 docs/ENGINEERING-NOTES.md @@ -8,7 +8,7 @@ Shift 0.1.13 - macOS 通用(universal) 关于这个安装包 -------------- -Shift 的 macOS 产物只有一个:Shift-0.1.13-macOS-universal.dmg,通用二进制,Apple silicon 与 +Shift 的 macOS 产物只有一个:Shift-0.1.14-macOS-universal.dmg,通用二进制,Apple silicon 与 Intel 都能用。它既是新机器的首次安装方式,也是软件内升级的载体(更新清单里的 macos 键指向它)。清单的键必须是 .dmg,因为软件内升级的交接脚本要用 hdiutil 挂载镜像再 取出应用包;早期曾随包发布的 .pkg 在验证过 DMG 可用后就撤掉了,不为它多维护一份 @@ -23,7 +23,7 @@ Intel 都能用。它既是新机器的首次安装方式,也是软件内升 ---------------- 新机器首次安装 - 1. 下载并双击 Shift-0.1.13-macOS-universal.dmg 挂载镜像。 + 1. 下载并双击 Shift-0.1.14-macOS-universal.dmg 挂载镜像。 2. 把 Shift.app 拖进「应用程序」(或任何你有权限的位置)。 3. 首次启动会被拦:「无法打开,因为来自身份不明的开发者」。点取消,然后 右键 Shift.app → 打开,或在「系统设置 → 隐私与安全性」中点「仍要打开」。 @@ -70,7 +70,7 @@ macOS 权限 pnpm tauri build --target universal-apple-darwin --bundles app,dmg -`pnpm mac:release` 会构建、校验并复制为 artifacts/Shift-0.1.13-macOS-universal.dmg。 +`pnpm mac:release` 会构建、校验并复制为 artifacts/Shift-0.1.14-macOS-universal.dmg。 发布流程(清单、签名、推送)见仓库 docs/RELEASE.md。 若希望更新通道能校验来源,构建时把 ed25519 公钥编进去(发布流程见仓库 @@ -96,7 +96,7 @@ docs/RELEASE.md 的「Signing the channel」): 镜像完整性: - hdiutil verify Shift-0.1.13-macOS-universal.dmg + hdiutil verify Shift-0.1.14-macOS-universal.dmg 校验后仍打不开的话,请确认不是在压缩包预览窗口里运行的,并按上面的「新机器首次安装」 处理首次允许:右键 → 打开,或在「系统设置 → 隐私与安全性」中点「仍要打开」。 diff --git a/docs/ENGINEERING-NOTES.md b/docs/ENGINEERING-NOTES.md index 7184470..06a8319 100644 --- a/docs/ENGINEERING-NOTES.md +++ b/docs/ENGINEERING-NOTES.md @@ -1,6 +1,6 @@ # Shift 工程回归台账 -本文件记录 0.1.2 到 0.1.13 之间已经踩过、并且不应再次引入的工程问题,重点覆盖: +本文件记录 0.1.2 到 0.1.14 之间已经踩过、并且不应再次引入的工程问题,重点覆盖: - Drop / 局域网设备发现 - DOCX、Markdown 与图片转换 @@ -25,6 +25,7 @@ | 0.1.10 | 拖放反馈收束到按钮:面板自身不再做拖拽动画,松开在非按钮处彻底静默(去掉 0.1.9 的提示浮层);「文字识别」对非图片直接拒绝,不再退回格式环;托盘「识别图片文字…」改为「文字识别」。 | | 0.1.11 | Windows 实测「最近使用」拖到三个按钮全部完不成:页内文件拖拽在 WebView2 上 DOM 与原生两条投递路径都可能不上报,改由 `dragEnd` 兜底;开始拖动时先让闲置圆环让开,它无边框且始终置顶,正压在按钮上(两节都在「『最近使用』拖回主面板的三个按钮」里)。三个按钮的可用性判定收进 `src/lib/dropCapabilities.ts`,两种语言、两条投递路径共用一条"能处理就处理,不能处理就禁止"的规则。同一节里另有两处:内部拖拽被原生 `enter` 报成"没有文件"、从而三个按钮全部点亮(`dragPathsKnown()` 改为合并),以及禁止态定为**按钮禁用+光标禁止符号**——光标原本由 wry 固定回报 Copy、页面改不动,现在由 `src-tauri/src/drop_cursor.rs` 在运行时接管那两条回报方法,把页面的判定翻译成原生拖放的拒绝(同一节也记了这条路上"被拒绝的手势没有收尾事件"这个坑)。局域网接收的文件从此也受「完成后在访达中显示」控制,一批只在最后一个落地时显示一次;「运行组件」缺失多项时可以一次装完。 | | 0.1.13 | Windows 实测「运行组件」一键安装失败:`winget` 把“已经装过”报成非零退出码,界面就照着说安装失败(见「Windows 一键安装运行组件」)。同一节还记了 `--source` 未钉住导致的静默挂死、机器级组件必须提权、以及装完之后进程内 PATH 仍是旧值这三处。另有三处与系统资源相关的约束:托盘改用自绘的黑白模板图(`scripts/build-icons.py` 重建,应用图标同一份几何,`icon_as_template` 只在 macOS 生效);钉图窗口的放大尺寸与位置必须按 work area 与 DPI 换算后夹取,见「钉图窗口的放大与还原」;闲置时的取样节奏——伴生进程 `native/macos/drag-bridge.swift` 无按压时 10Hz、Windows 手势监视 `monitor_pause` 在圆环关闭时 250ms、发现线程静默时 1.6s——都要在“关掉了就别一直占 CPU”和“还听得见、还能过期”之间取平衡。另有两条:主面板顶部的升级提示与托盘那一行共用同一份状态,而这份状态必须落到磁盘上,否则探测一天只跑一次,用户在探测当天之后就再也看不到提示——包括升级重启后的那一次启动;落盘的提示在恢复时要重新判定它是否还算数,见「升级提示跨启动存活」。Windows 应用内更新随后实测失败:`cmd.exe /C` 从带空格的 `%TEMP%\Shift Updates` 路径上剥掉了首尾引号,辅助脚本从未启动;静默安装还会被没人能点的 WebView2 提示框永久卡住。现在脚本路径经环境变量传入并保留外层引号,静默模式不弹 WebView2 提示,安装器在 `taskkill` 后也会等进程真正释放 EXE。 | +| 0.1.14 | 修复 Windows 应用内升级死锁。0.1.12 及更早版本、以及首个 0.1.13 包,都用多参数方式启动交接脚本;`cmd.exe /C` 会剥掉含空格路径的首尾引号,脚本从未执行,所以这些客户端无法在应用内安装任何新版本,必须先手动装一次重发版 0.1.13 或 0.1.14。0.1.14 把 Windows 交接改成与 Squid 相同的单参数启动:pid、安装包与日志路径写进脚本,`cmd.exe /D /C <脚本路径>` 只接收一个带引号的参数,不再使用 `/S` 或 `raw_arg`。真机回归应从已修复的 0.1.13 升到 0.1.14,确认下载、退出、静默安装与重启都完成。 | 历史提交可以这样定位: diff --git a/docs/INSTALL.md b/docs/INSTALL.md new file mode 100644 index 0000000..043b8aa --- /dev/null +++ b/docs/INSTALL.md @@ -0,0 +1,138 @@ +# Install and first run + +Shift ships two installers: a macOS universal DMG and a Windows x64 EXE. +Linux builds from source but has no published installer. For what the app does +once it is running, see the [English README](../README.md) or the +[Chinese README](../README.zh-CN.md). + +## Requirements + +| Platform | Requirement | +| --- | --- | +| macOS | Apple silicon or Intel. The DMG is one universal bundle. | +| Windows | Windows 10 or 11, x64. ARM64 machines run the x64 build through the compatibility layer. | +| Windows | Microsoft Edge WebView2 Runtime. Windows 10/11 normally includes it; install it from Microsoft if the window opens blank. | + +Installing and running Shift needs no administrator rights. Only installing an +optional runtime component from Settings can raise a UAC prompt. + +## macOS + +1. Download `Shift--macOS-universal.dmg` and double-click to mount it. +2. Drag `Shift.app` into `/Applications` (or any location you can write to). +3. The first launch is blocked as “unidentified developer” because builds are + ad-hoc signed and not notarized. Cancel the dialog, then right-click + `Shift.app` → **Open**, or allow it in **System Settings → Privacy & + Security**. +4. Approve it once. Later launches open normally. + +In-app updates download the same DMG directly and mount it themselves, so an +update never shows the Gatekeeper prompt. + +### Permissions + +- **Screen Recording** — screenshots and screen recording. Shift checks this + before showing the capture overlay, so a denial produces an actionable message + instead of a black screenshot. +- **Files & Folders** — the output folders you choose. +- **Microphone** — recording with audio. +- **Local Network** — Send to a device. If denied, Shift still broadcasts and + answers, but never receives the beacons, so the device list stays empty. + +Ad-hoc signing gives each rebuild a new code identity, and macOS ties these +grants to that identity. An upgrade may therefore ask again. A Developer ID +certificate and notarization would make the identity stable; that is future +work, not a setting you can change. + +## Windows + +1. Run `Shift-Setup--win-x64.exe`. It installs to + `%LOCALAPPDATA%\Programs\Shift` and creates Start-menu and desktop shortcuts. +2. The build is unsigned. If SmartScreen says “Windows protected your PC”, + choose **More info** → **Run anyway**. +3. On first launch, allow Shift on **private networks** if the firewall asks. + If you declined earlier, enable it under **Windows Security → Firewall & + network protection → Allow an app through firewall**. Without it, Send to a + device cannot receive other machines' beacons. + +## First run + +Shift shows one checklist card: + +- Screen Recording (macOS) +- whether the three output folders are writable +- whether this copy owns the global shortcuts +- which optional runtime components are missing + +Each row says what it found and offers the fix. Dismissing the card changes +nothing. It appears once per install, including the first launch after an +upgrade; delete `setupReviewed` from `settings.json` to see it again. + +Shift then lives in the menu bar (macOS) or notification area (Windows). No +window has to stay open — the rings work from anywhere. + +## Optional components + +Settings → **Runtime components** shows what Shift found on this machine, with +version and path. Missing tools can be installed from that panel: + +| Component | Used for | macOS source | Windows source | +| --- | --- | --- | --- | +| FFmpeg | Video and audio conversion, Windows/Linux screen recording | Homebrew | WinGet `Gyan.FFmpeg` | +| Pandoc | Documents to PDF on Windows/Linux | Homebrew | WinGet `JohnMacFarlane.Pandoc` | +| Poppler | PDF rendering outside macOS | Homebrew | WinGet `oschwartz10612.Poppler` | +| ImageMagick | HEIC/AVIF decoding and HEIC encoding outside macOS | Homebrew | WinGet `ImageMagick.ImageMagick` | +| Typst | Document rendering | Homebrew | WinGet `Typst.Typst` | + +Shift never downloads a runtime from a third-party site and never removes or +overwrites a tool you already have. A missing component disables only the +wedges that need it. + +## Updates + +Shift reads `shift-update.json` from the `releases` branch of the upstream +repository once a day, or when you press **Check** in Settings → **Software +updates**. A download is accepted only when its byte size and SHA256 match the +manifest, and both are checked again before the installer is launched. + +The update source is derived from the git remote at build time. A build made +from a checkout with no remote reports “no feed”. + +## Verify a download + +```bash +# macOS +shasum -a 256 -c SHA256SUMS.txt +hdiutil verify Shift--macOS-universal.dmg +codesign -dv --verbose=2 /Applications/Shift.app 2>&1 | grep -E 'Signature|Identifier' +# Signature=adhoc +# Identifier=app.nex.shift +``` + +```powershell +# Windows +Get-FileHash .\Shift-Setup--win-x64.exe -Algorithm SHA256 +``` + +`Signature=adhoc` is the intended form, not a broken signature. + +## Troubleshooting + +| Symptom | Cause and fix | +| --- | --- | +| macOS says the app is damaged or from an unidentified developer | The DMG is not notarized. Right-click → Open, or allow it in Privacy & Security. Do not run it from the archive preview window. | +| Screenshot is black, or capture never starts | Screen Recording is denied. Enable Shift under Privacy & Security → Screen Recording, then restart Shift. | +| Device list is empty | Local Network or firewall permission is missing, or the network isolates clients. Check the macOS Local Network pane, or the Windows private-network rule. | +| Windows window is blank | Install the WebView2 Runtime. | +| A wedge is missing | That conversion needs a tool that is not installed. Check Settings → Runtime components. | +| Video or audio conversion fails | FFmpeg is missing or lacks the needed encoder. Check the runtime panel. | +| Update says “no artifact for this platform” | Linux builds have no published artifact; on macOS and Windows, confirm the manifest carries your platform key. | +| Update downloads but does not install | Check that the app can write its own bundle location, then retry. The downloaded file is deleted if size or SHA256 differs from the manifest. | + +## Uninstall + +- macOS: quit Shift from the menu bar, then move `Shift.app` to the Trash. +- Windows: **Settings → Apps** → Shift → Uninstall. + +Configuration and history live in the app data directory and are left in place; +delete them by hand if you want a clean state. Output files are never removed. diff --git a/docs/MOBILE.md b/docs/MOBILE.md index 2846671..2128295 100644 --- a/docs/MOBILE.md +++ b/docs/MOBILE.md @@ -262,4 +262,4 @@ Each step ships something usable on its own; none depends on a feature Shift lac | One FFmpeg binary per platform | iOS: no, Android: measure | `AVFoundation` covers most mobile media needs at zero licence risk; Android's codecs are as capable but the surface is fragmented | | Shared OCR engine or native | Native | Vision and ML Kit beat Tesseract WASM on speed and Chinese accuracy; a shared engine buys nothing users can see | | Catalogue home | `shift-core` | Desktop can read from it; phones and desktop cannot drift apart | -| Priced app to fund it | Undecided | The desktop app is MIT and free; a paid mobile app is defensible but changes the project's centre of gravity | +| Priced app to fund it | Undecided | The desktop app is GPL-3.0 and free; a paid mobile app is defensible but changes the project's centre of gravity | diff --git a/docs/README.md b/docs/README.md index aeef98b..d4385d5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,6 +6,8 @@ work. | Document | Audience | Contents | | --- | --- | --- | | [`../README.md`](../README.md) / [`../README.zh-CN.md`](../README.zh-CN.md) | Users | Features, formats, shortcuts, privacy, known limitations | +| [`INSTALL.md`](INSTALL.md) | Users and support | Installation, first run, permissions, optional components, troubleshooting, uninstall | +| [`../CHANGELOG.md`](../CHANGELOG.md) | Users and maintainers | What changed in each version | | [`ARCHITECTURE.md`](ARCHITECTURE.md) | Contributors | Process/window model, module ownership, events, data flows | | [`SPECIFICATION.md`](SPECIFICATION.md) | Product and QA | Observable behaviour, naming, limits, acceptance criteria | | [`SECURITY.md`](SECURITY.md) | Security reviewers and maintainers | Trust boundaries, update and LAN risk, residual gaps | diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 3da3c0d..e1a3111 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -12,8 +12,8 @@ An orphan branch named `releases` holds exactly one release: releases/ ├── shift-update.json ├── shift-update.sig -├── Shift-0.1.13-macOS-universal.dmg -└── Shift-Setup-0.1.13-win-x64.exe +├── Shift-0.1.14-macOS-universal.dmg +└── Shift-Setup-0.1.14-win-x64.exe ``` `shift-update.json` names the version and, per platform, the artifact file, its size in @@ -22,12 +22,12 @@ bytes and its SHA256: ```json { "schema": 1, - "version": "0.1.13", + "version": "0.1.14", "date": "2026-10-26", "notes": "", "artifacts": { - "macos": { "file": "Shift-0.1.13-macOS-universal.dmg", "sha256": "…", "size": 0 }, - "windows": { "file": "Shift-Setup-0.1.13-win-x64.exe", "sha256": "…", "size": 0 } + "macos": { "file": "Shift-0.1.14-macOS-universal.dmg", "sha256": "…", "size": 0 }, + "windows": { "file": "Shift-Setup-0.1.14-win-x64.exe", "sha256": "…", "size": 0 } } } ``` @@ -35,7 +35,7 @@ bytes and its SHA256: Artifact names are restricted to ASCII letters, digits, `.`, `-` and `_`; path separators, `..`, spaces and shell metacharacters are rejected. The app also refuses a manifest over 256 KiB. These checks keep malformed manifest data out -of download paths and out of the native handoff arguments. +of download paths and out of the native handoff inputs. ## Supported release targets @@ -307,15 +307,22 @@ for that pid to disappear and only then touches the installed copy. Both scripts are written so a failure cannot end with Shift simply closed: every macOS failure path still `open`s the bundle it had, and the swap is `move aside, move in`, so a -copy that fails halfway leaves the previous version where it was. The scripts themselves -are fixed constants; the pid, installer, bundle and log paths arrive through process -arguments or environment variables, never interpolated into shell or batch source. The -Windows launcher also keeps the outer quote layer that `cmd.exe /C` would otherwise strip -from a script path containing spaces. Before the handoff starts, macOS +copy that fails halfway leaves the previous version where it was. The macOS script is a +fixed constant and receives its paths as arguments. The Windows script is generated for +each attempt with the pid, installer and log paths written into it; `cmd.exe` receives +only one quoted script path, matching Squid's proven launch contract. This matters because +`cmd.exe /C` strips the first and last quote when it sees more than one quoted token, and +`%TEMP%\Shift Updates` contains a space. Before the handoff starts, macOS writes a probe file next to the bundle — a root-owned copy in `/Applications` is reported as "open the downloaded installer yourself" rather than quietly quitting on an update that could not be applied. +Builds through 0.1.12, and the original 0.1.13 package, contain the old multi-argument +launcher. Those copies cannot install any release from inside the app: the helper never +starts, so the deadlock has to be broken by one manual install of the republished 0.1.13 +or 0.1.14 package. A copy that already runs the republished 0.1.13 can update to 0.1.14 +normally. + The Windows installer is the same one a user runs by hand, so the update path cannot drift from the manual one. Because the silent install comes from Shift itself, `${Silent}` skips the interactive "Shift is running, close it?" box and the WebView2 warning: the app diff --git a/docs/SECURITY.md b/docs/SECURITY.md index d3cf919..1566dec 100644 --- a/docs/SECURITY.md +++ b/docs/SECURITY.md @@ -103,8 +103,9 @@ Controls: - the installer is checked for exact byte length and SHA256 after download; - both checks run again immediately before installing; - the installer must be a regular file, not a symlink; -- macOS and Windows handoff scripts receive paths as process arguments or - environment variables, never interpolated shell/batch text; +- macOS receives handoff paths as process arguments; Windows writes them into a + generated batch file whose only command-line argument is the script path, matching + Squid's launch contract; artifact names are sanitized before either path is formed; - `Discard` deletes the downloaded artifact, not just the UI state. Residual risk: diff --git a/package.json b/package.json index 3c87912..cdb8760 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "name": "shift", "private": true, - "version": "0.1.13", + "version": "0.1.14", + "license": "GPL-3.0-only", "type": "module", "scripts": { "prepare:ocr": "bash scripts/prepare-ocr-assets.sh", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index ace464f..8c2adc6 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3899,7 +3899,7 @@ dependencies = [ [[package]] name = "shift" -version = "0.1.13" +version = "0.1.14" dependencies = [ "base64 0.22.1", "calamine", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 6ea3670..dbb7210 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "shift" -version = "0.1.13" +version = "0.1.14" description = "A radial file utility with screenshot, recording and OCR." -authors = ["Shift Contributors"] +authors = ["mula.liu"] +license = "GPL-3.0-only" edition = "2021" [lib] diff --git a/src-tauri/src/update.rs b/src-tauri/src/update.rs index 01afeac..e160f1d 100644 --- a/src-tauri/src/update.rs +++ b/src-tauri/src/update.rs @@ -952,15 +952,19 @@ exit "$status" /// The Windows handoff: wait for this process to exit, run the installer silently, /// then start the copy the installer wrote. The installer refuses to overwrite a /// running EXE, so the wait is the whole point of the script. -#[cfg(target_os = "windows")] -const WINDOWS_HANDOFF_SCRIPT: &str = r#"@echo off +/// +/// The pid, installer and log paths are written into the script rather than passed +/// after `/C`. This is the same launch contract as Squid: `cmd.exe` sees one quoted +/// argument, the script path, and cannot strip the quotes from a path containing +/// spaces. +#[cfg(any(target_os = "windows", test))] +fn windows_handoff(pid: u32, installer: &Path, log: &Path) -> String { + format!( + r#"@echo off setlocal EnableExtensions DisableDelayedExpansion -set "WAIT_FOR=%SHIFT_UPDATE_PID%" -set "INSTALLER=%SHIFT_UPDATE_INSTALLER%" -set "LOG=%SHIFT_UPDATE_LOG%" -if not defined WAIT_FOR exit /b 2 -if not defined INSTALLER exit /b 2 -if not defined LOG exit /b 2 +set "WAIT_FOR={pid}" +set "INSTALLER={installer}" +set "LOG={log}" echo handoff started %DATE% %TIME% >> "%LOG%" set /a TRIES=0 :waitloop @@ -978,22 +982,16 @@ if exist "%TARGET%" ( ) else ( echo target missing: %TARGET% >> "%LOG%" ) -"#; - -/// `cmd.exe /C` strips the first and last quote from its command when there is -/// more than one pair. Without the extra layer, the quoted path to this script -/// (which lives under `%TEMP%\Shift Updates`) loses its opening quote and the -/// helper never runs. The script path itself travels in an environment variable, -/// so no user-controlled path is spliced into the command line. -#[cfg(any(target_os = "windows", test))] -fn windows_handoff_launch() -> &'static str { - "\"\"%SHIFT_UPDATE_SCRIPT%\"\"" +"#, + pid = pid, + installer = installer.display(), + log = log.display(), + ) } /// Write a handoff script and start it detached, so it is still alive when this -/// process has exited. Paths travel as process arguments or environment variables -/// rather than interpolated script text, so folder names cannot change the -/// helper's script source. +/// process has exited. macOS passes its paths as arguments; Windows writes them +/// into the generated script and gives `cmd.exe` only the script path. fn spawn_handoff(name: &str, script: &str, arguments: &[&OsStr]) -> Result<(), String> { let path = download_directory().join(name); if let Some(parent) = path.parent() { @@ -1005,19 +1003,12 @@ fn spawn_handoff(name: &str, script: &str, arguments: &[&OsStr]) -> Result<(), S fs::write(&path, script).map_err(|error| error.to_string())?; #[cfg(target_os = "windows")] let mut command = { - use std::os::windows::process::CommandExt; - + let _ = arguments; let mut command = crate::process::command("cmd.exe"); - // Keep every path out of the command line. `cmd.exe` expands these - // variables after its `/C` quote handling, so spaces, `&` and `%` in a - // profile folder cannot change the command it runs. - command - .env("SHIFT_UPDATE_SCRIPT", &path) - .env("SHIFT_UPDATE_PID", arguments[0]) - .env("SHIFT_UPDATE_INSTALLER", arguments[1]) - .env("SHIFT_UPDATE_LOG", arguments[2]) - .args(["/D", "/S", "/C"]); - command.raw_arg(windows_handoff_launch()); + // Match Squid's proven handoff: one quoted script path after `/C`, with + // the parameters already in the script. More than one quoted token makes + // cmd.exe strip the first and last quote from a path containing spaces. + command.args(["/D", "/C"]).arg(&path); command }; #[cfg(not(target_os = "windows"))] @@ -1107,15 +1098,11 @@ pub async fn update_install(app: AppHandle) -> Result { } #[cfg(target_os = "windows")] { - let pid_argument = pid.to_string(); + let script = windows_handoff(pid, &artifact, &log); spawn_handoff( "Shift-update.cmd", - WINDOWS_HANDOFF_SCRIPT, - &[ - OsStr::new(&pid_argument), - artifact.as_os_str(), - log.as_os_str(), - ], + &script, + &[], )?; quit_for_update(&app); return Ok(path); @@ -1597,32 +1584,55 @@ mod tests { assert!(script.contains("hdiutil detach")); } - #[cfg(target_os = "windows")] #[test] fn the_windows_handoff_installs_only_after_this_process_is_gone() { - let script = WINDOWS_HANDOFF_SCRIPT; + let script = windows_handoff( + 1234, + Path::new( + r"C:\Users\me\AppData\Local\Temp\Shift Updates\Shift-Setup-0.1.14-win-x64.exe", + ), + Path::new(r"C:\Users\me\AppData\Local\Temp\Shift Updates\handoff.log"), + ); assert!( - script.contains("set \"WAIT_FOR=%SHIFT_UPDATE_PID%\""), - "the script lost the environment variable carrying our pid" + script.contains("set \"WAIT_FOR=1234\""), + "the script lost our pid" + ); + assert!( + script.contains("Shift-Setup-0.1.14-win-x64.exe"), + "the script lost the installer path" ); assert!(!script.contains("C:\\Users\\me\\Shift-Setup.exe")); let wait = script .find("tasklist /FI \"PID eq %WAIT_FOR%\"") .expect("no wait"); - let install = script.find("\"%INSTALLER\" /S").expect("no silent install"); + let install = script + .find("\"%INSTALLER%\" /S") + .expect("no silent install"); assert!(wait < install); assert!(script.contains("start \"\" \"%TARGET%\""), "never restarts"); } #[test] - fn the_windows_handoff_command_keeps_its_outer_quote_layer() { - // `cmd.exe /C` strips the first and last quote when the command has more - // than one quoted token. The script path is under a folder with a space, - // so without this second layer the helper is silently never started. - let launch = windows_handoff_launch(); - assert_eq!(launch, "\"\"%SHIFT_UPDATE_SCRIPT%\"\""); - assert!(launch.starts_with("\"\"")); - assert!(launch.ends_with("\"\"")); + fn the_windows_handoff_passes_only_the_script_path() { + let mut command = crate::process::command("cmd.exe"); + command + .args(["/D", "/C"]) + .arg(r"C:\Users\me\AppData\Local\Temp\Shift Updates\Shift-update.cmd"); + let arguments: Vec<_> = command + .get_args() + .map(|argument| argument.to_string_lossy().into_owned()) + .collect(); + assert_eq!( + arguments.len(), + 3, + "cmd must receive no extra quoted tokens" + ); + assert_eq!(arguments[0], "/D"); + assert_eq!(arguments[1], "/C"); + assert_eq!( + arguments[2], + r"C:\Users\me\AppData\Local\Temp\Shift Updates\Shift-update.cmd" + ); } #[test] diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index aac7662..40446e4 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": "Shift", - "version": "0.1.13", + "version": "0.1.14", "identifier": "app.nex.shift", "build": { "beforeDevCommand": "pnpm dev",