diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4bd31de --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: 'Deta Release' + +on: + workflow_dispatch: + inputs: + notes: + type: string + push: + branches: + - main + - master + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Node Env + uses: actions/setup-node@v4 + + - name: Export Version + run: | + SPACE_VERSION=$(node -e "console.log(require('./package.json').dependencies['@waline/vercel']);") + SPACE_NOTES=$([ -n "${{ inputs.notes }}" ] && echo ${{ inputs.notes }} || echo "Full ChangeLog: https://github.com/walinejs/waline/blob/main/CHANGELOG.md") + echo "Which version will be released?=> $SPACE_VERSION ;" + echo "SAPCE_NOTES: $SPACE_NOTES" + echo "SPACE_VERSION=$SPACE_VERSION" >> $GITHUB_ENV + echo "SPACE_NOTES=$SPACE_NOTES" >> $GITHUB_ENV + + - name: Release + uses: lizheming/deta-action@1.1.1 + with: + access_token: ${{ secrets.space_access_token }} + id: ${{ secrets.space_id }} + version: ${{ env.SPACE_VERSION }} + notes: ${{ env.SPACE_NOTES }} + listed: true + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a1e49f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,105 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port +.space \ No newline at end of file diff --git a/Discovery.md b/Discovery.md new file mode 100644 index 0000000..4103e6e --- /dev/null +++ b/Discovery.md @@ -0,0 +1,30 @@ +--- +app_name: "Waline" +title: "Waline" +tagline: "A Simple, Safe Comment System" +theme_color: "#4E9DEF" +git: "https://github.com/walinejs/waline" +homepage: "https://waline.js.org/en" +open_code: true +--- + +A simple comment system with backend support. + +![Author](https://img.shields.io/badge/author-lizheming,%20Mr.Hope-blue?style=for-the-badge) ![License](https://img.shields.io/github/license/walinejs/waline?style=for-the-badge) [![qq](https://img.shields.io/badge/qq-waline交流群-f75137?logo=TencentQQ&style=for-the-badge)](https://jq.qq.com/?_wv=1027&k=bKoVBppG) [![telegram](https://img.shields.io/badge/telegram-walinejs-2ca5e0?logo=telegram&style=for-the-badge)](https://t.me/walinejs) + +## Documentation + +### [English](https://waline.js.org/en/) | [简体中文](https://waline.js.org/) + +## Feature + +- Fast +- **Really** Safe +- Support full markdown syntax +- Simple and lightweight +- Deploy free! +- Multiple deployment and storage service support, at least 243 deployment choice! + +## Contact + +You can contact me through [discussions](https://github.com/walinejs/waline/discussions). Join our [telegram](https://t.me/walinejs) group or scan [QQ group](https://qm.qq.com/cgi-bin/qm/qr?k=rPZvq_EBfwQa6QZX7sToVlhH49c6ed0R&jump_from=webapi) qrcode to communicate about waline! \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c990a3e --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Waline + +https://deta.space/discovery/@lizheming/waline + +This directory is Waline app source code which in the Deta Discovery. diff --git a/Spacefile b/Spacefile new file mode 100644 index 0000000..9b6c5c9 --- /dev/null +++ b/Spacefile @@ -0,0 +1,214 @@ +# Spacefile Docs: https://go.deta.dev/docs/spacefile/v0 +v: 0 +app_name: Waline +icon: ./logo.png +micros: + - name: waline + primary: true + src: ./ + engine: nodejs16 + run: "node index.js" + public_routes: + - /* + # commands: + # - curl -sf https://gobinaries.com/tj/node-prune | sh && node-prune + presets: + env: + - name: LEAN_ID + description: LeanCloud Application ID + - name: LEAN_KEY + description: LeanCloud Application Key + - name: LEAN_MASTER_KEY + description: LeanCloud Application Master Key + - name: LEAN_SERVER + description: LeanCloud server address if you're leancloud china user + - name: SITE_NAME + description: site name + - name: SITE_URL + description: site url + - name: AUTHOR_EMAIL + description: The blogger’s email, used to judge whether posted comment is posted by the blogger. If it is posted by the blogger, there will be no reminder notification. + - name: LOGIN + description: User need login before comment when LOGIN=force + - name: DISABLE_USERAGENT + description: wether hide the user agent of commenter. Default value is false + - name: DISABLE_REGION + description: wether hide commenter's region. Default value is false + - name: DISABLE_AUTHOR_NOTIFY + description: wether disable author notification + - name: AVATAR_PROXY + description: Avatar proxy service url. You can set false to disable it + - name: GRAVATAR_STR + description: Gravatar render string,base on nunjucks template + - name: LEVELS + description: Give each user a rating label based on the number of comments + - name: IPQPS + description: IP-based comment posting frequency limit in seconds. Set to 0 for no + limit + - name: SECURE_DOMAINS + description: Secure Domains config. Supports multiple domain with Comma separated + - name: AKISMET_KEY + description: Akismet antispam service key, set false if you wanna close it. + - name: COMMENT_AUDIT + description: Comment audit switcher. When enabled, every comment needs to be approved + by admin, so hint in placeholder is recommended + - name: RECAPTCHA_V3_KEY + description: reCAPTCHA V3 key,should set along with client + - name: RECAPTCHA_V3_SECRET + description: reCAPTCHA V3 secret for server. + - name: TURNSTILE_KEY + description: Turnstile key,should set along with client + - name: TURNSTILE_SECRET + description: Turnstile secret for server + - name: MARKDOWN_CONFIG + description: MarkdownIt Config + - name: MARKDOWN_HIGHLIGHT + description: Whether enable highlight + - name: MARKDOWN_EMOJI + description: Whether enable emoji + - name: MARKDOWN_SUB + description: Whether enable subscript + - name: MARKDOWN_SUP + description: Whether enable superscript + - name: MARKDOWN_TEX + description: Service to parse math, mathjax katex and false are supported + - name: MARKDOWN_MATHJAX + description: MathJax Options + - name: MARKDOWN_KATEX + description: Katex Options + - name: SMTP_SERVICE + description: SMTP mail service provider + - name: SMTP_HOST + description: SMTP server address + - name: SMTP_PORT + description: SMTP server port + - name: SMTP_USER + description: SMTP username + - name: SMTP_PASS + description: SMTP Password. + - name: SMTP_SECURE + description: SMTP connect with SSL + - name: SENDER_NAME + description: Customize sender name + - name: SENDER_EMAIL + description: Customize sender email + - name: MONGO_DB + description: MongoDB database name + default: '' + - name: MONGO_USER + description: MongoDB server username + default: '' + - name: MONGO_PASSWORD + description: MongoDB server password + default: '' + - name: MONGO_HOST + description: MongoDB server address, support array format + default: 127.0.0.1 + - name: MONGO_PORT + description: MongoDB server port, support array format + default: '27017' + - name: MONGO_REPLICASET + description: MongoDB replica set + default: '' + - name: MONGO_AUTHSOURCE + description: MongoDB auth source + default: '' + - name: MONGO_OPT_SSL + description: use SSL connection + default: 'false' + - name: MYSQL_DB + description: MySQL database name + default: '' + - name: MYSQL_USER + description: MySQL server username + default: '' + - name: MYSQL_PASSWORD + description: MySQL server password + default: '' + - name: MYSQL_HOST + description: MySQL server address + default: 127.0.0.1 + - name: MYSQL_PORT + description: MySQL server port + default: '3306' + - name: MYSQL_PREFIX + description: MySQL table prefix + default: wl_ + - name: MYSQL_CHARSET + description: MySQL table charset + default: utf8mb4 + - name: MYSQL_SSL + description: whether use SSL connection + default: 'false' + - name: TIDB_DB + description: TiDB database name + default: '' + - name: TIDB_USER + description: TiDB server username + default: '' + - name: TIDB_PASSWORD + description: TiDB server password + default: '' + - name: TIDB_HOST + description: TiDB server address + default: 127.0.0.1 + - name: TIDB_PORT + description: TiDB server port + default: '4000' + - name: TIDB_PREFIX + description: TiDB table prefix + default: wl_ + - name: TIDB_CHARSET + description: TiDB table charset + default: utf8mb4 + - name: JWT_TOKEN + description: Random String for login token generator + default: '' + - name: PG_DB + description: PostgreSQL database name + default: '' + - name: PG_USER + description: PostgreSQL server username + default: '' + - name: PG_PASSWORD + description: PostgreSQL server password + default: '' + - name: PG_HOST + description: PostgreSQL server address + default: 127.0.0.1 + - name: PG_PORT + description: PostgreSQL server port + default: '3211' + - name: PG_PREFIX + description: PostgreSQL table prefix + default: wl_ + - name: PG_SSL + description: set to true to use SSL connection + default: 'false' + - name: GITHUB_TOKEN + description: Personal access tokens + default: '' + - name: GITHUB_REPO + description: repository name, such as walinejs/waline + default: '' + - name: GITHUB_PATH + description: The data storage directory, such as data means it is stored in the data directory, root directory by default + default: '' + - name: OAUTH_URL + description: OAuth Social Login Service URL. You can build your own auth + - name: WEBHOOK + description: You can set a Webhook URL that will be triggered when you have new comment. + - name: WALINE_ADMIN_MODULE_ASSET_URL + description: Waline admin link + - name: IP2REGION_DB + description: customized IP query library path + - name: MAIL_SUBJECT + description: Notification mail title when comment replied + - name: MAIL_TEMPLATE + description: Notification mail content when comment replied + - name: MAIL_SUBJECT_ADMIN + description: Notification mail title when your site has a new comment + - name: MAIL_TEMPLATE_ADMIN + description: Notification mail content when your site has a new comment + + diff --git a/index.js b/index.js new file mode 100644 index 0000000..66d78c9 --- /dev/null +++ b/index.js @@ -0,0 +1,9 @@ +const Waline = require('@waline/vercel'); + +const app = Waline({ + async postSave(comment) { + // do what ever you want after save comment + }, +}); + +require('http').createServer(app).listen(process.env.PORT || 3000); diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..02a1f3b Binary files /dev/null and b/logo.png differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..2415a74 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "deta-space", + "version": "1.0.0", + "description": "An Waline app repository for deta", + "main": "index.js", + "keywords": ["Waline", "Comment"], + "author": "lizheming", + "dependencies": { + "@waline/vercel": "1.32.0" + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..d78c3b6 --- /dev/null +++ b/renovate.json @@ -0,0 +1,16 @@ +{ + "extends": [ + "config:base" + ], + "packageRules": [ + { + "matchUpdateTypes": ["minor", "patch", "pin", "digest"], + "automerge": true + }, + { + "matchDepTypes": ["devDependencies"], + "automerge": true + } + ], + "platformAutomerge": true +}