Skip to content

Commit

Permalink
fix: several bugs fixed (#385)
Browse files Browse the repository at this point in the history
* 修复 无法上传扩展名为大写字母的图片问题
* 修复 部分主题下管理面板注册按钮不明显问题
* 修复 修改默认 Prism CDN 为 `https://cdn.staticfile.org/prism/1.28.0` #383
* 修复 修改默认表情 CDN 为 `https://owo.imaegoo.com/owo.json` #383
* 文档 升级到 VuePress 2
* 文档 更新默认 CDN 地址为 `https://cdn.staticfile.org/twikoo/1.5.10/twikoo.all.min.js`
* 文档 增加英文文档(暂时仅翻译了简介部分)感谢 @wmz1024 #379
  • Loading branch information
imaegoo authored May 20, 2022
1 parent 7353fdf commit b4a4e26
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 26 deletions.
2 changes: 1 addition & 1 deletion demo/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<title>Twikoo Demo</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/bulma@0.8.2/css/bulma.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.staticfile.org/bulma/0.8.2/css/bulma.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="demo.css">
</head>
Expand Down
6 changes: 5 additions & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { searchPlugin } = require('@vuepress/plugin-search')
const twikooTheme = require('./theme')

module.exports = {
Expand Down Expand Up @@ -44,5 +45,8 @@ module.exports = {
docsDir: 'docs',
// 假如文档放在一个特定的分支下:
docsBranch: 'main'
})
}),
plugins: [
searchPlugin({})
]
}
2 changes: 1 addition & 1 deletion docs/.vuepress/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ module.exports = (options) => {
extends: defaultTheme(options),
layouts: {
Layout: path.resolve(__dirname, 'layouts/Layout.vue'),
},
}
}
}
2 changes: 1 addition & 1 deletion docs/.vuepress/theme/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
lightGallery(commentItem, {
selector: '.tk-lg-link',
share: false
});
})
}
}
},
Expand Down
17 changes: 13 additions & 4 deletions docs/en/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.main = require('twikoo-func').main
8. 创建完成后,点击“twikoo"进入云函数详情页,进入“函数代码”标签,点击“文件 - 新建文件”,输入 `package.json`,回车
9. 复制以下代码、粘贴到代码框中,点击“保存并安装依赖”
``` json
{ "dependencies": { "twikoo-func": "1.5.10" } }
{ "dependencies": { "twikoo-func": "1.5.11" } }
```

### 命令行部署
Expand Down Expand Up @@ -193,9 +193,14 @@ twikoo.init({

> 建议使用 CDN 引入 Twikoo 的用户在链接地址上锁定版本,以免将来 Twikoo 升级时受到非兼容性更新的影响。
#### [Staticfile](https://www.staticfile.org/) CDN 镜像
#### 更换 CDN 镜像

如果遇到 cdn.jsdelivr.net 加载速度缓慢,可更换七牛云 CDN 镜像。引入的 CDN 链接替换为如下即可:`https://cdn.staticfile.org/twikoo/1.5.10/twikoo.all.min.js`
如果遇到默认 CDN 加载速度缓慢,可更换其他 CDN 镜像。以下为可供选择的公共 CDN,其中一些 CDN 可能需要数天时间同步最新版本:

* `https://cdn.staticfile.org/twikoo/1.5.10/twikoo.all.min.js`
* `https://lib.baomitu.com/twikoo/1.5.10/twikoo.all.min.js`
* `https://cdn.bootcdn.net/ajax/libs/twikoo/1.5.10/twikoo.all.min.js`
* `https://cdn.jsdelivr.net/npm/twikoo@1.5.10/dist/twikoo.all.min.js`

## 开启管理面板(腾讯云环境)

Expand All @@ -205,9 +210,13 @@ twikoo.init({

配置好登录私钥之后无需留存私钥文件,请勿再次下载登录私钥,否则会导致之前配置的登录私钥失效。

## 开启管理面板(Vercel 环境)

点击评论窗口的“小齿轮”图标,设置管理员密码

## 版本更新

不同部署方式的更新方式也不同,请对号入座。更新部署成功后,请不要忘记同时更新前端的 Twikoo CDN 地址 `https://cdn.jsdelivr.net/npm/twikoo@x.x.x/dist/twikoo.all.min.js` 中的 `x.x.x`,使之与云函数版本号相同,然后部署网站。
不同部署方式的更新方式也不同,请对号入座。更新部署成功后,请不要忘记同时更新前端的 Twikoo CDN 地址中的 `x.x.x` 数字版本号,使之与云函数版本号相同,然后部署网站。

### 针对一键部署的更新方式

Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"docs:build": "vuepress build ."
},
"devDependencies": {
"@vuepress/plugin-search": "^2.0.0-beta.45",
"vuepress": "^2.0.0-beta.45"
}
}
19 changes: 14 additions & 5 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports.main = require('twikoo-func').main
8. 创建完成后,点击“twikoo"进入云函数详情页,进入“函数代码”标签,点击“文件 - 新建文件”,输入 `package.json`,回车
9. 复制以下代码、粘贴到代码框中,点击“保存并安装依赖”
``` json
{ "dependencies": { "twikoo-func": "1.5.10" } }
{ "dependencies": { "twikoo-func": "1.5.11" } }
```

### 命令行部署
Expand Down Expand Up @@ -175,7 +175,7 @@ twikoo:

``` html
<div id="tcomment"></div>
<script src="https://cdn.jsdelivr.net/npm/twikoo@1.5.10/dist/twikoo.all.min.js"></script>
<script src="https://cdn.staticfile.org/twikoo/1.5.10/twikoo.all.min.js"></script>
<script>
twikoo.init({
envId: '您的环境id', // 腾讯云环境填 envId;Vercel 环境填地址(https://xxx.vercel.app)
Expand All @@ -189,9 +189,14 @@ twikoo.init({

> 建议使用 CDN 引入 Twikoo 的用户在链接地址上锁定版本,以免将来 Twikoo 升级时受到非兼容性更新的影响。
#### [Staticfile](https://www.staticfile.org/) CDN 镜像
#### 更换 CDN 镜像

如果遇到 cdn.jsdelivr.net 加载速度缓慢,可更换七牛云 CDN 镜像。引入的 CDN 链接替换为如下即可:`https://cdn.staticfile.org/twikoo/1.5.10/twikoo.all.min.js`
如果遇到默认 CDN 加载速度缓慢,可更换其他 CDN 镜像。以下为可供选择的公共 CDN,其中一些 CDN 可能需要数天时间同步最新版本:

* `https://cdn.staticfile.org/twikoo/1.5.10/twikoo.all.min.js`
* `https://lib.baomitu.com/twikoo/1.5.10/twikoo.all.min.js`
* `https://cdn.bootcdn.net/ajax/libs/twikoo/1.5.10/twikoo.all.min.js`
* `https://cdn.jsdelivr.net/npm/twikoo@1.5.10/dist/twikoo.all.min.js`

## 开启管理面板(腾讯云环境)

Expand All @@ -201,9 +206,13 @@ twikoo.init({

配置好登录私钥之后无需留存私钥文件,请勿再次下载登录私钥,否则会导致之前配置的登录私钥失效。

## 开启管理面板(Vercel 环境)

点击评论窗口的“小齿轮”图标,设置管理员密码

## 版本更新

不同部署方式的更新方式也不同,请对号入座。更新部署成功后,请不要忘记同时更新前端的 Twikoo CDN 地址 `https://cdn.jsdelivr.net/npm/twikoo@x.x.x/dist/twikoo.all.min.js` 中的 `x.x.x`,使之与云函数版本号相同,然后部署网站。
不同部署方式的更新方式也不同,请对号入座。更新部署成功后,请不要忘记同时更新前端的 Twikoo CDN 地址中的 `x.x.x` 数字版本号,使之与云函数版本号相同,然后部署网站。

### 针对一键部署的更新方式

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twikoo",
"version": "1.5.10",
"version": "1.5.11",
"description": "A simple comment system based on Tencent CloudBase (tcb).",
"keywords": [
"twikoojs",
Expand Down
2 changes: 1 addition & 1 deletion src/function/twikoo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twikoo-func",
"version": "1.5.10",
"version": "1.5.11",
"description": "A simple comment system based on Tencent CloudBase (tcb).",
"author": "imaegoo <hello@imaegoo.com> (https://github.com/imaegoo)",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/js/utils/highlight.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { app } from '../../view'

const PRISM_CDN = 'https://cdn.jsdelivr.net/npm/prismjs@1.28.0'
const PRISM_CDN = 'https://cdn.staticfile.org/prism/1.28.0'
let Prism
let cssEl

Expand Down
8 changes: 4 additions & 4 deletions src/js/utils/i18n/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ export default {
`Avatar placeholder. Default: "identicon". Choose from: ${defaultGravatar.join(', ')}`
],
[S.ACI + '_EMOTION_CDN']: [
'表情 CDN,默认为:https://cdn.jsdelivr.net/gh/imaegoo/emotion/owo.json',
'表情 CDN,預設為:https://cdn.jsdelivr.net/gh/imaegoo/emotion/owo.json',
'表情 CDN,預設為:https://cdn.jsdelivr.net/gh/imaegoo/emotion/owo.json',
'Emotion CDN. Default: https://cdn.jsdelivr.net/gh/imaegoo/emotion/owo.json'
'表情 CDN,默认为:https://owo.imaegoo.com/owo.json',
'表情 CDN,預設為:https://owo.imaegoo.com/owo.json',
'表情 CDN,預設為:https://owo.imaegoo.com/owo.json',
'Emotion CDN. Default: https://owo.imaegoo.com/owo.json'
],
[S.ACI + '_FORBIDDEN_WORDS']: [
'违禁词配置,包含违禁词的内容会直接标记为垃圾评论。英文逗号分隔。',
Expand Down
2 changes: 1 addition & 1 deletion src/vercel-min/package.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "dependencies": { "twikoo-vercel": "1.5.10" } }
{ "dependencies": { "twikoo-vercel": "1.5.11" } }
2 changes: 1 addition & 1 deletion src/vercel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twikoo-vercel",
"version": "1.5.10",
"version": "1.5.11",
"description": "A simple comment system based on Tencent CloudBase (tcb).",
"author": "imaegoo <hello@imaegoo.com> (https://github.com/imaegoo)",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const version = '1.5.10'
const version = '1.5.11'

export { version }
1 change: 1 addition & 0 deletions src/view/components/TkAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export default {
height: 100%;
overflow-y: auto;
pointer-events: all;
color: #ffffff;
background-color: rgba(0,0,0,0.60);
backdrop-filter: blur(5px);
transition: all 0.5s ease;
Expand Down
7 changes: 4 additions & 3 deletions src/view/components/TkSubmit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
<div class="tk-row actions">
<div class="tk-row-actions-start">
<div class="tk-action-icon OwO" v-show="config.SHOW_EMOTION === 'true'" v-clickoutside="closeOwo" ref="owo"></div>
<div class="tk-action-icon OwO" v-show="config.SHOW_EMOTION === 'true'" v-html="iconEmotion" v-clickoutside="closeOwo" ref="owo"></div>
<div class="tk-action-icon" v-show="config.SHOW_IMAGE === 'true'" v-html="iconImage" @click="openSelectImage"></div>
<input class="tk-input-image" type="file" accept="image/*" value="" ref="inputFile" @change="onSelectImage" />
<div class="tk-error-message">{{ errorMessage }}</div>
Expand Down Expand Up @@ -95,6 +95,7 @@ export default {
mail: '',
link: '',
iconMarkdown,
iconEmotion,
iconImage
}
},
Expand Down Expand Up @@ -131,7 +132,7 @@ export default {
},
async initOwo () {
if (this.config.SHOW_EMOTION === 'true') {
const odata = await initOwoEmotion(this.config.EMOTION_CDN || 'https://cdn.jsdelivr.net/gh/imaegoo/emotion/owo.json')
const odata = await initOwoEmotion(this.config.EMOTION_CDN || 'https://owo.imaegoo.com/owo.json')
this.owo = new OwO({
logo: iconEmotion, // OwO button text, default: `OωO表情`
container: this.$refs.owo, // OwO container, default: `document.getElementsByClassName('OwO')[0]`
Expand Down Expand Up @@ -246,7 +247,7 @@ export default {
if (!photo || this.config.SHOW_IMAGE !== 'true') return
const nameSplit = photo.name.split('.')
const fileType = nameSplit.length > 1 ? nameSplit.pop() : ''
if (imageTypes.indexOf(fileType) === -1) return
if (imageTypes.indexOf(fileType.toLowerCase()) === -1) return
const userId = this.getUserId()
const fileIndex = `${Date.now()}-${userId}`
const fileName = nameSplit.join('.')
Expand Down

0 comments on commit b4a4e26

Please sign in to comment.