From dd5a6cd23805eed2153bcc83e7d398778fcaf532 Mon Sep 17 00:00:00 2001 From: dlzmoe <65840178+dlzmoe@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:21:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A6=96=E9=A1=B5=20banner=20=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/extensions.json | 4 +- README.md | 6 ++- README_EN.md | 103 +++++++++++++++++++++------------------- docs/.gitignore | 3 +- toc.py | 32 ++++++------- translate_md.py | 1 - 6 files changed, 77 insertions(+), 72 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 58b7200f..d5647532 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,3 @@ { - "recommendations": [ - "Vue.volar" - ] + "recommendations": ["Vue.volar"] } \ No newline at end of file diff --git a/README.md b/README.md index cb4e29a7..8282675a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

linuxdo 增强插件(linuxdo-scripts)

-

脚本持续更新,欢迎提出 issues,提交 pr ~

+

脚本持续更新,欢迎提出 Issues,提交 Pr ~

[中文简体](https://github.com/dlzmoe/linuxdo-scripts/blob/main/README.md) | [English](https://github.com/dlzmoe/linuxdo-scripts/blob/main/README_EN.md) @@ -29,7 +29,9 @@ linux.do 增强插件,话题列表显示创建时间,显示楼层数,新 - [目录](#目录) - [功能特性](#功能特性) - [使用方法](#使用方法) + - [小白法](#小白法) - [开发说明](#开发说明) + - [CSP 问题](#csp-问题) - [更新日志](#更新日志) - [贡献历史](#贡献历史) - [免责声明](#免责声明) @@ -87,7 +89,7 @@ linux.do 增强插件,话题列表显示创建时间,显示楼层数,新 [https://greasyfork.org/scripts/501827](https://greasyfork.org/scripts/501827) -### (小白法) +### 小白法 - [Chrome - 暴力猴](https://chromewebstore.google.com/detail/jinjaccalgkegednnccohejagnlnfdag) - [Edge - 暴力猴](https://microsoftedge.microsoft.com/addons/detail/violentmonkey/eeagobfjdenkkddmbclomhiblgggliao) diff --git a/README_EN.md b/README_EN.md index d141f532..326a079c 100644 --- a/README_EN.md +++ b/README_EN.md @@ -1,66 +1,71 @@ -## linuxdo Enhancement Plugin (linuxdo-scripts) +## linuxdo Enhanced Plugin (linuxdo-scripts) -Scripts are continuously updated. Issues and pull requests are welcome! +Scripts are continuously updated. Issues and PR submissions are welcome! [简体中文](https://github.com/dlzmoe/linuxdo-scripts/blob/main/README.md) | [English](https://github.com/dlzmoe/linuxdo-scripts/blob/main/README_EN.md) -![Release](https://img.shields.io/github/v/release/dlzmoe/linuxdo-scripts?label=linuxdo%20%E5%A2%9E%E5%BC%BA%E6%8F%92%E4%BB%B6&labelColor=%235D5D5D&color=%23E97435) ![Last Commit](https://img.shields.io/github/last-commit/dlzmoe/linuxdo-scripts) ![Stars](https://img.shields.io/github/stars/dlzmoe%2Flinuxdo-scripts?style=flat) ![License](https://img.shields.io/github/license/dlzmoe/linuxdo-scripts) +![Release Badge](https://img.shields.io/github/v/release/dlzmoe/linuxdo-scripts?label=linuxdo%20%E5%A2%9E%E5%BC%BA%E6%8F%92%E4%BB%B6&labelColor=%235D5D5D&color=%23E97435) +![Last Commit Badge](https://img.shields.io/github/last-commit/dlzmoe/linuxdo-scripts) +![Stars Badge](https://img.shields.io/github/stars/dlzmoe%2Flinuxdo-scripts?style=flat) +![License Badge](https://img.shields.io/github/license/dlzmoe/linuxdo-scripts) -The linux.do enhancement plugin provides features such as displaying the creation time of topics, showing floor numbers, opening topics in new tabs, forcing block (blacklisting) of certain topics, convenient replies (customizable), optimizing signature image display, previewing details and comments directly in the topic list, import/export settings panel, floor lotteries, user-defined tags, view only the author's posts, auto-scrolling reading, support for custom CSS styles, mixed rendering of Chinese and English, level information queries, AI-based topic summary feature, intelligent reply generation, support for WebDAV synchronization, switching forum theme skins, and more. Please check the settings list for continuous updates and feel free to propose new ideas! +The linux.do enhanced plugin adds features such as displaying creation time for topics, showing floor count, opening topics in a new tab, forcing block on certain users' topics, quick replies (customizable), optimizing signature image display, directly previewing details and comments in the topic list, import/export settings panel, floor lottery, user-defined tags, view only the original poster, auto-scrolling reading, support for custom CSS styles, mixed Chinese and English optimization, rank information query, AI topic summarization, intelligent reply generation, WebDAV sync support, theme skin switching, and more! More features can be found in the settings list. Continuous updates are made, and new ideas are welcome! -[GitHub Repository](https://github.com/dlzmoe/linuxdo-scripts) | [Install from Greasyfork Store](https://greasyfork.org/scripts/501827) | [Bug Reporting & Feature Requests](https://github.com/dlzmoe/linuxdo-scripts/issues/new/choose) | [Usage and Development Documentation](https://linuxdo-scripts-docs.netlify.app/) | [Discord Community](https://discord.gg/n2pErsD7Kg) +[GitHub Repository](https://github.com/dlzmoe/linuxdo-scripts) | [Greasyfork Store Installation](https://greasyfork.org/scripts/501827) | [Bug Feedback & Feature Requests](https://github.com/dlzmoe/linuxdo-scripts/issues/new/choose) | [Usage and Development Documentation](https://linuxdo-scripts-docs.netlify.app/) | [Discord Community](https://discord.gg/n2pErsD7Kg) -> **Note:** -> I will share interesting features in the group chat as soon as possible, as I feel that posting too frequently may be annoying. -> Join the Discord community: https://discord.gg/n2pErsD7Kg +> **TIP** +> I will share any fun features promptly in the group chat. I feel like I post too frequently. +> Discord Community: [https://discord.gg/n2pErsD7Kg](https://discord.gg/n2pErsD7Kg) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/anghunk) ## Table of Contents - [Table of Contents](#table-of-contents) - [Features](#features) -- [Usage](#usage) -- [Development Notes](#development-notes) +- [Usage Instructions](#usage-instructions) + - [Beginner Method](#beginner-method) +- [Development Instructions](#development-instructions) + - [CSP Issues](#csp-issues) - [Changelog](#changelog) - [Contribution History](#contribution-history) - [Disclaimer](#disclaimer) -- [License Agreement](#license-agreement) +- [Copyright Agreement](#copyright-agreement) --- -The development environment is Windows / Chrome / Violentmonkey. If you encounter errors or it doesn't work with other userscript managers, try using Violentmonkey (which I am currently using and is quite compatible). +The development environment is Windows / Chrome / Violentmonkey. If there are errors or it doesn’t work with other userscript managers, try using Violentmonkey (which I’m currently using, with better compatibility). -> **Warning:** -> Arc browser users should use the Violentmonkey extension. -> The tamper monkey extension cannot be used in Arc browser due to compatibility issues. +> **WARNING** +> Arc browser users should use Violentmonkey extension. +> The monkey tampering extension cannot be used under the Arc browser due to compatibility issues. ## Features -- [x] Display creation time in topic list -- [x] Show floor numbers +- [x] Display creation time for topics +- [x] Show floor count - [x] Open topics in a new tab -- [x] Force block (blacklist) certain topics -- [x] Convenient replies (customizable) -- [x] Optimize signature image display -- [x] Import/export feature settings panel +- [x] Force block (blacklist) certain users' topics +- [x] Quick replies for topics (customizable) +- [x] Optimize signature image display to prevent image breaking +- [x] Import/export settings panel - [x] Floor lottery -- [x] Toggle view only the author's posts +- [x] Toggle view only the original poster - [x] Auto-scrolling reading - [x] Dark mode - [x] User tagging feature -- [x] Direct preview of details and comments in topic list -- [x] Comment box emoji optimization -- [x] Support for custom CSS styles -- [x] Mixed rendering of Chinese and English is optimized -- [x] Added level information query +- [x] Directly preview details and comments in the topic list +- [x] Emoji optimization in comment boxes +- [x] Support custom CSS styles +- [x] Mixed Chinese and English display optimization +- [x] New rank information query - [x] Switch forum emoji styles -- [x] AI-based topic summary feature and intelligent reply generation -- [x] Support for WebDAV synchronization -- [x] Switch forum theme skins -- [x] More features, please check the settings list +- [x] AI summarization of topics and intelligent reply generation +- [x] Support WebDAV synchronization +- [x] Switch forum theme skin +- [x] More features are available in the settings list
-Demo Screenshots: +Some Screenshot Demos: | ![image](https://github.com/user-attachments/assets/f3fb854f-e6fd-4da4-9a9c-377b6537fab7) | ![image](https://github.com/user-attachments/assets/3b2a9e63-3939-4dbc-a00f-c713ca2c7f33) | | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | @@ -69,36 +74,36 @@ The development environment is Windows / Chrome / Violentmonkey. If you encounte
-## Usage +## Usage Instructions -Click the link to enter the Greasyfork store to download and install. +Click the following link to enter the Greasyfork store for installation. [https://greasyfork.org/scripts/501827](https://greasyfork.org/scripts/501827) -### (For Beginners) +### Beginner Method - [Chrome - Violentmonkey](https://chromewebstore.google.com/detail/jinjaccalgkegednnccohejagnlnfdag) - [Edge - Violentmonkey](https://microsoftedge.microsoft.com/addons/detail/violentmonkey/eeagobfjdenkkddmbclomhiblgggliao) -- [Firefox - Greasemonkey](https://addons.mozilla.org/zh-CN/firefox/addon/greasemonkey/) +- [Firefox - Greasemonkey](https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/) -First, you need to install a userscript manager by choosing the one that corresponds to your browser. Once installed, you will see the userscript manager in the browser's extensions. +First, you need to install a userscript manager; choose the appropriate manager for your browser, download and install it. After installation, you will see Greasemonkey in the browser’s extensions section. -Then, you can click the above link ([https://greasyfork.org/scripts/501827](https://greasyfork.org/scripts/501827)) to download the script. After downloading, click on the extensions icon in the top right corner of the browser, and you will see the linuxdo enhancement plugin, which you can manage freely. +Then, click the link above ([https://greasyfork.org/scripts/501827](https://greasyfork.org/scripts/501827)) to download the script. After downloading, click the extension icon in the upper right corner of your browser, select the Greasemonkey icon, and you'll find the linuxdo enhanced plugin for self-management. -Finally, open the [https://linux.do/](https://linux.do/) forum and the plugin should work normally. (You need to refresh the forum page after installation for it to work properly.) +Finally, open [https://linux.do/](https://linux.do/) forum to use the plugin normally. (You need to refresh the forum page after installation for it to work properly) -## Development Notes +## Development Instructions ``` node: v16.15.1 ``` -> **Note:** -> Essential: Due to the forum's CSP, scripts cannot be injected during local development, so you need to install the [Chrome extension - Disable-CSP](https://github.com/lisonge/Disable-CSP) to bypass CSP and enable the first option `Disable HTTP CSP`. +> **NOTE** +> Prerequisite: Since the forum has enabled CSP, you cannot inject scripts during local development. You need to install the [Google Extension - Disable-CSP](https://github.com/lisonge/Disable-CSP) to bypass CSP and enable the first option `Disable HTTP CSP`. -Features are developed as components to avoid conflicts when adding new features. +Features are developed as components so that each new feature can register a new component to avoid conflicts. -Clone this repository and install dependencies to run the code. +Clone this repository, install dependencies, and run the code. ```shell git clone https://github.com/dlzmoe/linuxdo-scripts @@ -106,11 +111,11 @@ yarn # Install dependencies yarn dev # Run locally ``` -No build is required; I will review PR codes and merge them in the shortest time possible if there are no major issues. +No need to build. After submitting a PR, I will review it, and if there are no major issues, it will be merged as soon as possible. ### CSP Issues -If you see `Refused to load the script xxxxx` when loading local scripts, you can use [Disable-CSP](https://github.com/lisonge/Disable-CSP) to temporarily disable CSP. Remember to revert after development. +If loading the local script shows `Refused to load the script xxxxx`, you can use [Disable-CSP](https://github.com/lisonge/Disable-CSP) to temporarily disable CSP. Remember to revert after development completion. ## Changelog @@ -124,8 +129,8 @@ If you see `Refused to load the script xxxxx` when loading local scripts, you ca ## Disclaimer -All features provided in this script run solely within the browser. The source code used is open and transparent. This script is for study and research purposes only, does not use any profit-making schemes, or participate in any profit-making organizations. Any disputes arising from the use of this script should be resolved amicably. This script is not responsible for any form of loss or damage that may be caused to the user or others while using the software provided by this script. By downloading, installing, and using the software provided in this product, users indicate their trust in the author and related agreements and disclaimers. +All features provided by this script run only in the browser. The source code used is publicly visible and transparent. This script is for educational research purposes only and does not use any profit schemes or participate in any profit organizations. Any disputes arising from the use of this script or related to it should be resolved amicably. This script is not responsible for any form of loss or harm caused to users or others by using the software provided by this script. By downloading, installing, and using the software provided in this product, users indicate their trust in the author and related agreements & disclaimers. -## License Agreement +## Copyright Agreement -[Apache-2.0 license](https://github.com/dlzmoe/linuxdo-scripts/blob/main/LICENSE) +[Apache-2.0 License](https://github.com/dlzmoe/linuxdo-scripts/blob/main/LICENSE) \ No newline at end of file diff --git a/docs/.gitignore b/docs/.gitignore index 1b2c89f7..fe0d673b 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -14,4 +14,5 @@ temp examples-temp node_modules pnpm-global -TODOs.md \ No newline at end of file +TODOs.md +yarn.lock \ No newline at end of file diff --git a/toc.py b/toc.py index af115d30..d79de2e5 100644 --- a/toc.py +++ b/toc.py @@ -2,22 +2,22 @@ import re def generate_toc(md_file): - toc = [] - with open(md_file, 'r', encoding='utf-8') as file: - for line in file: - if line.startswith('## '): - title = line[3:].strip() - link = re.sub(r'\s+', '-', title.lower()) - toc.append(f' - [{title}](#{link})') - elif line.startswith('### '): - title = line[4:].strip() - link = re.sub(r'\s+', '-', title.lower()) - toc.append(f' - [{title}](#{link})') + toc = [] + with open(md_file, 'r', encoding='utf-8') as file: + for line in file: + if line.startswith('## '): + title = line[3:].strip() + link = re.sub(r'\s+', '-', title.lower()) + toc.append(f' - [{title}](#{link})') + elif line.startswith('### '): + title = line[4:].strip() + link = re.sub(r'\s+', '-', title.lower()) + toc.append(f' - [{title}](#{link})') - return '\n'.join(toc) + return '\n'.join(toc) if __name__ == "__main__": - md_file = 'README.md' - toc = generate_toc(md_file) - print("## 目录") - print(toc) + md_file = 'README.md' + toc = generate_toc(md_file) + print("## 目录") + print(toc) diff --git a/translate_md.py b/translate_md.py index 183046b4..3a606759 100644 --- a/translate_md.py +++ b/translate_md.py @@ -5,7 +5,6 @@ # 加载 .env 文件中的环境变量 load_dotenv() -# 配置选项 OPENAI_URL = os.getenv("OPENAI_URL") API_KEY = os.getenv("API_KEY") MODEL = os.getenv("MODEL")