Compare commits

...
7 Commits
Author SHA1 Message Date
qwqcode 8cbbd1153c v2.2.7
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-04-24 00:26:54 +08:00
qwqcode f41aecd0eb feat(sidebar): Add cache handle btn
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-04-23 23:57:10 +08:00
qwqcode a05c31b4de chore(docs): Update README.md
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-04-23 16:34:04 +08:00
qwqcode f3a0d7c069 Merge pull request #116 from ArtalkJS/chore/deps
chore: update deps
2022-04-22 00:42:09 +08:00
Percy Ma 7bfe22fe10 chore: update deps 2022-04-21 23:48:52 +08:00
qwqcode 59ebfd3d6c chore(plugin-katex): simplify the code
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-04-21 19:17:29 +08:00
qwqcode 0787595f98 fix(conf): conf.noComment not working
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-04-21 12:13:16 +08:00
20 changed files with 541 additions and 506 deletions

No files matched your search

+7 -1
View File
@@ -125,8 +125,14 @@ docker-compose up -d
## TODOs
- [x] [Golang 后端](https://github.com/ArtalkJS/ArtalkGo)
- [x] 多站点支持
- [x] 多数据库支持
- [x] SQLite
- [X] MySQL
- [x] 多缓存支持
- [x] In-memory (内建缓存)
- [x] Redis
- [x] Memcache
- [x] 多站点支持
- [x] 评论获取分页
- [x] 评论点赞投票
- [x] 浏览量统计
+16 -16
View File
@@ -10,23 +10,23 @@
"build:all": "pnpm build && pnpm build:sidebar"
},
"devDependencies": {
"@rollup/plugin-dynamic-import-vars": "^1.4.1",
"@types/node": "^16.11.7",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"autoprefixer": "^10.4.0",
"eslint": "^8.2.0",
"@rollup/plugin-dynamic-import-vars": "^1.4.3",
"@types/node": "^16.11.27",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"autoprefixer": "^10.4.4",
"eslint": "^8.13.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "^16.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.2",
"eslint-config-airbnb-typescript": "^16.2.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-import": "^2.26.0",
"less": "^4.1.2",
"postcss": "^8.1.0",
"prettier": "^2.4.1",
"rollup": "^2.59.0",
"typescript": "^4.5.2",
"vite": "^2.6.14",
"vite-tsconfig-paths": "^3.3.17"
"postcss": "^8.4.12",
"prettier": "^2.6.2",
"rollup": "^2.70.2",
"typescript": "^4.6.3",
"vite": "^2.9.5",
"vite-tsconfig-paths": "^3.4.1"
}
}
+12 -6
View File
@@ -26,14 +26,20 @@ export default class PageList extends Component {
initPageList() {
this.pages = []
this.$el.innerHTML = `<div class="atk-header-action-bar">
<span class="atk-update-all-title-btn"><i class="atk-icon atk-icon-sync"></i> <span class="atk-text">更新标题</span></span>
<span class="atk-cache-flush-all-btn"><span class="atk-text">缓存清除</span></span>
<span class="atk-cache-warm-up-btn"><span class="atk-text">缓存预热</span></span>
</div>`
// 缓存操作按钮
const $cacheFlushBtn = this.$el.querySelector<HTMLElement>('.atk-cache-flush-all-btn')!
$cacheFlushBtn.onclick = () => { new Api(this.ctx).cacheFlushAll().then((d: any) => alert(d.msg)).catch(() => alert('操作失败')) }
const $cacheWarmBtn = this.$el.querySelector<HTMLElement>('.atk-cache-warm-up-btn')!
$cacheWarmBtn.onclick = () => { new Api(this.ctx).cacheWarmUp().then((d: any) => alert(d.msg)).catch(() => alert('操作失败')) }
// 更新全部页面标题按钮
;(async () => {
this.$el.innerHTML = `<div class="atk-header-action-bar">
<span class="atk-update-all-title-btn">
<i class="atk-icon atk-icon-sync"></i> <span class="atk-text">更新标题</span>
</span>
</div>`
const $updateAllTitleBtn = this.$el.querySelector<HTMLElement>('.atk-update-all-title-btn')!
const $updateAllTitleIcon = $updateAllTitleBtn.querySelector<HTMLElement>('i')!
const $updateAllTitleText = $updateAllTitleBtn.querySelector<HTMLElement>('.atk-text')!
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "artalk",
"version": "2.2.6",
"version": "2.2.7",
"backendMinVersion": "2.1.2",
"license": "LGPL-3.0",
"description": "A Selfhosted Comment System",
+17 -1
View File
@@ -1,5 +1,5 @@
import Context from '../context'
import { CommentData, ListData, UserData, PageData, SiteData, NotifyData } from '~/types/artalk-data'
import Context from '../context'
import { Fetch, ToFormData, POST, GET } from './request'
import * as Utils from '../lib/utils'
@@ -318,4 +318,20 @@ export default class Api {
const data = await POST<any>(this.ctx, `${this.baseURL}/captcha/status`)
return (data || { is_pass: false }) as { is_pass: boolean }
}
// ============================
// 管理员缓存操作
// ============================
/** 缓存清除 */
public cacheFlushAll() {
const params: any = { flush_all: true }
return POST(this.ctx, `${this.baseURL}/admin/cache-flush`, params)
}
/** 缓存预热 */
public cacheWarmUp() {
const params: any = {}
return POST(this.ctx, `${this.baseURL}/admin/cache-warm`, params)
}
}
+2 -2
View File
@@ -1,7 +1,8 @@
import './style/main.less'
import Context from './context'
import ArtalkConfig from '~/types/artalk-config'
import { EventPayloadMap, Handler } from '~/types/event'
import Context from './context'
import defaults from './defaults'
import CheckerLauncher from './lib/checker'
@@ -10,7 +11,6 @@ import List from './components/list'
import SidebarLayer from './components/sidebar-layer'
import Layer, { GetLayerWrap } from './components/layer'
import { EventPayloadMap, Handler } from '~/types/event'
import Api from './api'
import * as Utils from './lib/utils'
+1 -1
View File
@@ -1,11 +1,11 @@
import '../style/comment.less'
import { CommentData } from '~/types/artalk-data'
import Context from '../context'
import Component from '../lib/component'
import * as Utils from '../lib/utils'
import * as Ui from '../lib/ui'
import UADetect from '../lib/detect'
import { CommentData } from '~/types/artalk-data'
import CommentHTML from './html/comment.html?raw'
import Api from '../api'
import ActionBtn from './action-btn'
@@ -1,10 +1,10 @@
import './emoticons-plug.less'
import Editor from '../editor'
import EditorPlug from './editor-plug'
import * as Utils from '~/src/lib/utils'
import * as Ui from '~/src/lib/ui'
import { EmoticonListData, EmoticonGrpData } from '~/types/artalk-data'
import EditorPlug from './editor-plug'
import Editor from '../editor'
type OwOFormatType = {
[key: string] : {
@@ -1,8 +1,8 @@
import './preview-plug.less'
import * as Utils from '~/src/lib/utils'
import Editor from '../editor'
import EditorPlug from './editor-plug'
import * as Utils from '~/src/lib/utils'
export default class PreviewPlug extends EditorPlug {
$el!: HTMLElement
+1 -1
View File
@@ -1,5 +1,6 @@
import '../style/editor.less'
import { CommentData } from '~/types/artalk-data'
import Context from '../context'
import Component from '../lib/component'
import * as Utils from '../lib/utils'
@@ -8,7 +9,6 @@ import EditorHTML from './html/editor.html?raw'
import EmoticonsPlug from './editor-plugs/emoticons-plug'
import PreviewPlug from './editor-plugs/preview-plug'
import { CommentData } from '~/types/artalk-data'
import Api from '../api'
export default class Editor extends Component {
+4 -1
View File
@@ -1,10 +1,10 @@
import { ListData, CommentData, NotifyData, ApiVersionData } from '~/types/artalk-data'
import Context from '../context'
import Component from '../lib/component'
import * as Utils from '../lib/utils'
import * as Ui from '../lib/ui'
import Api from '../api'
import Comment from './comment'
import { ListData, CommentData, NotifyData, ApiVersionData } from '~/types/artalk-data'
import Pagination from './pagination'
import ReadMoreBtn from './read-more-btn'
import { backendMinVersion } from '../../package.json'
@@ -49,6 +49,9 @@ export default class ListLite extends Component {
</div>`)
this.$commentsWrap = this.$el.querySelector('.atk-list-comments-wrap')!
// 评论为空时显示字符
if (ctx.conf.noComment) this.noCommentText = ctx.conf.noComment
// 评论时间自动更新
window.setInterval(() => {
this.$el.querySelectorAll<HTMLElement>('[data-atk-comment-date]').forEach(el => {
+1 -1
View File
@@ -1,12 +1,12 @@
import '../style/list.less'
import { ListData } from '~/types/artalk-data'
import Context from '../context'
import * as Utils from '../lib/utils'
import * as Ui from '../lib/ui'
import Api from '../api'
import ListHTML from './html/list.html?raw'
import ListLite from './list-lite'
import { ListData } from '~/types/artalk-data'
export default class List extends ListLite {
private $closeCommentBtn!: HTMLElement
@@ -3,11 +3,11 @@ import '../style/sidebar-layer.less'
import Context from '@/context'
import Component from '@/lib/component'
import * as Utils from '@/lib/utils'
import SidebarHTML from './html/sidebar-layer.html?raw'
import * as Ui from '@/lib/ui'
import { SidebarShowPayload } from '~/types/event'
import SidebarHTML from './html/sidebar-layer.html?raw'
import Layer from './layer'
import Api from '../api'
import { SidebarShowPayload } from '~/types/event'
export default class SidebarLayer extends Component {
public layer?: Layer
+1 -1
View File
@@ -1,7 +1,7 @@
import { marked as libMarked } from 'marked'
import User from './lib/user'
import ArtalkConfig from '~/types/artalk-config'
import { EventPayloadMap, Event, EventScopeType, Handler } from '~/types/event'
import User from './lib/user'
/**
* Artalk Context
+1 -1
View File
@@ -1,9 +1,9 @@
import Context from '@/context'
import Layer from '@/components/layer'
import Dialog from '@/components/dialog'
import { CheckerPayload } from '~/types/event'
import * as Utils from '../utils'
import * as Ui from '../ui'
import { CheckerPayload } from '~/types/event'
import CaptchaChecker from './captcha-checker'
import AdminChecker from './admin-checker'
+1 -39
View File
@@ -1,41 +1,3 @@
# @artalkjs/plugin-katex
食用方法
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- 引入 katex -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.min.js"></script>
<!-- 引入 Artalk -->
<link href="https://cdn.jsdelivr.net/npm/artalk/dist/Artalk.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/artalk/dist/Artalk.js"></script>
<!-- 引入 @artalkjs/plugin-katex -->
<script defer src="https://cdn.jsdelivr.net/npm/@artalkjs/plugin-katex/dist/artalk-plugin-katex.js"></script>
</head>
<body>
<!-- Artalk -->
<div id="Comments"></div>
<script>
new Artalk({
el: '#Comments',
pageKey: '<页面链接>',
pageTitle: '<页面标题>',
server: '<后端地址>',
site: '<站点名称>',
})
</script>
</body>
</html>
```
食用方法参考:[官方文档](https://artalk.js.org/guide/frontend/latex.html)
-1
View File
@@ -1 +0,0 @@
import './main'
-1
View File
@@ -14,7 +14,6 @@
"unpkg": "./dist/artalk-plugin-katex.iife.js",
"jsdelivr": "./dist/artalk-plugin-katex.iife.js",
"module": "./dist/artalk-plugin-katex.es.js",
"types": "./index.d.ts",
"scripts": {
"dev": "vite",
"build": "vite build",
-3
View File
@@ -18,9 +18,6 @@ export default defineConfig({
// 确保外部化处理那些你不想打包进库的依赖
external: ['artalk', 'katex'],
output: {
assetFileNames: assetInfo => {
return "[name].[ext]"
},
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
artalk: 'Artalk',
+471 -424
View File
File diff suppressed because it is too large. Load diff