forked from auroral-ui/hexo-theme-aurora
-
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.
feat(plugin): add twikoo comment plugin support
- Loading branch information
Showing
13 changed files
with
413 additions
and
89 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
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
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 |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
* @author TriDiamond <[email protected]> | ||
*/ | ||
|
||
declare const Gitalk: any | ||
|
||
import request from '@/utils/external-request' | ||
import { AxiosResponse } from 'axios' | ||
import { formatTime, filterHTMLContent, RecentComment } from '@/utils' | ||
|
@@ -41,6 +43,48 @@ interface GithubCommentsInterface { | |
comments: GithubComment[] | ||
} | ||
|
||
interface GitHubInitConfig { | ||
clientID: string | ||
clientSecret: string | ||
repo: string | ||
owner: string | ||
admin: string[] | ||
language: string | ||
uid: string | ||
title: string | ||
body: string | ||
proxy: string | ||
} | ||
|
||
export const githubInit = ({ | ||
clientID, | ||
clientSecret, | ||
repo, | ||
owner, | ||
admin, | ||
language, | ||
uid, | ||
title, | ||
body, | ||
proxy | ||
}: GitHubInitConfig) => { | ||
const gitalk = new Gitalk({ | ||
clientID, | ||
clientSecret, | ||
repo, // The repository of store comments, | ||
owner, | ||
admin, | ||
language, | ||
id: uid, // Ensure uniqueness and length less than 50 | ||
distractionFreeMode: true, // Facebook-like distraction free mode | ||
title: title, | ||
body: body, | ||
proxy: proxy | ||
}) | ||
|
||
gitalk.render('gitalk-container') | ||
} | ||
|
||
export class GithubComments implements GithubCommentsInterface { | ||
commentUrlCount = 0 | ||
configs = { | ||
|
Oops, something went wrong.