forked from djyde/cusdis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
149 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,4 +162,4 @@ yarn.lock | |
|
||
generated/* | ||
db.sqlite | ||
public/js | ||
public/js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
rewrites() { | ||
return [ | ||
{ | ||
source: '/doc', | ||
destination: '/doc/index.html' | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Cusdis | ||
|
||
Open-source, lightweight (4.7kb gzipped), privacy-friendly alternative to Disqus. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- **Introduction** | ||
- [About](/) | ||
- [Features](/features.md) | ||
- [Self-host Guide](/self-host.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Features | ||
|
||
## Universal embed code | ||
|
||
## Light-weight sdk | ||
|
||
## Moderation | ||
|
||
### Reply as Moderator | ||
|
||
### Approve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<meta charset="UTF-8"> | ||
<title>Cusids Documentation</title> | ||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/themes/vue.css" /> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script> | ||
window.$docsify = { | ||
basePath: '/doc/', | ||
loadSidebar: true, | ||
subMaxLevel: 3, | ||
cusdis: { | ||
host: 'https://cusdis.com', | ||
appId: '35b01c49-15f9-46b3-807f-9240f6cadc1a' | ||
} | ||
} | ||
</script> | ||
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script> | ||
<script src="/js/cusdis.docsify.js"></script> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Self-host Guide | ||
|
||
## Docker | ||
|
||
## Vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function CusdisPlugin(hook, vm) { | ||
window.cusdisTag = 'cusdis_thread' | ||
|
||
const config = vm.config.cusdis | ||
|
||
const { appId, host } = config; | ||
|
||
const dom = Docsify.dom | ||
|
||
hook.init(_ => { | ||
const script = dom.create("script"); | ||
script.async = true; | ||
script.src = `http://localhost:3000/js/cusdis.es.js`; | ||
script.setAttribute("data-timestamp", Number(new Date())); | ||
dom.appendTo(dom.body, script); | ||
}) | ||
|
||
hook.afterEach((html, next) => { | ||
// const cusdisFooter = ` | ||
// <div id="cusdis" | ||
// data-host="${host}" | ||
// data-app-id="${appId}" | ||
// data-page-id="${vm.route.path}" | ||
// data-page-title="${vm.route.path}" | ||
// ></div> | ||
// `; | ||
|
||
// next(html + cusdisFooter); | ||
next(html) | ||
}); | ||
|
||
function createCusdis() { | ||
const div = document.createElement('div') | ||
div.style.marginTop = '4rem' | ||
div.dataset.appId = appId | ||
div.dataset.pageId = vm.route.path | ||
div.dataset.pageTitle = vm.route.path | ||
div.dataset.host = host | ||
return div | ||
} | ||
|
||
hook.doneEach(() => { | ||
const cusdis = createCusdis() | ||
dom.find('#main').append(cusdis) | ||
console.log(cusdis) | ||
window.renderCusdis(cusdis); | ||
}) | ||
} | ||
|
||
window.$docsify.plugins = (window.$docsify.plugins || []).concat(CusdisPlugin); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import Widget from './Widget.svelte' | ||
import Widget from "./Widget.svelte"; | ||
|
||
const target = document.querySelector("#cusdis"); | ||
|
||
if (target) { | ||
new Widget({ | ||
target, | ||
props: { | ||
attrs: target.dataset | ||
} | ||
}); | ||
function render(target) { | ||
if (target) { | ||
new Widget({ | ||
target, | ||
props: { | ||
attrs: target.dataset, | ||
}, | ||
}); | ||
} | ||
} | ||
|
||
window.renderCusdis = render | ||
|
||
render(document.querySelector(window.cusdisTag || "#cusdis")); |