@waline/client
Advanced tools
Comparing version 2.9.1 to 2.10.0
@@ -314,2 +314,6 @@ interface WalineEmojiInfo { | ||
copyright?: boolean; | ||
/** | ||
* recaptcha v3 client key | ||
*/ | ||
recaptchaV3Key?: string; | ||
} | ||
@@ -316,0 +320,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){if("function"==typeof define&&define.amd)define("Waline",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.Waline=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.pageviewCount=void 0;e.version="2.9.1";const t=e=>{const t=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/\/$/u,"")}(e);return/^(https?:)?\/\//.test(t)?t:`https://${t}`},n=e=>{"AbortError"!==e.name&&console.error(e.message)},r={"Content-Type":"application/json"},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},i=e=>{let{serverURL:t,lang:n,paths:r,signal:i}=e;return fetch(`${t}/article?path=${encodeURIComponent(r.join(","))}&lang=${n}`,{signal:i}).then((e=>e.json())).then((e=>o(e,"visit count"))).then((e=>Array.isArray(e)?e:[e]))},a=e=>{let{serverURL:t,lang:n,path:i}=e;return fetch(`${t}/article?lang=${n}`,{method:"POST",headers:r,body:JSON.stringify({path:i})}).then((e=>e.json())).then((e=>o(e,"visit count")))},l=e=>e.dataset.path||e.getAttribute("id"),s=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))};e.pageviewCount=e=>{let{serverURL:r,path:o=window.location.pathname,selector:h=".waline-pageview-count",update:p=!0,lang:f="zh-CN"}=e;const c=new AbortController,u=Array.from(document.querySelectorAll(h)),d=e=>{const t=l(e);return null!==t&&o!==t},g=e=>i({serverURL:t(r),paths:e.map((e=>l(e)||o)),lang:f,signal:c.signal}).then((t=>s(t,e))).catch(n);if(p){const e=u.filter((e=>!d(e))),n=u.filter(d);a({serverURL:t(r),path:o,lang:f}).then((t=>s(new Array(e.length).fill(t),e))),n.length&&g(n)}else g(u);return c.abort.bind(c)}})); | ||
!function(e,t){if("function"==typeof define&&define.amd)define("Waline",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.Waline=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.pageviewCount=void 0;e.version="2.10.0";const t=e=>{const t=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/\/$/u,"")}(e);return/^(https?:)?\/\//.test(t)?t:`https://${t}`},n=e=>{"AbortError"!==e.name&&console.error(e.message)},r={"Content-Type":"application/json"},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},i=e=>{let{serverURL:t,lang:n,paths:r,signal:i}=e;return fetch(`${t}/article?path=${encodeURIComponent(r.join(","))}&lang=${n}`,{signal:i}).then((e=>e.json())).then((e=>o(e,"visit count"))).then((e=>Array.isArray(e)?e:[e]))},a=e=>{let{serverURL:t,lang:n,path:i}=e;return fetch(`${t}/article?lang=${n}`,{method:"POST",headers:r,body:JSON.stringify({path:i})}).then((e=>e.json())).then((e=>o(e,"visit count")))},l=e=>e.dataset.path||e.getAttribute("id"),s=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))};e.pageviewCount=e=>{let{serverURL:r,path:o=window.location.pathname,selector:h=".waline-pageview-count",update:p=!0,lang:f="zh-CN"}=e;const c=new AbortController,u=Array.from(document.querySelectorAll(h)),d=e=>{const t=l(e);return null!==t&&o!==t},g=e=>i({serverURL:t(r),paths:e.map((e=>l(e)||o)),lang:f,signal:c.signal}).then((t=>s(t,e))).catch(n);if(p){const e=u.filter((e=>!d(e))),n=u.filter(d);a({serverURL:t(r),path:o,lang:f}).then((t=>s(new Array(e.length).fill(t),e))),n.length&&g(n)}else g(u);return c.abort.bind(c)}})); | ||
//# sourceMappingURL=pageview.js.map |
@@ -120,2 +120,6 @@ interface WalineEmojiInfo { | ||
url: string; | ||
/** | ||
* Recaptcha Token | ||
*/ | ||
recaptchaV3?: string; | ||
} | ||
@@ -388,2 +392,6 @@ declare type WalineCommentStatus = 'approved' | 'waiting' | 'spam'; | ||
copyright?: boolean; | ||
/** | ||
* recaptcha v3 client key | ||
*/ | ||
recaptchaV3Key?: string; | ||
} | ||
@@ -390,0 +398,0 @@ |
{ | ||
"name": "@waline/client", | ||
"version": "2.9.1", | ||
"version": "2.10.0", | ||
"description": "client for waline comment system", | ||
@@ -74,2 +74,13 @@ "keywords": [ | ||
], | ||
"scripts": { | ||
"build": "pnpm rollup && pnpm style", | ||
"clean": "rimraf ./dist", | ||
"dev": "vite -c config/vite.config.js", | ||
"lint": "eslint --ext .ts,.vue .", | ||
"prepublishOnly": "pnpm clean && pnpm build", | ||
"rollup": "rollup -c ./config/rollup.config.js", | ||
"style": "pnpm style:main && pnpm style:meta", | ||
"style:main": "sass ./src/styles/index.scss ./dist/waline.css --style=compressed", | ||
"style:meta": "sass ./src/styles/meta.scss ./dist/waline-meta.css --style=compressed" | ||
}, | ||
"browserslist": { | ||
@@ -96,12 +107,13 @@ "production": [ | ||
"devDependencies": { | ||
"@babel/core": "7.19.0", | ||
"@babel/preset-env": "7.19.0", | ||
"@babel/core": "7.19.1", | ||
"@babel/preset-env": "7.19.1", | ||
"@rollup/plugin-babel": "5.3.1", | ||
"@rollup/plugin-commonjs": "22.0.2", | ||
"@rollup/plugin-node-resolve": "14.0.1", | ||
"@rollup/plugin-node-resolve": "14.1.0", | ||
"@rollup/plugin-replace": "4.0.0", | ||
"@types/autosize": "4.0.1", | ||
"@types/marked": "4.0.7", | ||
"@types/node": "18.7.16", | ||
"@types/node": "18.7.18", | ||
"@vitejs/plugin-vue": "3.1.0", | ||
"recaptcha-v3": "^1.10.0", | ||
"rimraf": "3.0.2", | ||
@@ -113,17 +125,7 @@ "rollup": "2.79.0", | ||
"typescript": "4.8.3", | ||
"vite": "3.1.0" | ||
"vite": "3.1.2" | ||
}, | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"scripts": { | ||
"build": "pnpm rollup && pnpm style", | ||
"clean": "rimraf ./dist", | ||
"dev": "vite -c config/vite.config.js", | ||
"lint": "eslint --ext .ts,.vue .", | ||
"rollup": "rollup -c ./config/rollup.config.js", | ||
"style": "pnpm style:main && pnpm style:meta", | ||
"style:main": "sass ./src/styles/index.scss ./dist/waline.css --style=compressed", | ||
"style:meta": "sass ./src/styles/meta.scss ./dist/waline-meta.css --style=compressed" | ||
} | ||
} | ||
} |
import { createApp, h, reactive, watchEffect } from 'vue'; | ||
import { VueReCaptcha } from './components/RecaptchaV3/RecaptchaVuePlugin'; | ||
@@ -83,2 +84,12 @@ import Waline from './components/Waline.vue'; | ||
if (app && initProps.recaptchaV3Key) { | ||
app.use(VueReCaptcha, { | ||
siteKey: initProps.recaptchaV3Key, | ||
loaderOptions: { | ||
useRecaptchaNet: true, | ||
autoHideBadge: true, | ||
}, | ||
}); | ||
} | ||
if (app) app.mount(root!); | ||
@@ -85,0 +96,0 @@ |
@@ -52,2 +52,6 @@ export interface WalineCommentData { | ||
url: string; | ||
/** | ||
* Recaptcha Token | ||
*/ | ||
recaptchaV3?: string; | ||
} | ||
@@ -54,0 +58,0 @@ |
@@ -216,2 +216,7 @@ import type { | ||
copyright?: boolean; | ||
/** | ||
* recaptcha v3 client key | ||
*/ | ||
recaptchaV3Key?: string; | ||
} |
@@ -25,3 +25,3 @@ import { | ||
export interface WalineConfig extends Required<Omit<WalineProps, 'wordLimit'>> { | ||
export interface WalineConfig extends Required<Omit<WalineProps, 'wordLimit' | 'recaptchaV3Key'>> { | ||
locale: WalineLocale; | ||
@@ -28,0 +28,0 @@ wordLimit: [number, number] | false; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
2111462
111
0
100
7054
18