@waline/client
Advanced tools
Comparing version 2.11.1 to 2.11.2
@@ -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.11.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},a=e=>{let{serverURL:t,lang:n,paths:r,signal:a}=e;return(e=>{let{serverURL:t,lang:n,paths:r,type:a,signal:i}=e;return fetch(`${t}/article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${n}`,{signal:i}).then((e=>e.json())).then((e=>o(e,"article count")))})({serverURL:t,lang:n,paths:r,type:["time"],signal:a}).then((e=>Array.isArray(e)?e:[e]))},i=e=>(e=>{let{serverURL:t,lang:n,path:a,type:i,action:l}=e;return fetch(`${t}/article?lang=${n}`,{method:"POST",headers:r,body:JSON.stringify({path:a,type:i,action:l})}).then((e=>e.json())).then((e=>o(e,"article count")))})({...e,type:"time"}),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:p=".waline-pageview-count",update:h=!0,lang:c="zh-CN"}=e;const f=new AbortController,g=Array.from(document.querySelectorAll(p)),u=e=>{const t=l(e);return null!==t&&o!==t},d=e=>a({serverURL:t(r),paths:e.map((e=>l(e)||o)),lang:c,signal:f.signal}).then((t=>s(t,e))).catch(n);if(h){const e=g.filter((e=>!u(e))),n=g.filter(u);i({serverURL:t(r),path:o,lang:c}).then((t=>s(new Array(e.length).fill(t),e))),n.length&&d(n)}else d(g);return f.abort.bind(f)}})); | ||
!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.11.2";const t={"Content-Type":"application/json"},n=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},r=e=>{let{serverURL:t,lang:r,paths:o,signal:a}=e;return(e=>{let{serverURL:t,lang:r,paths:o,type:a,signal:i}=e;return fetch(`${t}/article?path=${encodeURIComponent(o.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${r}`,{signal:i}).then((e=>e.json())).then((e=>n(e,"article count")))})({serverURL:t,lang:r,paths:o,type:["time"],signal:a}).then((e=>Array.isArray(e)?e:[e]))},o=e=>(e=>{let{serverURL:r,lang:o,path:a,type:i,action:l}=e;return fetch(`${r}/article?lang=${o}`,{method:"POST",headers:t,body:JSON.stringify({path:a,type:i,action:l})}).then((e=>e.json())).then((e=>n(e,"article count")))})({...e,type:"time"}),a=e=>{const t=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/\/$/u,"")}(e);return/^(https?:)?\/\//.test(t)?t:`https://${t}`},i=e=>{"AbortError"!==e.name&&console.error(e.message)},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:t,path:n=window.location.pathname,selector:p=".waline-pageview-count",update:h=!0,lang:c="zh-CN"}=e;const f=new AbortController,g=Array.from(document.querySelectorAll(p)),u=e=>{const t=l(e);return null!==t&&n!==t},d=e=>r({serverURL:a(t),paths:e.map((e=>l(e)||n)),lang:c,signal:f.signal}).then((t=>s(t,e))).catch(i);if(h){const e=g.filter((e=>!u(e))),r=g.filter(u);o({serverURL:a(t),path:n,lang:c}).then((t=>s(new Array(e.length).fill(t),e))),r.length&&d(r)}else d(g);return f.abort.bind(f)}})); | ||
//# sourceMappingURL=pageview.js.map |
{ | ||
"name": "@waline/client", | ||
"version": "2.11.1", | ||
"version": "2.11.2", | ||
"description": "client for waline comment system", | ||
@@ -28,2 +28,7 @@ "keywords": [ | ||
}, | ||
"./api": { | ||
"types": "./dist/api.d.ts", | ||
"require": "./dist/api.cjs", | ||
"default": "./dist/api.mjs" | ||
}, | ||
"./component": { | ||
@@ -38,2 +43,8 @@ "default": "./dist/component.mjs" | ||
}, | ||
"./comment": { | ||
"types": "./dist/comment.d.ts", | ||
"import": "./dist/comment.mjs", | ||
"require": "./dist/comment.cjs", | ||
"default": "./dist/comment.js" | ||
}, | ||
"./pageview": { | ||
@@ -47,5 +58,16 @@ "types": "./dist/pageview.d.ts", | ||
"./waline-meta.css": "./dist/waline-meta.css", | ||
"./dist/api": { | ||
"types": "./dist/api.d.ts", | ||
"require": "./dist/api.cjs", | ||
"default": "./dist/api.mjs" | ||
}, | ||
"./dist/component": { | ||
"default": "./dist/component.mjs" | ||
}, | ||
"./dist/comment": { | ||
"types": "./dist/comment.d.ts", | ||
"import": "./dist/comment.mjs", | ||
"require": "./dist/comment.cjs", | ||
"default": "./dist/comment.js" | ||
}, | ||
"./dist/pageview": { | ||
@@ -77,13 +99,2 @@ "types": "./dist/pageview.d.ts", | ||
], | ||
"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": { | ||
@@ -131,3 +142,13 @@ "production": [ | ||
"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" | ||
} | ||
} | ||
} |
@@ -1,8 +0,3 @@ | ||
import { useUserInfo } from './composables'; | ||
import { | ||
decodePath, | ||
errorHandler, | ||
fetchCommentCount, | ||
getServerURL, | ||
} from './utils'; | ||
import { fetchCommentCount } from './api'; | ||
import { decodePath, errorHandler, getServerURL } from './utils'; | ||
import type { WalineAbort } from './typings'; | ||
@@ -58,4 +53,2 @@ | ||
const userInfo = useUserInfo(); | ||
if (elements.length) | ||
@@ -69,3 +62,2 @@ void fetchCommentCount({ | ||
signal: controller.signal, | ||
token: userInfo.value?.token, | ||
}) | ||
@@ -72,0 +64,0 @@ .then((counts) => { |
export * from './inputs'; | ||
export * from './like'; | ||
export * from './recaptchaV3'; | ||
export * from './timeAgo'; | ||
export * from './vote'; | ||
export * from './userInfo'; | ||
export * from './like'; |
import { useStorage } from '@vueuse/core'; | ||
import type { Ref } from 'vue'; | ||
import type { UserInfo } from '../api'; | ||
export interface UserInfo { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
display_name: string; | ||
email: string; | ||
url: string; | ||
token: string; | ||
avatar: string; | ||
mailMd5: string; | ||
objectId: string | number; | ||
type: 'administrator' | 'guest'; | ||
} | ||
export const USER_KEY = 'WALINE_USER'; | ||
@@ -18,0 +7,0 @@ |
import { createApp, h, reactive, watchEffect } from 'vue'; | ||
import { VueReCaptcha } from './components/RecaptchaV3/RecaptchaVuePlugin'; | ||
@@ -84,12 +83,2 @@ 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!); | ||
@@ -96,0 +85,0 @@ |
@@ -1,8 +0,3 @@ | ||
import { | ||
errorHandler, | ||
fetchPageviews, | ||
getQuery, | ||
getServerURL, | ||
updatePageviews, | ||
} from './utils'; | ||
import { fetchPageviews, updatePageviews } from './api'; | ||
import { errorHandler, getQuery, getServerURL } from './utils'; | ||
@@ -9,0 +4,0 @@ import type { WalineAbort } from './typings'; |
@@ -26,7 +26,5 @@ import { | ||
export interface WalineConfig | ||
extends Required<Omit<WalineProps, 'wordLimit' | 'recaptchaV3Key'>> { | ||
export interface WalineConfig extends Required<Omit<WalineProps, 'wordLimit'>> { | ||
locale: WalineLocale; | ||
wordLimit: [number, number] | false; | ||
// emoji: Promise<EmojiConfig>; | ||
} | ||
@@ -70,2 +68,3 @@ | ||
reaction, | ||
recaptchaV3Key = '', | ||
...more | ||
@@ -92,4 +91,5 @@ }: WalineProps): WalineConfig => ({ | ||
search, | ||
recaptchaV3Key, | ||
reaction: reaction === true ? defaultReaction : reaction || false, | ||
...more, | ||
}); |
@@ -6,3 +6,2 @@ export * from './config'; | ||
export * from './error'; | ||
export * from './fetch'; | ||
export * from './getRoot'; | ||
@@ -9,0 +8,0 @@ export * from './image'; |
@@ -0,3 +1,4 @@ | ||
import { fetchRecentComment } from '../api'; | ||
import { useUserInfo } from '../composables'; | ||
import { fetchRecentComment, getRoot } from '../utils'; | ||
import { getRoot } from '../utils'; | ||
@@ -4,0 +5,0 @@ import type { WalineComment } from '../typings'; |
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
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
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
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
2213868
138
7281
3
70
90