Skip to content

Commit 87f5961

Browse files
authored
feat: support self hosted (#414)
1 parent 37b98e1 commit 87f5961

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+3778
-3677
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
*.json
33
*.md
44
LICENSE
5-
src/lib/marked/*
5+
src/client/lib/marked/*
66
yarn.lock

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Build
55

66
on:
77
push:
8-
branches: [ main ]
8+
branches: [ main, dev ]
99
pull_request:
10-
branches: [ main ]
10+
branches: [ main, dev ]
1111

1212
jobs:
1313
build:

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Docs
55

66
on:
77
release:
8-
types: [created]
8+
types: [released]
99
workflow_dispatch:
1010

1111
jobs:

.github/workflows/publish.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Publish
55

66
on:
77
release:
8-
types: [created]
8+
types: [published]
99
workflow_dispatch:
1010

1111
jobs:
@@ -19,12 +19,27 @@ jobs:
1919
registry-url: https://registry.npmjs.org/
2020
- run: yarn install
2121
- run: yarn build
22-
- run: yarn publish
22+
- if: "github.event.release.prerelease"
23+
run: yarn publish --tag beta
2324
env:
2425
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
25-
- run: cd src/function/twikoo && yarn publish
26+
- if: "github.event.release.prerelease"
27+
run: cd src/server/function/twikoo && yarn publish --tag beta
2628
env:
2729
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
28-
- run: cd src/vercel && yarn publish
30+
- if: "github.event.release.prerelease"
31+
run: cd src/server/vercel && yarn publish --tag beta
32+
env:
33+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
34+
- if: "!github.event.release.prerelease"
35+
run: yarn publish
36+
env:
37+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
38+
- if: "!github.event.release.prerelease"
39+
run: cd src/server/function/twikoo && yarn publish
40+
env:
41+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
42+
- if: "!github.event.release.prerelease"
43+
run: cd src/server/vercel && yarn publish
2944
env:
3045
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,7 @@ dist
111111

112112
# VuePress temp file
113113
.temp
114+
115+
# database
116+
db.json
117+
db.json.*

CHANGELOG.md

Lines changed: 3 additions & 0 deletions

README.en.md

Lines changed: 2 additions & 2 deletions

README.md

Lines changed: 5 additions & 13 deletions

cloudbaserc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": "2.0",
33
"envId": "{{envId}}",
4-
"functionRoot": "./src/function",
4+
"functionRoot": "./src/server/function",
55
"functions": [
66
{
77
"name": "twikoo",
@@ -17,7 +17,7 @@
1717
"function": {
1818
"use": "@cloudbase/framework-plugin-function",
1919
"inputs": {
20-
"functionRootPath": "./src/function",
20+
"functionRootPath": "./src/server/function",
2121
"functions": [
2222
{
2323
"name": "twikoo",

demo/demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<div class="field">
5757
<label class="label">环境 ID | Environment ID: <code>envId</code></label>
5858
<div class="control">
59-
<input class="input" id="envId" type="text" placeholder="e.g imaegoo-16fe3d" value="https://twikoo.vercel.app">
59+
<input class="input" id="envId" type="text" placeholder="e.g imaegoo-16fe3d" value="http://localhost:8080">
6060
</div>
6161
</div>
6262
<div class="field">

docs/.vuepress/theme/layouts/Layout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<!-- Twikoo -->
1515
<div id="twikoo"></div>
16-
<component :is="'script'" src="https://cdn.staticfile.org/twikoo/1.5.11/twikoo.all.min.js" ref="twikooJs"></component>
16+
<component :is="'script'" src="https://cdn.staticfile.org/twikoo/1.6.0-beta.1/twikoo.all.min.js" ref="twikooJs"></component>
1717
</div>
1818
</template>
1919
</ParentLayout>

docs/README.md

Lines changed: 5 additions & 7 deletions

docs/en/README.md

Lines changed: 4 additions & 8 deletions

docs/en/quick-start.md

Lines changed: 2 additions & 2 deletions

docs/quick-start.md

Lines changed: 2 additions & 2 deletions

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "twikoo",
3-
"version": "1.5.11",
4-
"description": "A simple comment system based on Tencent CloudBase (tcb).",
3+
"version": "1.6.0-beta.1",
4+
"description": "A simple comment system.",
55
"keywords": [
66
"twikoojs",
77
"comment",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/js/main.all.js renamed to src/client/main.all.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { version } from '../version'
2-
import { install } from './tcb'
3-
import { render } from '../view'
1+
import { version } from './version'
2+
import { install } from './utils/tcb'
3+
import { render } from './view'
44
import { setLanguage, isUrl, getCommentsCountApi, getRecentCommentsApi } from './utils'
55
import cloudbase from '@cloudbase/js-sdk/app'
66
import '@cloudbase/js-sdk/auth'

src/js/main.js renamed to src/client/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { version } from '../version'
2-
import { install } from './tcb'
3-
import { render } from '../view'
1+
import { version } from './version'
2+
import { install } from './utils/tcb'
3+
import { render } from './view'
44
import { setLanguage, logger, isUrl, getCommentsCountApi, getRecentCommentsApi } from './utils'
55

66
async function initTcb (options) {

src/js/utils/api.js renamed to src/client/utils/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { app } from '../../view'
1+
import { app } from '../view'
22

33
const isUrl = (s) => {
44
return /^http(s)?:\/\//.test(s)
File renamed without changes.
File renamed without changes.

src/js/utils/highlight.js renamed to src/client/utils/highlight.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { app } from '../../view'
1+
import { app } from '../view'
22

33
const PRISM_CDN = 'https://cdn.staticfile.org/prism/1.28.0'
44
let Prism
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/js/utils/marked.js renamed to src/client/utils/marked.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { marked } from '../../lib/marked/marked'
1+
import { marked } from '../lib/marked/marked'
22

33
/**
44
* https://marked.js.org/#/USING_ADVANCED.md

src/js/tcb/index.js renamed to src/client/utils/tcb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
isNotSet,
33
logger
4-
} from '../utils'
4+
} from '.'
55

66
const builtInOptions = [
77
{ key: 'envId', required: true }
File renamed without changes.

src/client/version.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const version = '1.6.0-beta.1'
2+
3+
export { version }
File renamed without changes.

src/view/components/TkAction.vue renamed to src/client/view/components/TkAction.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default {
8787
width: 1em;
8888
line-height: 0;
8989
}
90-
.tk-action-icon /deep/ svg {
90+
.tk-action-icon :deep(svg) {
9191
fill: #409eff;
9292
}
9393
</style>

0 commit comments

Comments
 (0)