twikoo 1.7.24 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,72 +1,44 @@
1
1
  {
2
2
  "name": "twikoo",
3
- "version": "1.7.24",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "A simple comment system.",
5
- "keywords": [
6
- "twikoojs",
7
- "comment",
8
- "comment-system",
9
- "cloudbase",
10
- "vercel"
11
- ],
12
- "author": "imaegoo <hello@imaegoo.com> (https://github.com/imaegoo)",
13
5
  "license": "MIT",
14
- "main": "./dist/twikoo.all.min.js",
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
6
  "repository": {
19
7
  "type": "git",
20
8
  "url": "https://github.com/twikoojs/twikoo.git"
21
9
  },
22
- "homepage": "https://twikoo.js.org",
23
- "scripts": {
24
- "dev": "webpack serve --mode development",
25
- "serve": "webpack serve --mode development",
26
- "build": "cross-env NODE_ENV=production webpack --mode production",
27
- "analyze": "webpack --profile --json > stats.json && webpack-bundle-analyzer stats.json",
28
- "login": "tcb login",
29
- "logout": "tcb logout",
30
- "deploy": "tcb fn deploy twikoo --force",
31
- "lint": "eslint src/**",
32
- "docs:dev": "cd docs && yarn docs:dev",
33
- "docs:build": "cd docs && yarn docs:build"
10
+ "main": "./dist/twikoo.min.js",
11
+ "module": "./dist/twikoo.min.js",
12
+ "exports": {
13
+ ".": "./dist/twikoo.min.js"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "@twikoojs/shared": "2.0.0-beta.2"
34
20
  },
35
21
  "devDependencies": {
36
- "@babel/cli": "^8.0.0",
37
- "@babel/core": "^8.0.0",
38
- "@babel/plugin-transform-modules-commonjs": "^8.0.0",
39
- "@babel/plugin-transform-runtime": "^8.0.0",
40
- "@babel/preset-env": "^8.0.0",
41
- "@babel/runtime": "^8.0.0",
42
- "@cloudbase/cli": "^3.3.0",
43
- "@cloudbase/js-sdk": "^3.3.10",
44
- "@fortawesome/fontawesome-free": "^7.2.0",
45
- "babel-loader": "^10.1.1",
22
+ "@cloudbase/js-sdk": "^3.9.4",
23
+ "@fortawesome/fontawesome-free": "^7.3.1",
24
+ "@types/jsdom": "^30.0.0",
25
+ "@types/node": "^26.6.1",
26
+ "@vitejs/plugin-vue": "^6.0.9",
46
27
  "blueimp-md5": "^2.19.0",
47
- "copy-webpack-plugin": "^14.0.0",
48
- "cross-env": "^10.1.0",
49
- "css-loader": "^7.1.4",
50
- "dompurify": "^3.4.14",
51
- "element-ui": "^2.15.6",
52
- "eslint": "^9.8.0",
53
- "eslint-plugin-vue": "^9.33.0",
28
+ "dompurify": "^3.4.15",
29
+ "happy-dom": "^20.14.5",
54
30
  "js-sha256": "^1.0.0",
55
- "marked": "^18.0.4",
56
- "mini-css-extract-plugin": "^2.6.1",
57
- "neostandard": "^0.13.0",
58
- "owo": "^1.0.2",
59
- "prismjs": "^1.28.0",
60
- "svg-inline-loader": "^0.8.2",
61
- "terser-webpack-plugin": "^5.2.5",
62
- "vue": "^2.6.14",
63
- "vue-loader": "^15.9.8",
64
- "vue-style-loader": "^4.1.3",
65
- "vue-template-compiler": "^2.6.14",
66
- "webpack": "^5.91.0",
67
- "webpack-bundle-analyzer": "^5.3.0",
68
- "webpack-cli": "^7.0.2",
69
- "webpack-dev-server": "^6.0.0"
31
+ "jsdom": "^30.1.0",
32
+ "marked": "^18.0.13",
33
+ "prismjs": "^1.30.0",
34
+ "svgo": "^4.1.0",
35
+ "vite": "^8.3.0",
36
+ "vue": "^3.5.43"
70
37
  },
71
- "packageManager": "yarn@1.22.22"
72
- }
38
+ "scripts": {
39
+ "build": "node build.mjs",
40
+ "build:watch": "node build.mjs --watch",
41
+ "typecheck": "tsc --noEmit -p tsconfig.json",
42
+ "test": "vitest run"
43
+ }
44
+ }
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/twikoo.iml" filepath="$PROJECT_DIR$/.idea/twikoo.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/twikoo.iml DELETED
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
- <excludeFolder url="file://$MODULE_DIR$/temp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
package/CHANGELOG.md DELETED
@@ -1,3 +0,0 @@
1
- ## 更新日志 | Release notes
2
-
3
- [https://github.com/twikoojs/twikoo/releases](https://github.com/twikoojs/twikoo/releases)
package/CLAUDE.md DELETED
@@ -1,66 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## 常用命令
6
-
7
- ```bash
8
- yarn dev # 启动开发服务器 (localhost:9820),使用 demo/demo.html 预览
9
- yarn build # 生产构建,输出 dist/twikoo.all.min.js 和 dist/twikoo.all.nocss.js
10
- yarn lint # ESLint 检查 (plugin:vue/essential + standard)
11
- yarn analyze # 包体积分析
12
-
13
- # CloudBase 部署
14
- yarn login # tcb login
15
- yarn deploy # tcb fn deploy twikoo --force
16
- ```
17
-
18
- 开发后端时需先 `cd src/server/self-hosted && yarn install && yarn link twikoo-func`,再 `node server.js` 启动本地服务端。前端通过 `yarn dev` 启动,envId 填写 `http://localhost:8080`。
19
-
20
- ## 项目架构
21
-
22
- Twikoo 是一个静态网站评论系统,分为**客户端**和**服务端**两部分。
23
-
24
- ### 客户端 (`src/client/`)
25
-
26
- Vue 2 + Element UI 组件,Webpack 5 构建为 UMD 库。两个入口:
27
- - `main.js`:不含 CloudBase SDK(用户通过 `<script>` 标签自行引入)
28
- - `main.all.js`:内置 CloudBase SDK(发布为 `twikoo.all.min.js`)
29
-
30
- 客户端通过 `src/client/utils/api.js` 的 `call()` 函数与服务端通信:
31
- - 当 `envId` 为 URL 时,使用 HTTP POST 请求
32
- - 当 `envId` 为 CloudBase 环境 ID 时,使用 `_tcb.app.callFunction()` RPC 调用
33
-
34
- ### 服务端 (`src/server/`)
35
-
36
- 核心业务逻辑在 `src/server/function/twikoo/`(发布为 npm 包 `twikoo-func`),其他后端均为平台适配层:
37
-
38
- | 后端 | 包名 | 数据库 | 说明 |
39
- |---|---|---|---|
40
- | CloudBase | `twikoo-func` | 腾讯云开发数据库 | 主后端,入口 `exports.main` |
41
- | Self-hosted | `tkserver` | LokiJS(默认)/ MongoDB | Node.js HTTP 服务器,入口 `server.js` |
42
- | Vercel | `twikoo-vercel` | MongoDB | Serverless 函数,入口 `api/index.js` |
43
- | EdgeOne Makers | `twikoo-edgeone-makers` | EdgeOne Blob | Cloud Functions(Node.js + Go) |
44
- | Netlify / AWS Lambda / Deta | — | MongoDB | 均通过 `twikoo-vercel` 适配 |
45
-
46
- **重要**:修改后端共用逻辑时,需同时确保所有后端变体都能正常工作。各后端的 `handlePost` switch 语句应保持一致的事件处理分支(如 `GET_QQ_NICK`、`EMAIL_TEST` 等)。
47
-
48
- ### 事件驱动模型
49
-
50
- 前端发送事件名(如 `COMMENT_SUBMIT`、`GET_QQ_NICK`、`GET_CONFIG`),服务端 `handlePost` 中的 switch 语句分发到对应处理函数。新增功能时需在前端 `api.js` 和所有后端的 switch 中同步添加。
51
-
52
- ## 代码规范
53
-
54
- - ESLint 配置:`.eslintrc.js`,使用 `plugin:vue/essential` + `standard`
55
- - 编辑器配置:`.editorconfig`,2 空格缩进,LF 换行,UTF-8
56
- - 无 TypeScript,无 Prettier,无测试框架
57
- - 提交信息格式:`fix(scope): description` / `feat(scope): description`(参考 Conventional Commits)
58
-
59
- ## 国际化
60
-
61
- 翻译文件在 `src/client/utils/i18n/i18n.js`(约 88KB,包含所有语言)。新增 UI 文本需同步添加翻译。
62
-
63
- ## 注意事项
64
-
65
- - `twikoo-func` 是服务端各后端共用的核心包,修改其 `utils/` 会影响所有部署方式
66
- - CloudBase 部署配置在 `cloudbaserc.json`,函数运行时 Node.js 16.13
package/DEVELOPMENT.md DELETED
@@ -1,45 +0,0 @@
1
- # Local Development
2
-
3
- **Node.js** and **Yarn** are required.
4
-
5
- ## Backend
6
-
7
- ### Install dependencies
8
-
9
- ```
10
- cd src/server/function/twikoo
11
- yarn
12
- yarn link
13
- cd ../../self-hosted
14
- yarn
15
- yarn link twikoo-func
16
- ```
17
-
18
- ### Start
19
-
20
- ```
21
- cd src/server/self-hosted
22
- node server.js
23
- ```
24
-
25
- ## Frontend
26
-
27
- ### Install dependencies
28
-
29
- ```
30
- yarn
31
- ```
32
-
33
- ### Start
34
-
35
- ```
36
- yarn dev
37
- ```
38
-
39
- Open <http://localhost:9820> in browser.
40
-
41
- ## Code check and fix
42
-
43
- ```
44
- yarn lint --fix
45
- ```
package/Dockerfile DELETED
@@ -1,13 +0,0 @@
1
- ARG NODE_IMAGE=node
2
- FROM ${NODE_IMAGE}:lts AS build
3
- WORKDIR /app
4
- ENV NODE_ENV=production
5
- RUN set -eux; \
6
- npm install --production tkserver@latest; \
7
- mkdir -p data
8
- FROM ${NODE_IMAGE}:lts-alpine
9
- WORKDIR /app
10
- ENV NODE_ENV=production
11
- COPY --from=build /app .
12
- EXPOSE 8080
13
- CMD ["/app/node_modules/.bin/tkserver"]
package/README.en.md DELETED
@@ -1,147 +0,0 @@
1
- <a href="https://twikoo.js.org/"><img src="./docs/static/logo.png" width="300" alt="Twikoo"></a>
2
-
3
- ----
4
-
5
- [![](https://img.shields.io/npm/v/twikoo)](https://www.npmjs.com/package/twikoo)
6
- [![](https://img.shields.io/bundlephobia/minzip/twikoo)](https://bundlephobia.com/result?p=twikoo)
7
- [![](https://img.shields.io/npm/dt/twikoo)](https://www.npmjs.com/package/twikoo)
8
- [![](https://data.jsdelivr.com/v1/package/npm/twikoo/badge)](https://www.jsdelivr.com/package/npm/twikoo)
9
- [![](https://app.cloudback.it/badge/twikoojs/twikoo)](https://cloudback.it)
10
- [![](https://img.shields.io/npm/l/twikoo)](./LICENSE)
11
-
12
- A **simple**, **safe**, **free** comment system.
13
- [简体中文](./README.md) | **English**
14
-
15
- **This document is for American English.**
16
-
17
- ## Features
18
-
19
- <details>
20
- <summary>Click to view.</summary>
21
-
22
- ### Simple
23
-
24
- * Free Build.(Using Tencent CloudBase as the commenting backend, each user enjoys 1 free standard basic version 1 resource package for a long time)
25
- * Simple Deployment.(Support one-click deployment, manual deployment, command deployment)
26
-
27
- ### Easy to use
28
-
29
- * Support reply, like.
30
- * No additional adaptations, support with light theme and dark theme use.
31
- * Support API , batch get article comment count, latest comments.
32
- * Visitors entering QQ number in the nickname field will automatically complete the QQ nickname and QQ email.
33
- * Visitors fill in the digital QQ e-mail, will use the QQ avatar as the comment avatar.
34
- * Support the comment to paste pictures.(Can be disabled)
35
- * Support inserting pictures.(Can be disabled)
36
- * Support 7bu image bed, Tencent CloudBase image bed.
37
- * Support inserting emoji.(Can be disabled)
38
- * Support Ctrl + Enter reply.
39
- * Comments are saved in draft in real time and will not be lost when refreshed.
40
- * [Support Katex formulas.](https://twikoo.js.org/faq.html#%E5%A6%82%E4%BD%95%E5%90%AF%E7%94%A8-katex-%E6%94%AF%E6%8C%81)
41
- * Support for code highlighting by language.
42
-
43
- ### Security
44
-
45
- * Privacy and information security. (sensitive fields (email, IP, environment configuration, etc.) are not leaked through Tencent cloud function control)
46
- * Support for Akismet spam comment detection.(View Details [akismet.com](https://akismet.com/))
47
- * Support Tencent Cloud content security spam comment detection.(View Details [Tencent Cloud Content Security](https://console.cloud.tencent.com/cms/text/overview))
48
- * Support manual review mode.
49
- * Anti XSS Attack.
50
- * Support for limiting the maximum number of comments per IP per 10 minutes.
51
-
52
- ### notification
53
-
54
- * E-mail(Visitors and Blogger)
55
- * Wechat(only Blogger, [Server酱](https://sc.ftqq.com/3.version))
56
- * QQ(only Blogger, [Qmsg酱](https://qmsg.zendee.cn/))
57
-
58
- ### Personalization
59
-
60
- * Background image.
61
- * the "blogger" logo text.
62
- * Notification Email Template.
63
- * Comment prompt message.(placeholder)
64
- * emoji([OwO 的数据格式](https://cdn.jsdelivr.net/npm/owo@1.0.2/demo/OwO.json))
65
- * 【Nickname】 【Email】 【Website】 Required / Optional
66
- * Code highlighting theme.
67
-
68
- ### Management
69
-
70
- * Embedded panel with password login to easily view comments, hide comments, delete comments and modify configuration.
71
- * Support to hide the management portal and show it by entering a secret code.
72
- * Support for importing comments from Valine, Artalk, Disqus.
73
-
74
- ### Disadvantages
75
-
76
- * Slower requests. (except China)
77
- * Deployment requires real name authentication.
78
- * IE is not supported.
79
-
80
- </details>
81
-
82
- ## Preview
83
-
84
- <details>
85
- <summary>Click to view.</summary>
86
-
87
- ### Comments
88
-
89
- ![Comments](./docs/static/readme-1.png)
90
-
91
- ### Management
92
-
93
- ![Management](./docs/static/readme-2.png)
94
-
95
- ### Notification
96
-
97
- ![Notification](./docs/static/readme-3.jpg)
98
-
99
- </details>
100
-
101
- ## Quick Start
102
-
103
- [![Deploy](https://main.qcloudimg.com/raw/67f5a389f1ac6f3b4d04c7256438e44f.svg)](https://console.cloud.tencent.com/tcb/env/index?action=CreateAndDeployCloudBaseProject&appUrl=https%3A%2F%2Fgithub.com%2Fimaegoo%2Ftwikoo&branch=main)
104
-
105
- [View Details](https://twikoo.js.org/quick-start.html)
106
-
107
- <details>
108
- <summary>If you want to get updates, make suggestions and participate in the test, welcome to join the discussion group:1080829142 (QQ)</summary>
109
- <img height="300" alt="1080829142" src="https://www.imaegoo.com/gallery/2020/hello-twikoo.png" />
110
- </details>
111
-
112
- <!-- ## Contributors -->
113
-
114
- ## Special Thanks
115
-
116
- Icon design:[Maemo Lee](https://www.maemo.cc)
117
-
118
- <!-- ## Donate -->
119
-
120
- ## Release notes & plans
121
-
122
- [Update logs](https://github.com/twikoojs/twikoo/releases) & [Development Plan](https://github.com/twikoojs/twikoo/projects/2)
123
-
124
- ## Development
125
-
126
- If you want to develop locally for a second time, you can refer to the following commands:
127
-
128
- ``` sh
129
- yarn dev # (http://localhost:9820/demo.html)
130
- yarn lint
131
- yarn build # (dist/twikoo.all.min.js)
132
- ```
133
-
134
- If your changes can help more people, feel free to submit a Pull Request!
135
-
136
- ## I18N
137
-
138
- Support Simplified Chinese, Traditional Chinese, English. [translate Pull Request](https://github.com/twikoojs/twikoo/tree/main/src/client/utils/i18n).
139
-
140
- ## License
141
-
142
- <details>
143
- <summary>MIT License</summary>
144
-
145
- [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fimaegoo%2Ftwikoo.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fimaegoo%2Ftwikoo?ref=badge_large)
146
-
147
- </details>
@@ -1,50 +0,0 @@
1
- /*!
2
- * OwO v1.0.2
3
- * Source: https://github.com/DIYgod/OwO/blob/master/src/OwO.js
4
- * Author: DIYgod
5
- * Modified by: iMaeGoo
6
- * Released under the MIT License.
7
- */
8
-
9
- /*!
10
- * Twikoo v1.7.24
11
- * (c) 2020-2026 iMaeGoo
12
- * Released under the MIT License.
13
- * Last Update: 9/15/2026, 7:49:25 AM
14
- */
15
-
16
- /*!
17
- * Vue.js v2.7.16
18
- * (c) 2014-2023 Evan You
19
- * Released under the MIT License.
20
- */
21
-
22
- /*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE */
23
-
24
- /*! For license information please see index.js.LICENSE.txt */
25
-
26
- /**
27
- * @license
28
- * web-streams-polyfill v4.2.0
29
- * Copyright 2025 Mattias Buelens, Diwank Singh Tomer and other contributors.
30
- * This code is released under the MIT license.
31
- * SPDX-License-Identifier: MIT
32
- */
33
-
34
- /**
35
- * Prism: Lightweight, robust, elegant syntax highlighting
36
- *
37
- * @license MIT <https://opensource.org/licenses/MIT>
38
- * @author Lea Verou <https://lea.verou.me>
39
- * @namespace
40
- * @public
41
- */
42
-
43
- /**
44
- * [js-sha256]{@link https://github.com/emn178/js-sha256}
45
- *
46
- * @version 1.0.0
47
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
48
- * @copyright Chen, Yi-Cyuan 2014-2026
49
- * @license MIT
50
- */
@@ -1,40 +0,0 @@
1
- /*!
2
- * OwO v1.0.2
3
- * Source: https://github.com/DIYgod/OwO/blob/master/src/OwO.js
4
- * Author: DIYgod
5
- * Modified by: iMaeGoo
6
- * Released under the MIT License.
7
- */
8
-
9
- /*!
10
- * Twikoo v1.7.24
11
- * (c) 2020-2026 iMaeGoo
12
- * Released under the MIT License.
13
- * Last Update: 9/15/2026, 7:49:25 AM
14
- */
15
-
16
- /*!
17
- * Vue.js v2.7.16
18
- * (c) 2014-2023 Evan You
19
- * Released under the MIT License.
20
- */
21
-
22
- /*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE */
23
-
24
- /**
25
- * Prism: Lightweight, robust, elegant syntax highlighting
26
- *
27
- * @license MIT <https://opensource.org/licenses/MIT>
28
- * @author Lea Verou <https://lea.verou.me>
29
- * @namespace
30
- * @public
31
- */
32
-
33
- /**
34
- * [js-sha256]{@link https://github.com/emn178/js-sha256}
35
- *
36
- * @version 1.0.0
37
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
38
- * @copyright Chen, Yi-Cyuan 2014-2026
39
- * @license MIT
40
- */
@@ -1,50 +0,0 @@
1
- /*!
2
- * OwO v1.0.2
3
- * Source: https://github.com/DIYgod/OwO/blob/master/src/OwO.js
4
- * Author: DIYgod
5
- * Modified by: iMaeGoo
6
- * Released under the MIT License.
7
- */
8
-
9
- /*!
10
- * Twikoo v1.7.24
11
- * (c) 2020-2026 iMaeGoo
12
- * Released under the MIT License.
13
- * Last Update: 9/15/2026, 7:49:25 AM
14
- */
15
-
16
- /*!
17
- * Vue.js v2.7.16
18
- * (c) 2014-2023 Evan You
19
- * Released under the MIT License.
20
- */
21
-
22
- /*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE */
23
-
24
- /*! For license information please see index.js.LICENSE.txt */
25
-
26
- /**
27
- * @license
28
- * web-streams-polyfill v4.2.0
29
- * Copyright 2025 Mattias Buelens, Diwank Singh Tomer and other contributors.
30
- * This code is released under the MIT license.
31
- * SPDX-License-Identifier: MIT
32
- */
33
-
34
- /**
35
- * Prism: Lightweight, robust, elegant syntax highlighting
36
- *
37
- * @license MIT <https://opensource.org/licenses/MIT>
38
- * @author Lea Verou <https://lea.verou.me>
39
- * @namespace
40
- * @public
41
- */
42
-
43
- /**
44
- * [js-sha256]{@link https://github.com/emn178/js-sha256}
45
- *
46
- * @version 1.0.0
47
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
48
- * @copyright Chen, Yi-Cyuan 2014-2026
49
- * @license MIT
50
- */
@@ -1,12 +0,0 @@
1
- # https://docs.docker.com/compose/compose-file/compose-file-v3/
2
- version: '3'
3
- services:
4
- twikoo-service:
5
- image: imaegoo/twikoo
6
- environment:
7
- TWIKOO_THROTTLE: 250
8
- TZ: Asia/Shanghai
9
- volumes:
10
- - /app/data
11
- ports:
12
- - 8080:8080