From 7ccc40def0f3e43604abd0acda6c3850b55b820d Mon Sep 17 00:00:00 2001 From: Lan_zhijiang Date: Tue, 27 Oct 2026 18:58:34 +0800 Subject: [PATCH 1/5] =?UTF-8?q?docs(shared):=20=E6=9B=B4=E6=96=B0=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=A0=BC=E5=BC=8F=E4=B8=8E=20Local=20Files=20v2=20?= =?UTF-8?q?=E5=90=88=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/_shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_shared b/docs/_shared index 311c69bd..e748a564 160000 --- a/docs/_shared +++ b/docs/_shared @@ -1 +1 @@ -Subproject commit 311c69bdada4fb291cc7fae0ded5caefa4fdc867 +Subproject commit e748a564fb7f2a066fca98f826c9130d32e888c8 From 55a17967be3433bb004adc22b146660d86928278 Mon Sep 17 00:00:00 2001 From: Lan_zhijiang Date: Tue, 27 Oct 2026 19:25:30 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat(collection):=20=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E5=86=85=E5=AE=B9=E7=BB=93=E6=9E=84=E5=B9=B6?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E9=80=9A=E7=94=A8=E9=98=85=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 提取已有页面对象、正文和媒体引用,按实际 HTML 或 Markdown 格式保存 - 复用旧材料正文身份与冻结载荷,接入 Local Files v2 读端 - 补充实际保存、恢复、阅读和纯文本预览的回归检查 - UI 公开组件依赖待上游正式发行后更新,当前保留 draft 交付状态 --- .changeset/hister-content.md | 8 + THIRD_PARTY_NOTICES.txt | 834 ++++++++++++++++++ .../info-base/resolvers/ContentHtml.vue | 49 +- .../info-base/resolvers/ContentPreview.vue | 13 +- apps/client-web/src/core.ts | 3 + apps/client-web/vite.config.ts | 11 + .../components/collection/MaterialReader.vue | 30 +- apps/client-webext/entrypoints/parser/main.ts | 2 +- .../client-webext/logic/collection/capture.ts | 62 +- apps/client-webext/logic/collection/fetch.ts | 18 +- .../logic/collection/parse-html.ts | 22 +- .../client-webext/logic/collection/runtime.ts | 4 +- apps/client-webext/wxt.config.ts | 4 + docs/30-unit-tdd/info-base.md | 5 +- docs/30-unit-tdd/webext-collection.md | 19 +- extensions/local-files/package.json | 2 +- extensions/local-files/src/FileContent.vue | 11 +- extensions/local-files/src/index.ts | 4 +- extensions/local-files/src/resolver.ts | 24 +- extensions/local-files/src/schema.ts | 2 + extensions/local-files/vite.config.ts | 5 + packages/core/package.json | 1 + packages/core/src/index.ts | 1 + packages/core/src/info-base/index.ts | 1 + packages/core/src/info-base/resolvers/base.ts | 1 + .../core/src/info-base/resolvers/contracts.ts | 1 + packages/core/src/info-base/resolvers/html.ts | 69 +- .../core/src/info-base/resolvers/index.ts | 3 + .../core/src/info-base/resolvers/markdown.ts | 16 + packages/web-collection/package.json | 4 +- .../web-collection/src}/discourse.ts | 38 +- packages/web-collection/src/extract.ts | 178 ++++ packages/web-collection/src/index.ts | 69 +- packages/web-collection/src/material.ts | 82 +- packages/web-collection/src/resolvers.ts | 15 +- pnpm-lock.yaml | 6 + tests/e2e/browser-extension.spec.ts | 303 ++++++- tests/e2e/peer-database.spec.ts | 63 ++ 38 files changed, 1757 insertions(+), 226 deletions(-) create mode 100644 .changeset/hister-content.md create mode 100644 THIRD_PARTY_NOTICES.txt create mode 100644 packages/core/src/info-base/resolvers/markdown.ts rename {apps/client-webext/logic/collection => packages/web-collection/src}/discourse.ts (54%) create mode 100644 packages/web-collection/src/extract.ts diff --git a/.changeset/hister-content.md b/.changeset/hister-content.md new file mode 100644 index 00000000..3208cb2b --- /dev/null +++ b/.changeset/hister-content.md @@ -0,0 +1,8 @@ +--- +'@inkcre/core': patch +'@inkcre/client-web': patch +'@inkcre/client-webext': patch +'@inkcre/ext-local-files': minor +--- + +保留页面已有正文与 HTML 结构,增加 Markdown 通用解释与安全阅读,并衔接 Local Files v2 及旧网页材料。 diff --git a/THIRD_PARTY_NOTICES.txt b/THIRD_PARTY_NOTICES.txt new file mode 100644 index 00000000..abef4e3c --- /dev/null +++ b/THIRD_PARTY_NOTICES.txt @@ -0,0 +1,834 @@ +# 第三方来源与许可 + +页面提取参考 Asciimoo 及 Hister 贡献者的工作(https://github.com/asciimoo/hister/tree/2e017c05cf544b812b8fd509ff3fc07c5c7e464e)。本实现独立编写,未复制、改写或运行其 AGPL-3.0-or-later 源码;致谢不表示上游背书。 + +以下为内容提取、文字投影与安全阅读使用的固定依赖及完整许可。 + + + +====================================================================== +@mozilla/readability 0.6.0 +{'type': 'git', 'url': 'https://github.com/mozilla/readability'} + + +LICENSE.md + +Copyright (c) 2010 Arc90 Inc + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + + + +====================================================================== +htmlparser2 10.1.0 +{'type': 'git', 'url': 'git://github.com/fb55/htmlparser2.git'} + + +LICENSE + +Copyright 2010, 2011, Chris Winberry . All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + + + +====================================================================== +domelementtype 2.3.0 +{'type': 'git', 'url': 'git://github.com/fb55/domelementtype.git'} + + +LICENSE + +Copyright (c) Felix Böhm +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + +====================================================================== +domhandler 5.0.3 +{'type': 'git', 'url': 'git://github.com/fb55/domhandler.git'} + + +LICENSE + +Copyright (c) Felix Böhm +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + +====================================================================== +domutils 3.2.2 +{'type': 'git', 'url': 'git://github.com/fb55/domutils.git'} + + +LICENSE + +Copyright (c) Felix Böhm +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + +====================================================================== +dom-serializer 2.0.0 +{'type': 'git', 'url': 'git://github.com/cheeriojs/dom-serializer.git'} + + +LICENSE + +License + +(The MIT License) + +Copyright (c) 2014 The cheeriojs contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + +====================================================================== +entities 4.5.0 +{'type': 'git', 'url': 'git://github.com/fb55/entities.git'} + + +LICENSE + +Copyright (c) Felix Böhm +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + +====================================================================== +entities 7.0.1 +{'type': 'git', 'url': 'https://github.com/fb55/entities.git'} + + +LICENSE + +Copyright (c) Felix Böhm +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + +====================================================================== +marked 18.1.2 +{'type': 'git', 'url': 'git+https://github.com/markedjs/marked.git'} + + +LICENSE + +# License information + +## Contribution License Agreement + +If you contribute code to this project, you are implicitly allowing your code +to be distributed under the MIT license. You are also implicitly verifying that +all code is your original work. `` + +## Marked + +Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/) +Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +## Markdown + +Copyright © 2004, John Gruber +http://daringfireball.net/ +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. + + + + +====================================================================== +dompurify 3.4.8 +{'type': 'git', 'url': 'git://github.com/cure53/DOMPurify.git'} + + +LICENSE + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +LICENSE-MPL + +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. + diff --git a/apps/client-web/src/components/info-base/resolvers/ContentHtml.vue b/apps/client-web/src/components/info-base/resolvers/ContentHtml.vue index a8c31655..161dfb12 100644 --- a/apps/client-web/src/components/info-base/resolvers/ContentHtml.vue +++ b/apps/client-web/src/components/info-base/resolvers/ContentHtml.vue @@ -1,48 +1,11 @@ - - - diff --git a/apps/client-web/src/components/info-base/resolvers/ContentPreview.vue b/apps/client-web/src/components/info-base/resolvers/ContentPreview.vue index 784fb0b7..3d6ef837 100644 --- a/apps/client-web/src/components/info-base/resolvers/ContentPreview.vue +++ b/apps/client-web/src/components/info-base/resolvers/ContentPreview.vue @@ -7,10 +7,15 @@ const props = defineProps>() const kind = computed(() => props.resolver.block.resolver.split('.')[1]?.toUpperCase() ?? 'BLOCK') const text = computed(() => { if (typeof props.solvedContent !== 'string') return null - const plain = props.solvedContent - .replace(/]*>[\s\S]*?<\/style>/gi, '') - .replace(/]*>[\s\S]*?<\/script>/gi, '') - .replace(/<[^>]+>/g, ' ') + const source = props.solvedContent + const plain = ( + props.resolver.block.resolver === 'core.html.v1' + ? source + .replace(/]*>[\s\S]*?<\/style>/gi, '') + .replace(/]*>[\s\S]*?<\/script>/gi, '') + .replace(/<[^>]+>/g, ' ') + : source + ) .replace(/\s+/g, ' ') .trim() return plain.length > 180 ? `${plain.slice(0, 180)}…` : plain diff --git a/apps/client-web/src/core.ts b/apps/client-web/src/core.ts index 839b9253..a730e76c 100644 --- a/apps/client-web/src/core.ts +++ b/apps/client-web/src/core.ts @@ -17,6 +17,7 @@ import { localStorageAdapter, registerCoreResolvers, TextResolver, + MarkdownResolver, ResolverCache, AudioResolver, EpubResolver, @@ -118,6 +119,8 @@ export async function refreshCurrentWebPeer(): Promise { * Each resolver needs a Vue component to render content. */ export function setupResolvers(): void { + MarkdownResolver.previewRenderer = ContentPreview + MarkdownResolver.solvedContentRenderer = ContentHtml TextResolver.previewRenderer = ContentPreview AudioResolver.previewRenderer = ContentPreview EpubResolver.previewRenderer = ContentPreview diff --git a/apps/client-web/vite.config.ts b/apps/client-web/vite.config.ts index ca3f38af..590dcb61 100644 --- a/apps/client-web/vite.config.ts +++ b/apps/client-web/vite.config.ts @@ -1,3 +1,4 @@ +import { readFileSync } from 'node:fs' import { fileURLToPath, URL } from 'node:url' import { resolve } from 'node:path' import vue from '@vitejs/plugin-vue' @@ -64,6 +65,16 @@ export default defineConfig(async ({ command, mode }) => { }) }, }, + { + name: 'content-reading-notices', + generateBundle() { + this.emitFile({ + type: 'asset', + fileName: 'THIRD_PARTY_NOTICES.txt', + source: readFileSync(new URL('../../THIRD_PARTY_NOTICES.txt', import.meta.url), 'utf8'), + }) + }, + }, extensionDevPlugin, vue(), vueJsx(), diff --git a/apps/client-webext/components/collection/MaterialReader.vue b/apps/client-webext/components/collection/MaterialReader.vue index f1b0c622..90eede02 100644 --- a/apps/client-webext/components/collection/MaterialReader.vue +++ b/apps/client-webext/components/collection/MaterialReader.vue @@ -1,18 +1,23 @@ ', + 'https://chatgpt.com/share/unloaded' + ).catch(() => null) + expect(shell?.html).toBeUndefined() + const embedded = JSON.stringify({ + '@type': 'ProfilePage', + hasPart: [ + { + '@type': 'DiscussionForumPosting', + url: 'https://bsky.app/profile/a.test/post/one', + author: { name: 'Alice' }, + datePublished: '2025-01-01T00:00:00Z', + text: 'First post', + sharedContent: { + '@type': 'DiscussionForumPosting', + url: 'https://bsky.app/profile/b.test/post/quoted', + author: { name: 'Bob' }, + text: 'Quoted post', + }, + }, + { + '@type': 'DiscussionForumPosting', + url: 'https://bsky.app/profile/a.test/post/two', + author: { name: 'Alice' }, + text: 'Thanks!', + }, + ], + }) + const posts = await parse( + ``, + 'https://bsky.app/profile/a.test' + ) + const facts = await page.evaluate((html) => { + const d = new DOMParser().parseFromString(html, 'text/html') + return { + articles: d.body.querySelectorAll(':scope > article').length, + quotes: d.querySelectorAll('blockquote article').length, + text: d.body.textContent, + } + }, posts.html) + expect(facts.articles).toBe(2) + expect(facts.quotes).toBe(1) + expect(facts.text).toContain('Alice') + expect(facts.text).toContain('Bob') + expect(facts.text).toContain('Thanks!') + const media = await parse( + '

Media

Saved transcript and its original media references.

AudioVisual description
', + 'https://example.org/guide' + ) + expect(media.html).toContain('https://example.org/video.mp4') + expect(media.html).toContain('https://example.org/captions.vtt') + expect(media.html).toContain('') + const mediaText = await new HtmlResolver( + Block.parse({ id: -1, storage: null, resolver: 'core.html.v1', content: media.html }) + ).getText() + expect(mediaText).toContain('https://example.org/captions.vtt') + + const markdown = '# Title\n\n```html\n& value\n indent\n```\n[link](https://example.org)\n' + expect( + await new MarkdownResolver( + Block.parse({ id: -1, storage: null, resolver: 'core.markdown.v1', content: markdown }) + ).getText() + ).toBe(markdown) +}) + test('material collection uses existing graph CRUD and byte storage without a web RPC', async () => { test.skip(!process.env.INKCRE_E2E_WEBEXT_PGREST, 'Requires a disposable database.') const token = await new SignJWT({ role: 'authenticated' }) @@ -115,7 +221,7 @@ test('material collection uses existing graph CRUD and byte storage without a we ).read(saved.root_id) expect(Buffer.from(read.parts[0]!.base64, 'base64').toString()).toBe('主动保存原文') expect(read.notes[0]!.text).toBe('独立附注') - const text = await client.blocks.from().select().eq('id', saved.part_ids.text!).single() + const text = await client.blocks.from().select().eq('id', saved.part_ids.body!).single() expect(await new TextResolver(Block.parse(text.data)).getText()).toBe('主动保存原文') const current = { ...fixed, @@ -136,6 +242,139 @@ test('material collection uses existing graph CRUD and byte storage without a we expect(Buffer.from((await client.read(next.root_id)).parts[0]!.base64, 'base64').toString()).toBe( '更新后的正文' ) + const bodyID = next.part_ids.body! + const partRow = await client.relations + .from() + .select() + .eq('from_', next.root_id) + .eq('content', 'extensions.web-collection.part.body') + .single() + await client.relations + .update({ content: 'extensions.web-collection.part.text' }) + .eq('id', partRow.data!.id) + const reference = await client.relations + .insert({ from_: saved.root_id, to_: bodyID, content: 'synthetic-reference' }) + .select() + .single() + const frozen = JSON.stringify(current) + const upgraded = await client.submit({ + ...current, + request_id: crypto.randomUUID(), + parts: [ + contentPart( + 'body', + 'html', + '

结构正文

keep\n  indent
A12
' + ), + ], + }) + expect(upgraded.part_ids.body).toBe(bodyID) + expect( + (await client.relations.from().select().eq('id', partRow.data!.id).single()).data!.content + ).toBe('extensions.web-collection.part.body') + expect( + (await client.relations.from().select().eq('id', reference.data!.id).single()).data!.to_ + ).toBe(bodyID) + const body = (await client.read(upgraded.root_id)).parts[0]! + expect(body.role).toBe('body') + expect('format' in body && body.format).toBe('html') + const projected = await new HtmlResolver( + Block.parse({ + id: bodyID, + storage: null, + resolver: 'core.html.v1', + content: Buffer.from(body.base64, 'base64').toString(), + }) + ).getText() + expect(projected).toContain('keep\n indent') + expect(projected).toContain('A\t12') + const replay = await client.submit(current) + expect(replay.part_ids.body).toBe(bodyID) + expect(JSON.stringify(current)).toBe(frozen) + expect( + ( + await client.relations + .from() + .select() + .eq('from_', replay.root_id) + .like('content', 'extensions.web-collection.part.%') + ).data + ).toHaveLength(1) + // An interruption after relation relabeling leaves a readable legacy text body. + const partialRead = await client.read(replay.root_id) + expect('format' in partialRead.parts[0]! && partialRead.parts[0]!.format).toBe('text') + expect( + (await client.submit({ ...current, parts: [contentPart('body', 'html', '

重试正文

')] })) + .part_ids.body + ).toBe(bodyID) + // A previously stored fixed graph keeps its legacy relation shape and accepted values. + await client.relations + .update({ content: 'extensions.web-collection.part.text' }) + .eq('from_', saved.root_id) + .eq('content', 'extensions.web-collection.part.body') + const fixedRetry = await client.submit({ + ...fixed, + material: { ...material, title: '不应覆盖' }, + parts: [textPart('text', '不应覆盖')], + }) + expect(fixedRetry.part_ids.text).toBe(saved.part_ids.body) + const retained = await client.read(saved.root_id) + expect(retained.material!.title).toBe(material.title) + expect(Buffer.from(retained.parts[0]!.base64, 'base64').toString()).toBe('主动保存原文') + const incomplete = { + ...fixed, + request_id: crypto.randomUUID(), + parts: [textPart('html', '

原材料

'), textPart('text', '冻结正文')], + } + const oldRoot = await client.blocks + .insert({ + resolver: WEB_MATERIAL_RESOLVER, + storage: null, + content: JSON.stringify({ + key: incomplete.request_id, + ...incomplete, + parts: undefined, + note: undefined, + }), + }) + .select() + .single() + const original = await client.blocks + .insert({ resolver: 'core.html.v1', storage: null, content: '

原材料

' }) + .select() + .single() + await client.relations.insert({ + from_: oldRoot.data!.id, + to_: original.data!.id, + content: 'extensions.web-collection.part.html', + }) + await expect( + client.submit({ ...incomplete, parts: [contentPart('body', 'html', '

不同格式

')] }) + ).rejects.toThrow('原格式') + expect((await client.relations.from().select().eq('from_', oldRoot.data!.id)).data).toHaveLength( + 1 + ) + const completed = await client.submit(incomplete) + expect(completed.part_ids.html).toBe(original.data!.id) + expect(completed.part_ids.text).toBeDefined() + expect( + (await client.blocks.from().select().eq('id', completed.part_ids.text!).single()).data!.resolver + ).toBe('core.text.v1') + const conflicting = await client.blocks + .insert({ storage: null, resolver: 'core.text.v1', content: 'conflicting body' }) + .select() + .single() + const ambiguous = await client.relations + .insert({ + from_: next.root_id, + to_: conflicting.data!.id, + content: 'extensions.web-collection.part.text', + }) + .select() + .single() + await expect(client.submit(current)).rejects.toThrow('歧义') + await expect(client.read(next.root_id)).rejects.toThrow('歧义') + await client.relations.from().delete().eq('id', ambiguous.data!.id) const record = { request_id: crypto.randomUUID(), mode: 'record' as const, @@ -1081,7 +1320,7 @@ test('automatic observation reuses current material and preserves manual saves', }) return read.parts.some( (part: any) => - part.role === 'text' && + part.role === 'body' && Buffer.from(part.base64, 'base64').toString().includes(articleText) ) }, @@ -1094,7 +1333,7 @@ test('automatic observation reuses current material and preserves manual saves', blockId: fixedRoot, }) expect( - Buffer.from(fixed.parts.find((part: any) => part.role === 'text').base64, 'base64').toString() + Buffer.from(fixed.parts.find((part: any) => part.role === 'body').base64, 'base64').toString() ).toContain('本次浏览的正文。') expect(fixed.notes[0].text).toBe('主动留下的附注') await source.evaluate(() => { @@ -1478,7 +1717,7 @@ test('extension retains an incomplete graph and continues after browser restart' return } response.end( - `现场页面

已加载的正文

需要留下的原句。

编辑中的秘密
` + `现场页面

已加载的正文

需要留下的原句。

文内目录

章节

名称数值
A12
<node>& value\n  indented

事件边界

已取得图片地址
编辑中的秘密
` ) }) server.listen(0, '127.0.0.1') @@ -1585,16 +1824,39 @@ test('extension retains an incomplete graph and continues after browser restart' expect( afterSwitch.value.items.find((item: { id: string }) => item.id === requestId).connectionId ).toBe(originalTarget) + sourceRequests.length = 0 await recovered.getByRole('button', { name: '读取已保存材料' }).click() const reader = recovered.getByRole('article', { name: '已保存材料' }) - await expect(reader).toContainText('需要留下的原句。') - await expect(reader).toContainText('Shadow DOM 正文') - await expect(reader).toContainText('同源框架里的正文') + const bodyReader = reader.frameLocator('iframe') + await expect(bodyReader.locator('body')).toContainText('需要留下的原句。') + await expect(bodyReader.locator('body')).toContainText('Shadow DOM 正文') + await expect(bodyReader.locator('body')).toContainText('同源框架里的正文') await expect(reader).toContainText('我的附注') - await expect(reader).not.toContainText('未提交草稿不要保存') - await expect(reader).not.toContainText('private-password') - await expect(reader).not.toContainText('编辑中的秘密') + await expect(bodyReader.locator('body')).not.toContainText('未提交草稿不要保存') + await expect(bodyReader.locator('body')).not.toContainText('private-password') + await expect(bodyReader.locator('body')).not.toContainText('编辑中的秘密') expect(await recovered.evaluate(() => (globalThis as any).fixtureExecuted)).toBeUndefined() + await expect(bodyReader.locator('table')).toContainText('名称数值A12') + expect(await bodyReader.locator('pre').textContent()).toContain('& value\n indented') + await bodyReader.getByText('事件边界').dispatchEvent('mouseover') + expect( + await bodyReader.locator('body').evaluate(() => (window as any).readerExecuted) + ).toBeUndefined() + await expect(bodyReader.locator('img,[src]')).toHaveCount(0) + await expect(bodyReader.getByRole('link', { name: '已取得图片地址' })).toHaveAttribute( + 'href', + origin + '/reader-resource' + ) + expect(sourceRequests).not.toContain('/reader-resource') + await bodyReader.getByRole('link', { name: '文内目录' }).click() + await expect(bodyReader.getByRole('heading', { name: '章节', exact: true })).toBeVisible() + expect( + await bodyReader.locator('body').evaluate(() => { + const target = document.getElementById(decodeURIComponent(location.hash.slice(1))) + return { url: location.href.split('#')[0], target: target?.textContent } + }) + ).toEqual({ url: 'about:srcdoc', target: '章节' }) + const jwt = await new SignJWT({ role: 'authenticated' }) .setProtectedHeader({ alg: 'HS256' }) .setIssuer('inkcre-peer') @@ -1611,6 +1873,19 @@ test('extension retains an incomplete graph and continues after browser restart' expect( roots.filter((row: { content: string }) => JSON.parse(row.content).request_id === requestId) ).toHaveLength(1) + const root = roots.find( + (row: { content: string }) => JSON.parse(row.content).request_id === requestId + ) + const anotherPeer = new WebMaterialClient(endpoint, async () => jwt) + const shared = await anotherPeer.read(root.id) + const original = shared.parts.find((part) => part.role === 'original')! + const deletion = await anotherPeer.blocks.from().delete().eq('id', original.id) + expect(deletion.error).toBeNull() + const independent = await new WebMaterialClient(endpoint, async () => jwt).read(root.id) + const body = independent.parts.find((part) => part.role === 'body')! + expect(body.format).toBe('html') + expect(Buffer.from(body.base64, 'base64').toString()).toContain('需要留下的原句。') + expect(independent.parts.some((part) => part.role === 'original')).toBe(false) expect(publicAuthHeaders).toBe(0) await recovered.screenshot({ path: 'test-results/webext-material-reader.png', fullPage: true }) } finally { diff --git a/tests/e2e/peer-database.spec.ts b/tests/e2e/peer-database.spec.ts index d207dfe6..1b1584ff 100644 --- a/tests/e2e/peer-database.spec.ts +++ b/tests/e2e/peer-database.spec.ts @@ -1533,6 +1533,69 @@ test('core Peer publishes and serves its exact capability inbounds', async ({ pa }) }) +test('saved content keeps Markdown structure and literal text in Web reading and previews', async ({ + page, +}) => { + const authorization = `Bearer ${await token()}` + const headers = { Authorization: authorization, 'Content-Type': 'application/json' } + const created = await fetch(`${postgrestUrl}blocks`, { + method: 'POST', + headers: { ...headers, Prefer: 'return=representation' }, + body: JSON.stringify([ + { + resolver: 'core.markdown.v1', + storage: null, + content: + '# Saved Markdown\n\n`` stays literal\n\n| Name | Value |\n| --- | --- |\n| A | 12 |\n\n```text\n\n indented\n```\n\n- [x] retained task', + }, + { resolver: 'core.text.v1', storage: null, content: 'Plain stays literal' }, + { + resolver: 'core.html.v1', + storage: null, + content: + '

Saved HTML

NameValue
A12
<node>\n  indented
', + }, + ]), + }) + expect(created.status).toBe(201) + const blocks: { id: number; resolver: string; content: string }[] = await created.json() + try { + for (const block of blocks) { + await page.goto(`/info-base/list/blocks/${block.id}/content`) + if (block.resolver === 'core.text.v1') { + await expect(page.locator('.solved-content-popup__content')).toContainText(block.content) + } else { + const reader = page.frameLocator('iframe.ink-content-reader') + await expect(reader.getByRole('heading', { level: 1 })).toHaveText( + block.resolver === 'core.markdown.v1' ? 'Saved Markdown' : 'Saved HTML' + ) + await expect(reader.getByRole('cell', { name: '12', exact: true })).toBeVisible() + expect(await reader.locator('pre').textContent()).toMatch(/^\n indented\n?$/) + if (block.resolver === 'core.markdown.v1') { + await expect(reader.getByRole('checkbox')).toBeChecked() + await expect(reader.getByRole('checkbox')).toBeDisabled() + await page.screenshot({ path: 'test-results/web-markdown-reader.png' }) + } + } + if (block.resolver !== 'core.html.v1') { + await page.goto(`/info-base/graph/blocks/${block.id}`) + await expect( + page.locator('.content-preview').filter({ hasText: 'stays literal' }).first() + ).toContainText('') + } + } + } finally { + const cleanup = await fetch( + `${postgrestUrl}blocks?id=in.(${blocks.map((block) => block.id).join(',')})`, + { + method: 'DELETE', + headers, + } + ) + expect(cleanup.status).toBe(204) + } +}) + test('Block Inspector delegates rumination through the discovered Peer', async ({ page }) => { const authorization = `Bearer ${await token()}` const content = `E2E rumination focal block ${Date.now()}` From 0eb7e18ad66da7d1cab27d6950ff478642a165dd Mon Sep 17 00:00:00 2001 From: Lan_zhijiang Date: Tue, 27 Oct 2026 20:40:41 +0800 Subject: [PATCH 3/5] =?UTF-8?q?chore(ui):=20=E6=8E=A5=E5=85=A5=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E5=8F=91=E5=B8=83=E7=9A=84=202.7.0=20=E9=98=85?= =?UTF-8?q?=E8=AF=BB=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Web、WebExt 与 Local Files 使用正式包及真实锁文件 - 移除 WebExt 旧版补丁,保留仍被其它消费者使用的 2.5.0 补丁 - 完整 pnpm check 通过,采用 UI 固定的 Marked 版本准入 --- .changeset/hister-content.md | 2 + apps/client-web/package.json | 2 +- apps/client-webext/package.json | 2 +- extensions/local-files/package.json | 2 +- patches/@inkcre__ui-web@2.6.0.patch | 12 ------ pnpm-lock.yaml | 58 +++++++++++++++++++++++------ pnpm-workspace.yaml | 8 ++-- 7 files changed, 55 insertions(+), 31 deletions(-) delete mode 100644 patches/@inkcre__ui-web@2.6.0.patch diff --git a/.changeset/hister-content.md b/.changeset/hister-content.md index 3208cb2b..ba673f30 100644 --- a/.changeset/hister-content.md +++ b/.changeset/hister-content.md @@ -6,3 +6,5 @@ --- 保留页面已有正文与 HTML 结构,增加 Markdown 通用解释与安全阅读,并衔接 Local Files v2 及旧网页材料。 + +Web、WebExt 与 Local Files 使用正式 UI 2.7.0 阅读组件;移除已被上游修复取代的 WebExt 2.6.0 补丁,其余 2.5.0 消费者仍保留原补丁。 diff --git a/apps/client-web/package.json b/apps/client-web/package.json index 130179f9..663faff8 100644 --- a/apps/client-web/package.json +++ b/apps/client-web/package.json @@ -16,7 +16,7 @@ "@dagrejs/dagre": "^3.1.1", "@inkcre/core": "workspace:*", "@inkcre/extension-runtime-client-web": "https://github.com/InKCre/ext-reg/releases/download/runtime-client-web-v0.4.2/inkcre-extension-runtime-client-web-0.4.2.tgz", - "@inkcre/ui-web": "2.5.0", + "@inkcre/ui-web": "2.7.0", "@module-federation/runtime": "^0.21.4", "@supabase/postgrest-js": "^2.84.0", "@types/d3-force": "^3.0.10", diff --git a/apps/client-webext/package.json b/apps/client-webext/package.json index dddf39da..d789c592 100644 --- a/apps/client-webext/package.json +++ b/apps/client-webext/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "@inkcre/core": "workspace:*", - "@inkcre/ui-web": "2.6.0", + "@inkcre/ui-web": "2.7.0", "@inkcre/web-collection": "workspace:*", "@mozilla/readability": "^0.6.0", "vue": "^3.5.21", diff --git a/extensions/local-files/package.json b/extensions/local-files/package.json index ee65c7c2..1290d67b 100644 --- a/extensions/local-files/package.json +++ b/extensions/local-files/package.json @@ -15,7 +15,7 @@ }, "devDependencies": { "@inkcre/ext-dev-utils": "workspace:*", - "@inkcre/ui-web": "2.3.0", + "@inkcre/ui-web": "2.7.0", "@module-federation/vite": "^1.1.0", "@vitejs/plugin-vue": "^6.0.1", "@vue/tsconfig": "catalog:", diff --git a/patches/@inkcre__ui-web@2.6.0.patch b/patches/@inkcre__ui-web@2.6.0.patch deleted file mode 100644 index e7482288..00000000 --- a/patches/@inkcre__ui-web@2.6.0.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/dist/index.js b/dist/index.js ---- a/dist/index.js -+++ b/dist/index.js -@@ -496,7 +496,7 @@ const Je = { - Y(E.$slots, "default", {}, () => [ - G(T(E.modelValue || E.placeholder), 1) - ], !0) -- ], 16, Wt)) : E.type !== "inline" || !E.editable ? (l(), v("span", { -+ ], 16, Wt)) : !E.editable ? (l(), v("span", { - key: 3, - id: d(i), - class: "ink-input__value" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 306aa577..b6574aac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,7 +16,7 @@ catalogs: overrides: '@inkcre/ui-web@2.3.0': https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.3.0/inkcre-ui-web-2.3.0.tgz '@inkcre/ui-web@2.5.0': https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.5.0/inkcre-ui-web-2.5.0.tgz - '@inkcre/ui-web@2.6.0': https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.6.0/inkcre-ui-web-2.6.0.tgz + '@inkcre/ui-web@2.7.0': https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz typescript: npm:typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2 '@babel/core@<=7.29.0': 7.29.7 adm-zip@<0.6.0: 0.6.0 @@ -40,7 +40,6 @@ overrides: patchedDependencies: '@inkcre/ui-web@2.5.0': 2b0f967ae08c3559202523c4ccb3ed4769ff9d8863a52c600259231171d56051 - '@inkcre/ui-web@2.6.0': 510778c1fcb3c445ae29f4434bc6543f3e1504cb336211665db056c9c00f25b2 importers: @@ -107,8 +106,8 @@ importers: specifier: https://github.com/InKCre/ext-reg/releases/download/runtime-client-web-v0.4.2/inkcre-extension-runtime-client-web-0.4.2.tgz version: https://github.com/InKCre/ext-reg/releases/download/runtime-client-web-v0.4.2/inkcre-extension-runtime-client-web-0.4.2.tgz(@inkcre/core@packages+core)(@module-federation/runtime@0.21.6) '@inkcre/ui-web': - specifier: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.5.0/inkcre-ui-web-2.5.0.tgz - version: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.5.0/inkcre-ui-web-2.5.0.tgz(patch_hash=2b0f967ae08c3559202523c4ccb3ed4769ff9d8863a52c600259231171d56051)(unocss@66.7.5(vite@7.3.6(@types/node@22.17.2)(jiti@2.7.0)(lightningcss@1.33.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2)) + specifier: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz + version: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz(unocss@66.7.5(vite@7.3.6(@types/node@22.17.2)(jiti@2.7.0)(lightningcss@1.33.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2)) '@module-federation/runtime': specifier: ^0.21.4 version: 0.21.6 @@ -219,8 +218,8 @@ importers: specifier: workspace:* version: link:../../packages/core '@inkcre/ui-web': - specifier: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.6.0/inkcre-ui-web-2.6.0.tgz - version: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.6.0/inkcre-ui-web-2.6.0.tgz(patch_hash=510778c1fcb3c445ae29f4434bc6543f3e1504cb336211665db056c9c00f25b2)(unocss@66.7.5(vite@8.1.5(@types/node@22.17.2)(esbuild@0.28.1)(jiti@2.7.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2)) + specifier: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz + version: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz(unocss@66.7.5(vite@8.1.5(@types/node@22.17.2)(esbuild@0.28.1)(jiti@2.7.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2)) '@inkcre/web-collection': specifier: workspace:* version: link:../../packages/web-collection @@ -425,8 +424,8 @@ importers: specifier: workspace:* version: link:../../packages/ext-dev-utils '@inkcre/ui-web': - specifier: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.3.0/inkcre-ui-web-2.3.0.tgz - version: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.3.0/inkcre-ui-web-2.3.0.tgz(unocss@66.7.5(vite@7.3.6(@types/node@22.17.2)(jiti@2.7.0)(lightningcss@1.33.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2)) + specifier: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz + version: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz(unocss@66.7.5(vite@7.3.6(@types/node@22.17.2)(jiti@2.7.0)(lightningcss@1.33.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2)) '@module-federation/vite': specifier: ^1.1.0 version: 1.7.1(rollup@4.59.0) @@ -1558,9 +1557,9 @@ packages: unocss: optional: true - '@inkcre/ui-web@https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.6.0/inkcre-ui-web-2.6.0.tgz': - resolution: {integrity: sha512-sXV4a4vAHt0wMnmq7DuPht1CI2skR/s1V8CRglxu929eJIelB6t4pLKbTuwNpR93QUHTW0TbtmIM2ePc29oCsQ==, tarball: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.6.0/inkcre-ui-web-2.6.0.tgz} - version: 2.6.0 + '@inkcre/ui-web@https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz': + resolution: {integrity: sha512-2x6MWCARp9v05x1K/DDhtNUiV1E0jQS1sXIjG/0/1oYgvWOG/DjQvQ0ArL+alg6mWQm8gdKPKBeuv8bFaRtC6w==, tarball: https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz} + version: 2.7.0 peerDependencies: unocss: ^66.5.0 vue: ^3.5.25 @@ -3745,6 +3744,9 @@ packages: dompurify@3.4.13: resolution: {integrity: sha512-2vmYIoqjze2d+kakP8S/nS5shfsl587kzwEjcGlTdiksUVgFHnFCsLYDVj/JNqJVOQZGSYBTmuycv0PodwmnMQ==} + dompurify@3.4.8: + resolution: {integrity: sha512-yb1cEmaOum7wFvOCSQxyfgVlv5D47Rc30iZWoMpbDIWTnJ6grDDQyu2KFJzB2k7u0pMuJcQ1zphH//fFnw2tjQ==} + domutils@3.2.2: resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==} @@ -4504,6 +4506,11 @@ packages: resolution: {integrity: sha512-1DiZmDHPXMBgMRjeUtHy1q1VYmeJscHxhIAexX9z/zjRMP80+0ETuPfssi8z+kMY4DwUgsKuHqpjxgmeA9gBNA==} engines: {node: '>=18'} + marked@18.1.2: + resolution: {integrity: sha512-DfOnvLAQ6WYeWxWO1u4RyFOeqyHup6dks5PPqnoFiooU7ipRvidO/2j8plhAHIiZg574E9ZlzSjUiPMLAzFkgg==} + engines: {node: '>= 20'} + hasBin: true + marky@1.3.0: resolution: {integrity: sha512-ocnPZQLNpvbedwTy9kNrQEsknEfgvcLMvOtz3sFeWApDq1MXH1TqkCIx58xlpESsfwQOnuBO9beyQuNGzVvuhQ==} @@ -6924,7 +6931,7 @@ snapshots: optionalDependencies: unocss: 66.7.5(vite@8.1.5(@types/node@22.17.2)(esbuild@0.28.1)(jiti@2.7.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)) - '@inkcre/ui-web@https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.6.0/inkcre-ui-web-2.6.0.tgz(patch_hash=510778c1fcb3c445ae29f4434bc6543f3e1504cb336211665db056c9c00f25b2)(unocss@66.7.5(vite@8.1.5(@types/node@22.17.2)(esbuild@0.28.1)(jiti@2.7.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2))': + '@inkcre/ui-web@https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz(unocss@66.7.5(vite@7.3.6(@types/node@22.17.2)(jiti@2.7.0)(lightningcss@1.33.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2))': dependencies: '@codemirror/autocomplete': 6.20.3 '@codemirror/commands': 6.11.1 @@ -6935,6 +6942,27 @@ snapshots: '@vue/shared': 3.5.25 '@vueuse/core': 14.4.0(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2)) dayjs: 1.11.23 + dompurify: 3.4.8 + marked: 18.1.2 + vscode-json-languageservice: 5.6.4 + vscode-languageserver-textdocument: 1.0.14 + vue: 3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2) + optionalDependencies: + unocss: 66.7.5(vite@7.3.6(@types/node@22.17.2)(jiti@2.7.0)(lightningcss@1.33.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)) + + '@inkcre/ui-web@https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz(unocss@66.7.5(vite@8.1.5(@types/node@22.17.2)(esbuild@0.28.1)(jiti@2.7.0)(sass-embedded@1.90.0)(sass@1.101.6)(yaml@2.9.0)))(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2))': + dependencies: + '@codemirror/autocomplete': 6.20.3 + '@codemirror/commands': 6.11.1 + '@codemirror/lang-json': 6.0.2 + '@codemirror/lint': 6.9.7 + '@codemirror/state': 6.7.5 + '@codemirror/view': 6.43.12 + '@vue/shared': 3.5.25 + '@vueuse/core': 14.4.0(vue@3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2)) + dayjs: 1.11.23 + dompurify: 3.4.8 + marked: 18.1.2 vscode-json-languageservice: 5.6.4 vscode-languageserver-textdocument: 1.0.14 vue: 3.5.40(typescript-native-bridge@6.0.3-bridge.19.tsgo.7.0.2) @@ -8777,6 +8805,10 @@ snapshots: optionalDependencies: '@types/trusted-types': 2.0.7 + dompurify@3.4.8: + optionalDependencies: + '@types/trusted-types': 2.0.7 + domutils@3.2.2: dependencies: dom-serializer: 2.0.0 @@ -9498,6 +9530,8 @@ snapshots: many-keys-map@3.0.3: {} + marked@18.1.2: {} + marky@1.3.0: {} mdn-data@2.27.1: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 8551f42a..11c4b304 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -19,7 +19,7 @@ allowBuilds: overrides: '@inkcre/ui-web@2.3.0': https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.3.0/inkcre-ui-web-2.3.0.tgz '@inkcre/ui-web@2.5.0': https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.5.0/inkcre-ui-web-2.5.0.tgz - '@inkcre/ui-web@2.6.0': https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.6.0/inkcre-ui-web-2.6.0.tgz + '@inkcre/ui-web@2.7.0': https://github.com/InKCre/ui/releases/download/%40inkcre%2Fui-web%402.7.0/inkcre-ui-web-2.7.0.tgz typescript: *typescript '@babel/core@<=7.29.0': 7.29.7 adm-zip@<0.6.0: 0.6.0 @@ -42,7 +42,7 @@ overrides: ws@>=8.0.0 <8.21.0: 8.21.0 minimumReleaseAgeExclude: - - '@inkcre/ui-web@2.0.0 || 2.0.1 || 2.1.0 || 2.1.1 || 2.2.0 || 2.2.1 || 2.3.0 || 2.4.0 || 2.5.0 || 2.6.0' + - '@inkcre/ui-web@2.0.0 || 2.0.1 || 2.1.0 || 2.1.1 || 2.2.0 || 2.2.1 || 2.3.0 || 2.4.0 || 2.5.0 || 2.6.0 || 2.7.0' - '@supabase/cli-darwin-arm64@2.112.0' - '@supabase/cli-darwin-x64@2.112.0' - '@supabase/cli-linux-arm64-musl@2.112.0' @@ -52,8 +52,8 @@ minimumReleaseAgeExclude: - '@supabase/cli-windows-arm64@2.112.0' - '@supabase/cli-windows-x64@2.112.0' - supabase@2.112.0 + - marked@18.1.2 patchedDependencies: - # shortcut: 修复 2.5.0/2.6.0 重复渲染输入值和 ID;升级到上游修复版时移除对应补丁。 + # shortcut: 修复剩余 2.5.0 消费者重复渲染输入值和 ID;升级到上游修复版时移除对应补丁。 '@inkcre/ui-web@2.5.0': patches/@inkcre__ui-web@2.5.0.patch - '@inkcre/ui-web@2.6.0': patches/@inkcre__ui-web@2.6.0.patch From 1661ebedf18936f7dbde02dcd03795efff10b9cd Mon Sep 17 00:00:00 2001 From: Lan_zhijiang Date: Tue, 27 Oct 2026 20:51:14 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix(extensions):=20=E7=94=B1=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E8=80=85=E5=A3=B0=E6=98=8E=E8=87=AA=E5=B7=B1=E7=9A=84?= =?UTF-8?q?=20UI=20=E7=89=88=E6=9C=AC=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MF 构建接收生产者 manifest 中的 UI 版本,避免 Host 升级反向改写扩展要求 - 保留严格产物检查、单例和既有 fallback,不扩展兼容范围 - 完整 pnpm check 及 Twitter 产物检查通过 --- .changeset/hister-content.md | 8 ++++++++ docs/30-unit-tdd/native-extension-runtime.md | 2 +- extensions/caldav/vite.config.ts | 5 ++++- extensions/capture/vite.config.ts | 5 ++++- extensions/github/vite.config.ts | 5 ++++- extensions/local-files/vite.config.ts | 5 ++++- extensions/mail/vite.config.ts | 5 ++++- extensions/memos/vite.config.ts | 5 ++++- extensions/mf-shared.ts | 4 ++-- extensions/twitter/vite.config.ts | 5 ++++- 10 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.changeset/hister-content.md b/.changeset/hister-content.md index ba673f30..d9f946d5 100644 --- a/.changeset/hister-content.md +++ b/.changeset/hister-content.md @@ -3,8 +3,16 @@ '@inkcre/client-web': patch '@inkcre/client-webext': patch '@inkcre/ext-local-files': minor +'@inkcre/ext-mail': patch +'@inkcre/ext-memos': patch +'@inkcre/ext-twitter': patch +'@inkcre/ext-github': patch +'@inkcre/ext-capture': patch +'@inkcre/ext-caldav': patch --- 保留页面已有正文与 HTML 结构,增加 Markdown 通用解释与安全阅读,并衔接 Local Files v2 及旧网页材料。 Web、WebExt 与 Local Files 使用正式 UI 2.7.0 阅读组件;移除已被上游修复取代的 WebExt 2.6.0 补丁,其余 2.5.0 消费者仍保留原补丁。 + +MF 产物的 UI 要求取自各生产者自己的依赖声明,避免 Host 升级重写其它扩展的要求;保留单例、既有 fallback 和严格产物一致性检查。 diff --git a/docs/30-unit-tdd/native-extension-runtime.md b/docs/30-unit-tdd/native-extension-runtime.md index 20aa12eb..5c8b64c4 100644 --- a/docs/30-unit-tdd/native-extension-runtime.md +++ b/docs/30-unit-tdd/native-extension-runtime.md @@ -32,7 +32,7 @@ semantically equal and to accept the build SDK. SDK sharing remains a Host-only a bundled fallback. UI compatibility is declared independently and is not implied by the SDK range. Host 与 Web 扩展通过现有 Module Federation 配置共享 `@inkcre/ui-web` 单例, -并声明当前锁定 UI 版本的要求。UI 的 i18n、路由和表单上下文使用模块内的 Vue 注入 key; +并由每个生产者的 package.json 声明自身锁定的 UI 版本要求,构建不得用 Host 的 UI 版本覆盖它。UI 的 i18n、路由和表单上下文使用模块内的 Vue 注入 key; 如果扩展另用一份 UI 运行时,即使外观相同,也无法继承 Host 的这些上下文。 独立 playground 仍可使用包自身的 fallback 模块,样式由各自应用入口加载。 diff --git a/extensions/caldav/vite.config.ts b/extensions/caldav/vite.config.ts index 9878d993..7c9375d6 100644 --- a/extensions/caldav/vite.config.ts +++ b/extensions/caldav/vite.config.ts @@ -13,7 +13,10 @@ export default defineConfig({ filename: 'remoteEntry.js', manifest: true, exposes: { '.': fileURLToPath(new URL('./src/index.ts', import.meta.url)) }, - shared: mfShared(extensionPackage.inkcre.module_federation.host_sdk_version), + shared: mfShared( + extensionPackage.inkcre.module_federation.host_sdk_version, + extensionPackage.devDependencies['@inkcre/ui-web'] + ), }), ], base: './', diff --git a/extensions/capture/vite.config.ts b/extensions/capture/vite.config.ts index b26ef9db..c566915d 100644 --- a/extensions/capture/vite.config.ts +++ b/extensions/capture/vite.config.ts @@ -24,7 +24,10 @@ export default defineConfig({ filename: 'remoteEntry.js', manifest: true, exposes: { '.': fileURLToPath(new URL('./src/index.ts', import.meta.url)) }, - shared: mfShared(extensionPackage.inkcre.module_federation.host_sdk_version), + shared: mfShared( + extensionPackage.inkcre.module_federation.host_sdk_version, + extensionPackage.devDependencies['@inkcre/ui-web'] + ), }), ], base: './', diff --git a/extensions/github/vite.config.ts b/extensions/github/vite.config.ts index de5a891c..a3183a2a 100644 --- a/extensions/github/vite.config.ts +++ b/extensions/github/vite.config.ts @@ -28,7 +28,10 @@ export const githubFederationOptions = { filename: 'remoteEntry.js', manifest: true, exposes: { '.': path.resolve(__dirname, './src/index.ts') }, - shared: mfShared(extensionPackage.inkcre.module_federation.host_sdk_version), + shared: mfShared( + extensionPackage.inkcre.module_federation.host_sdk_version, + extensionPackage.devDependencies['@inkcre/ui-web'] + ), } export default defineConfig(async ({ command }) => { diff --git a/extensions/local-files/vite.config.ts b/extensions/local-files/vite.config.ts index 928aba64..68fd2a7e 100644 --- a/extensions/local-files/vite.config.ts +++ b/extensions/local-files/vite.config.ts @@ -29,7 +29,10 @@ export default defineConfig({ filename: 'remoteEntry.js', manifest: true, exposes: { '.': fileURLToPath(new URL('./src/index.ts', import.meta.url)) }, - shared: mfShared(extensionPackage.inkcre.module_federation.host_sdk_version), + shared: mfShared( + extensionPackage.inkcre.module_federation.host_sdk_version, + extensionPackage.devDependencies['@inkcre/ui-web'] + ), }), ], base: './', diff --git a/extensions/mail/vite.config.ts b/extensions/mail/vite.config.ts index 3d9bfa69..da0c59ff 100644 --- a/extensions/mail/vite.config.ts +++ b/extensions/mail/vite.config.ts @@ -29,7 +29,10 @@ export const mailFederationOptions = { filename: 'remoteEntry.js', manifest: true, exposes: { '.': path.resolve(__dirname, './src/index.ts') }, - shared: mfShared(extensionPackage.inkcre.module_federation.host_sdk_version), + shared: mfShared( + extensionPackage.inkcre.module_federation.host_sdk_version, + extensionPackage.devDependencies['@inkcre/ui-web'] + ), } export default defineConfig(async ({ command }) => { diff --git a/extensions/memos/vite.config.ts b/extensions/memos/vite.config.ts index 92a8b6b6..bff7c744 100644 --- a/extensions/memos/vite.config.ts +++ b/extensions/memos/vite.config.ts @@ -13,7 +13,10 @@ export default defineConfig({ filename: 'remoteEntry.js', manifest: true, exposes: { '.': fileURLToPath(new URL('./src/index.ts', import.meta.url)) }, - shared: mfShared(extensionPackage.inkcre.module_federation.host_sdk_version), + shared: mfShared( + extensionPackage.inkcre.module_federation.host_sdk_version, + extensionPackage.devDependencies['@inkcre/ui-web'] + ), }), ], base: './', diff --git a/extensions/mf-shared.ts b/extensions/mf-shared.ts index fef37ea6..4db94f1b 100644 --- a/extensions/mf-shared.ts +++ b/extensions/mf-shared.ts @@ -1,11 +1,11 @@ // Shared dependencies for Module Federation remote (extensions). import packageJson from '../apps/client-web/package.json' -export default function mfShared(hostSdkVersion: string) { +export default function mfShared(hostSdkVersion: string, uiVersion: string) { return { '@inkcre/ui-web': { singleton: true, - requiredVersion: packageJson.dependencies['@inkcre/ui-web'], + requiredVersion: uiVersion, }, vue: { singleton: true, requiredVersion: packageJson.dependencies.vue }, pinia: { singleton: true, requiredVersion: packageJson.dependencies.pinia }, diff --git a/extensions/twitter/vite.config.ts b/extensions/twitter/vite.config.ts index 5cfc9535..acdca3b7 100644 --- a/extensions/twitter/vite.config.ts +++ b/extensions/twitter/vite.config.ts @@ -34,7 +34,10 @@ export const twitterFederationOptions = { './src/components/contentTweet/contentTweet.vue' ), }, - shared: mfShared(extensionPackage.inkcre.module_federation.host_sdk_version), + shared: mfShared( + extensionPackage.inkcre.module_federation.host_sdk_version, + extensionPackage.devDependencies['@inkcre/ui-web'] + ), } export default defineConfig(async ({ command }) => { From 49841910968069790b545bf1725dd8f028d713ce Mon Sep 17 00:00:00 2001 From: Lan_zhijiang Date: Tue, 27 Oct 2026 21:32:29 +0800 Subject: [PATCH 5/5] =?UTF-8?q?docs(shared):=20=E5=BC=95=E7=94=A8=E5=B7=B2?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E7=9A=84=E5=86=85=E5=AE=B9=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=90=88=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将共享文档固定到 docs#48 的主线提交 --- docs/_shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_shared b/docs/_shared index e748a564..4e323b49 160000 --- a/docs/_shared +++ b/docs/_shared @@ -1 +1 @@ -Subproject commit e748a564fb7f2a066fca98f826c9130d32e888c8 +Subproject commit 4e323b49ffcd00011f7e008fbb53866c6bec5a27