https://github.com/uuanqin/waline-link-interceptor
A plugin of Waline Comment System which can add a intercept page for external links in comments or the nickname.
https://github.com/uuanqin/waline-link-interceptor
interceptor link npm-package plugin waline
Last synced: 13 days ago
JSON representation
A plugin of Waline Comment System which can add a intercept page for external links in comments or the nickname.
- Host: GitHub
- URL: https://github.com/uuanqin/waline-link-interceptor
- Owner: uuanqin
- License: mit
- Created: 2024-08-04T14:33:25.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-19T16:16:46.000Z (8 months ago)
- Last Synced: 2024-11-08T15:50:58.379Z (6 months ago)
- Topics: interceptor, link, npm-package, plugin, waline
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/waline-link-interceptor
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# waline-link-interceptor
A plugin of Waline Comment System which can add an intercept page for external links in comments or the nickname.
Waline 评论系统中间页插件。
Language: English | [中文](./README_zh.md)
## Install
```shell
npm i waline-link-interceptor
```## Use
```javascript
// index.js
const Waline = require('@waline/vercel');
const LinkInterceptor = require('waline-link-interceptor');module.exports = Waline({
plugins: [
LinkInterceptor({
whiteList: [
'example.com'
],
// blackList: [],
// interceptorTemplate: `redirect to __URL__`,
// redirectUrl: "https://example.com/go.html",
// encodeFunc: (url) =>{
// return "u="+Buffer.from(url).toString('base64')
// }
})
]
});
```Options:
- `whiteList` (optional): List of allowed domains and subdomains.
- `blackList` (optional): List of disallowed domains and subdomains.
- `interceptorTemplate` (optional): Html template of the middle page.
- `redirectUrl` (optional): The url of the middle page.
- `encodeFunc` (optional): Encoding function of external link.Example: If the url of the middle page is `https://example.com/go.html?u=https://external-link.com`, the options will be:
```js
LinkInterceptor({
whiteList: [
'example.com'
],
redirectUrl: `https://example.com/go.html`,
encodeFunc: (url) =>{
return "u="+url;
}
})
```More instructions can be seen on [this article](https://uuanqin.top/p/e1ee5eca/) (Chinese).
## Related Plugins
This plugin is based on [@waline-plugins/link-interceptor](https://github.com/walinejs/plugins/tree/master/packages/link-interceptor).
## License
[MIT](./LICENSE)