主頁 >  其他 > 應用集成-在Hexo、Hugo博客框架中使用Gitalk基于Github上倉庫專案的issue無后端服務評論系統實踐

應用集成-在Hexo、Hugo博客框架中使用Gitalk基于Github上倉庫專案的issue無后端服務評論系統實踐

2022-08-18 10:12:55 其他

關注「WeiyiGeek」公眾號

設為「特別關注」每天帶你玩轉網路安全運維、應用開發、物聯網IOT學習!

希望各位看友【關注、點贊、評論、收藏、投幣】,助力每一個夢想,

帥哥(靚仔)、美女,點個關注后續不迷路


本章目錄

目錄
  • 0x00 Gitalk - 基于Github的評論系統
    • 1.快速介紹
    • 2.安裝部署
    • 3.使用實踐
    • n.入坑出坑
      • 1.使用Gitalk進行Github的Oauth認證無法跨域獲取Token問題解決辦法


作者: WeiyiGeek [唯一極客]
首發地址: https://mp.weixin.qq.com/s/2LLVDf7Fj4cX3IRZUtUfnA
原文地址: https://blog.weiyigeek.top/2022/5-28-588.html


0x00 Gitalk - 基于Github的評論系統

描述: 我想對于所有使用hexo、Hugo或者WordPress自建博客的博主來說GitTalk應該不陌生,GitTalk通過Github的OpenAPI以及issues功能實作社區評論確實還是很方便的,除開對國內訪問速度較慢就沒啥毛病,但是考慮到新手朋友此處還是簡單介紹一下,

1.快速介紹

描述: Gitalk 是一個基于 Github Issue 和 Preact 的現代評論組件,
功能:

  • 使用 github 帳號進行身份驗證
  • 無服務器,所有評論將存盤為 github 問題
  • 個人和組織的github專案都可以用來存盤評論
  • 本地化,支持多國語言 [en, zh-CN, zh-TW, es-ES, fr, ru, de, pl, ko, fa, ja]
  • 類似 Facebook 的無干擾模式(可以通過 DistentionFreeMode 選項啟用)
  • 熱鍵提交評論(cmd|ctrl + enter)

專案地址:https://github.com/gitalk/gitalk
幫助檔案:https://github.com/gitalk/gitalk/blob/master/readme-cn.md

溫馨提示: 當前 Gitalk 最新版本為 1.7.2 (Mar 3, 2021), 如后續隨著時間推移,可能會有些許變化,建議參考官網(https://github.com/gitalk/gitalk/tags)


2.安裝部署

描述:安裝參考Gitalk評論系統的兩種方式,

安裝實踐

  • 方式1.在你的HTML頁面中使用 link 與 script 標簽引入,
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>

<!-- or -->

<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
  • 方式2.使用 npm 安裝 gital 模塊,
# 模塊安裝
npm i --save gitalk

# 專案匯入
import 'gitalk/dist/gitalk.css'
import Gitalk from 'gitalk'

配置實踐

首先,您需要為商店評論選擇一個公共 github 存盤庫(已存在或創建一個新存盤庫),然后創建一個 GitHub 應用程式,如果你沒有,點擊這里 (https://github.com/settings/applications/new) 注冊一個新的,

Application name : BlogTalk
Homepage URL : https://blog.weiyigeek.top
Application description : 歡迎訪問 WeiyiGeek blog\'s [blog.weiyigeek.top] talk about , 歡迎留言騷擾喲,親!
Authorization callback URL : https://blog.weiyigeek.top

WeiyiGeek.Register a new OAuth application

注意:您必須在授權回呼 URL 欄位中指定網站域 url,

然后,創建完成后你將獲取Client ID 與 Client Secret,如下所示:

WeiyiGeek.application ID and Secret

注意:后續更新修改可以進行訪問 Settings/Developer settings ( https://github.com/settings/developers )

最后,創建一個公共倉庫此處我創建的是blogtalk,創建完后在專案的(https://github.com/WeiyiGeek/blogtalk/settings)中啟用 issue 即可

WeiyiGeek.blogtalk


使用方式1.將如下代碼添加到您的頁面:

<head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
    <script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
</head>
<body>
    <div id="gitalk-container"></div>
    <script>
        const gitalk = new Gitalk({
          clientID: 'GitHub Application Client ID',          // 8d8e96********797026d3
          clientSecret: 'GitHub Application Client Secret',  // secrets**********secrets
          repo: 'GitHub repo',          // blogtalk
          owner: 'GitHub repo owner',   // WeiyiGeek
          admin: ['GitHub repo owner and collaborators, only these guys can initialize github issues'], // ['WeiyiGeek']
          id: location.pathname,      // Ensure uniqueness and length less than 50
          distractionFreeMode: false  // Facebook-like distraction free mode
        })
        gitalk.render('gitalk-container')
    </script>
</body>

使用方式2.在React中使用

import GitalkComponent from "gitalk/dist/gitalk-component";
// 并使用類似的組件
<GitalkComponent options={{
  clientID: "...",
  // ...
  // options below
}} />

溫馨提示: Gitalk 物件實體化引數參考 (https://github.com/gitalk/gitalk#options)


3.使用實踐

在 Hexo 中使用
描述: 此處以我的博客[https://blog.weiyigeek.top] 為例進行演示配置,此處筆者使用的是 hexo + mellow 主題 , 已經經過二次魔改(有需要該博客主題請在公眾號回復【mellow博客主題】或者訪問 https://weiyigeek.top/wechat.html?key=mellow博客主題 ),

  • Step 1.在 Hexo 主題中的 _config.yaml 配置加入如下配置片段,
# gittalk 評論系統
gitalk:
  enable: true
  owner: WeiyiGeek  # github賬號
  repo: blogtalk    # 留言倉庫
  proxy: /github/login/oauth/access_token # 反向代理解決跨域問題,后續將會主要講解哦,
  oauth:
    client_id: 8d8e965c******97026d3       # Github App Auth ID 
    client_secret: e9c6141cb1f02f721********d01cb4d7a8f069 #  Github App Auth secret
  perPage: 15 
  • Step 2.在主題檔案引擎中加入如下片段,
<div id="gitalk-container"></div>
<!-- 實際上是將 <script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script> js 下載到了本地 -->
<script type="text/javascript" src="https://www.cnblogs.com/WeiyiGeek/p/<%- url_for(theme_js('/js/plugins/gitalk.min', cache)) %>"></script>


<script type="text/javascript" src="https://www.cnblogs.com/WeiyiGeek/p/<%- url_for(theme_js('/js/custom/gitalk.init', cache)) %>"></script>
<!-- themes\mellow\source\js\custom\gitalk.init.js -->
var gitalk = new Gitalk({
  clientID: '<%- theme.gitalk.oauth.client_id %>',
  clientSecret: '<%- theme.gitalk.oauth.client_secret %>',
  repo: '<%- theme.gitalk.repo %>',
  owner: '<%- theme.gitalk.owner %>',
  admin: ['<%- theme.gitalk.owner %>'],
  id: location.pathname,
  proxy: '<%- theme.gitalk.proxy %>',
  distractionFreeMode: true
})
#  hexo g 生成靜態檔案后的樣子
# var gitalk = new Gitalk({
#   clientID: '8d8e965c******97026d3',
#   clientSecret: 'e9c6141cb1f02f721********d01cb4d7a8f069',
#   repo: 'blogtalk',
#   owner: 'WeiyiGeek',
#   admin: ['WeiyiGeek'],
#   id: location.pathname,
#   proxy: '/github/login/oauth/access_token',
#   distractionFreeMode: false
# })

# 創建 gitalk-container 
gitalk.render('gitalk-container')

溫馨提示: 建議將distractionFreeMode設定為false,因為True真心難看,
溫馨提示: 為了 Github Apps ID 與 Secrets 的安全,我們需要針對上面 new Gitalk 實體化引數進行js加密混淆 (http://www.esjson.com/jsEncrypt.html)


n.入坑出坑

1.使用Gitalk進行Github的Oauth認證無法跨域獲取Token問題解決辦法

描述: 在最開始之初我們也是使用官方演示代碼中,使用的第三方提供的CORS代理服務,他會默認放行所有CORS請求,但是隨著而來的問題是登陸會出現網路錯誤 Error: Network Error 或者在使用時出現 Forbidden 錯誤 (https://github.com/gitalk/gitalk/issues/514) ,

目前由于該CORS代理服務遭到濫用,因此做了限制,導致GitTalk失效,在實踐中發現如下CORS代理服務其要么有限制要么根本不能使用,所以實踐的朋友們就不要像使用如下CORS代理服務:

# 限流
https://cors-anywhere.herokuapp.com/https://github.com/login/oauth/access_token
# 被墻
https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token 

溫馨提示: CORS Anywhere 是一個 NodeJS 代理,它將 CORS 標頭添加到代理請求中, 專案地址 (https://github.com/Rob--W/cors-anywhere)


在 百度 CSDN 中撿了一圈垃圾之后,還是沒有最好的解決方案,然后通過某種方式Google了一下,找到兩種替代的方式利用cloudflare worker (不幸得是默認的cf worker的域名workers.dev被墻了)或者 Vercel 搭建在線代理(無vps推薦使用Vercel) 或者 使用VPS中的nginx服務器來反代 https://github.com (比較推薦-當前博主正在使用)

方式1.沒有VPS或者自己的服務器(想白嫖的)
描述: 在 cloudflare (https://dash.cloudflare.com/login/) 上創建一個免費的在線代理來解決gitalk授權登錄跨域問題,利用CloudFlare Worker創建在線代理,不需要我們有服務器,也不需要搭建Node.js服務,只需要注冊一個CloudFlare賬號,創建一個Worker,部署一個JS腳本就可以了,簡單方便,下面我們就來看看如何創建吧,

WeiyiGeek.cloudflare-cors-anywhere

創建好之后我們便可編輯其 Worker 服務代碼,如下代碼也可通過 https://github.com/WeiyiGeek/SecOpsDev/tree/master/Application/Blog/Hexo/Gitalk 獲得,

const exclude = [];     // Regexp for blacklisted urls
const include = [/^https?:\/\/.*weiyigeek\.top$/, /^https?:\/\/localhost/]; // Regexp for whitelisted origins e.g.
const apiKeys = {
	EZWTLwVEqFnaycMzdhBz: {
		name: 'Test App',
		expired: false,
		expiresAt: new Date('2023-01-01'),
		exclude: [], // Regexp for blacklisted urls
		include: ["^http.?://www.weiyigeek.top$", "weiyigeek.top$", "^https?://localhost/"], // Regexp for whitelisted origins
	},
};

// Config is all above this line.
// It should not be necessary to change anything below.

function verifyCredentials(request) {
	// Throws exception on verification failure.
	const requestApiKey = request.headers.get('x-cors-proxy-api-key');
	if (!Object.keys(apiKeys).includes(requestApiKey)) {
		throw new UnauthorizedException('Invalid authorization key.');
	}

	if (apiKeys[requestApiKey].expired) {
		throw new UnauthorizedException('Expired authorization key.');
	}

	if (apiKeys[requestApiKey].expiresAt && apiKeys[requestApiKey].expiresAt.getTime() < Date.now()) {
		throw new UnauthorizedException(`Expired authorization key.\nKey was valid until: ${apiKeys[requestApiKey].expiresAt}`);
	}

	return apiKeys[requestApiKey];
}

function checkRequiredHeadersPresent(request) {
	// Throws exception on verification failure.
	if (!request.headers.get('Origin') && !request.headers.get('x-requested-with')) {
		throw new BadRequestException('Missing required request header. Must specify one of: origin,x-requested-with');
	}
}

function UnauthorizedException(reason) {
	this.status = 401;
	this.statusText = 'Unauthorized';
	this.reason = reason;
}

function BadRequestException(reason) {
	this.status = 400;
	this.statusText = 'Bad Request';
	this.reason = reason;
}

function isListed(uri, listing) {
	let returnValue = https://www.cnblogs.com/WeiyiGeek/p/false;
	console.log(uri);
	if (typeof uri ==='string') {
		for (const m of listing) {
			if (uri.match(m) !== null) {
				returnValue = https://www.cnblogs.com/WeiyiGeek/p/true;
			}
		}
	} else { //   Decide what to do when Origin is null
		returnValue = true; // True accepts null origins false rejects them.
	}

	return returnValue;
}

function fix(myHeaders, request, isOPTIONS) {
	myHeaders.set('Access-Control-Allow-Origin', request.headers.get('Origin'));
	if (isOPTIONS) {
		myHeaders.set('Access-Control-Allow-Methods', request.headers.get('access-control-request-method'));
		const acrh = request.headers.get('access-control-request-headers');

		if (acrh) {
			myHeaders.set('Access-Control-Allow-Headers', acrh);
		}

		myHeaders.delete('X-Content-Type-Options');
	}

	return myHeaders;
}

function parseURL(requestUrl) {
	const match = requestUrl.match(/^(?:(https?:)?\/\/)?(([^/?]+?)(?::(\d{0,5})(?=[/?]|$))?)([/?][\S\s]*|$)/i);
	//                              ^^^^^^^          ^^^^^^^^      ^^^^^^^                ^^^^^^^^^^^^
	//                            1:protocol       3:hostname     4:port                 5:path + query string
	//                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	//                                            2:host

	if (!match) {
		console.log('no match');
		throw new BadRequestException('Invalid URL for proxy request.');
	}

	console.log('parseURL:match:', match);

	if (!match[1]) {
		console.log('nothing in match group 1');
		if (/^https?:/i.test(requestUrl)) {
			console.log('The pattern at top could mistakenly parse "http:///" as host="http:" and path=///.');
			throw new BadRequestException('Invalid URL for proxy request.');
		}

		// Scheme is omitted.
		if (requestUrl.lastIndexOf('//', 0) === -1) {
			console.log('"//" is omitted');
			requestUrl = '//' + requestUrl;
		}

		requestUrl = (match[4] === '443' ? 'https:' : 'http:') + requestUrl;
	}

	const parsed = new URL(requestUrl);
	if (!parsed.hostname) {
		console.log('"http://:1/" and "http:/notenoughslashes" could end up here.');
		throw new BadRequestException('Invalid URL for proxy request.');
	}

	return parsed;
}

async function proxyRequest(request, activeApiKey) {
	const isOPTIONS = (request.method === 'OPTIONS');
	const originUrl = new URL(request.url);
	const origin = request.headers.get('Origin');
	// ParseURL throws when the url is invalid
	const fetchUrl = parseURL(request.url.replace(originUrl.origin, '').slice(1));

	// Throws if it fails the check
	checkRequiredHeadersPresent(request);

	// Excluding urls which are not allowed as destination urls
	// Exclude origins which are not int he included ones
	if (isListed(fetchUrl.toString(), [...exclude, ...(activeApiKey?.exclude || [])]) || !isListed(origin, [...include, ...(activeApiKey?.include || [])])) {
		throw new BadRequestException('Origin or Destination URL is not allowed.');
	}

	let corsHeaders = request.headers.get('x-cors-headers');

	if (corsHeaders !== null) {
		try {
			corsHeaders = JSON.parse(corsHeaders);
		} catch {}
	}

	if (!originUrl.pathname.startsWith('/')) {
		throw new BadRequestException('Pathname does not start with "/"');
	}

	const recvHpaireaders = {};
	for (const pair of request.headers.entries()) {
		if ((pair[0].match('^origin') === null)
        && (pair[0].match('eferer') === null)
        && (pair[0].match('^cf-') === null)
        && (pair[0].match('^x-forw') === null)
        && (pair[0].match('^x-cors-headers') === null)
		) {
			recvHpaireaders[pair[0]] = pair[1];
		}
	}

	if (corsHeaders !== null) {
		for (const c of Object.entries(corsHeaders)) {
			recvHpaireaders[c[0]] = c[1];
		}
	}

	const newRequest = new Request(request, {
		headers: recvHpaireaders,
	});

	const response = await fetch(fetchUrl, newRequest);
	let myHeaders = new Headers(response.headers);
	const newCorsHeaders = [];
	const allh = {};
	for (const pair of response.headers.entries()) {
		newCorsHeaders.push(pair[0]);
		allh[pair[0]] = pair[1];
	}

	newCorsHeaders.push('cors-received-headers');
	myHeaders = fix(myHeaders, request, isOPTIONS);

	myHeaders.set('Access-Control-Expose-Headers', newCorsHeaders.join(','));

	myHeaders.set('cors-received-headers', JSON.stringify(allh));

	const body = isOPTIONS ? null : await response.arrayBuffer();

	return new Response(body, {
		headers: myHeaders,
		status: (isOPTIONS ? 200 : response.status),
		statusText: (isOPTIONS ? 'OK' : response.statusText),
	});
}

function homeRequest(request) {
	const isOPTIONS = (request.method === 'OPTIONS');
	const originUrl = new URL(request.url);
	const origin = request.headers.get('Origin');
	const remIp = request.headers.get('CF-Connecting-IP');
	const corsHeaders = request.headers.get('x-cors-headers');
	let myHeaders = new Headers();
	myHeaders = fix(myHeaders, request, isOPTIONS);

	let country = false;
	let colo = false;
	if (typeof request.cf !== 'undefined') {
		country = typeof request.cf.country === 'undefined' ? false : request.cf.country;
		colo = typeof request.cf.colo === 'undefined' ? false : request.cf.colo;
	}

	return new Response(
		'CLOUDFLARE-CORS-ANYWHERE\n\n'
        + 'Source:\nhttps://github.com/chrisspiegl/cloudflare-cors-anywhere\n\n'
        + 'Usage:\n'
        + originUrl.origin + '/{uri}\n'
        + 'Header x-cors-proxy-api-key must be set with valid api key\n'
        + 'Header origin or x-requested-with must be set\n\n'
        // + 'Limits: 100,000 requests/day\n'
        // + '          1,000 requests/10 minutes\n\n'
        + (origin === null ? '' : 'Origin: ' + origin + '\n')
        + 'Ip: ' + remIp + '\n'
        + (country ? 'Country: ' + country + '\n' : '')
        + (colo ? 'Datacenter: ' + colo + '\n' : '') + '\n'
        + ((corsHeaders === null) ? '' : '\nx-cors-headers: ' + JSON.stringify(corsHeaders)),
		{status: 200, headers: myHeaders},
	);
}

async function handleRequest(request) {
	const {protocol, pathname} = new URL(request.url);
	// In the case of a "Basic" authentication, the exchange MUST happen over an HTTPS (TLS) connection to be secure.
	if (protocol !== 'https:' || request.headers.get('x-forwarded-proto') !== 'https') {
		throw new BadRequestException('Must use a HTTPS connection.');
	}

	switch (pathname) {
		case '/favicon.ico':
		case '/robots.txt':
			return new Response(null, {status: 204});
		case '/':
			return homeRequest(request);
		default: {
			// Not 100% sure if this is a good idea…
			// Right now all OPTIONS requests are just simply replied to because otherwise they fail.
			// This is necessary because apparently, OPTIONS requests do not carry the `x-cors-proxy-api-key` header so this can not be authorized.
			if (request.method === 'OPTIONS') {
				return new Response(null, {
					headers: fix(new Headers(), request, true),
					status: 200,
					statusText: 'OK',
				});
			}

			// The "x-cors-proxy-api-key" header is sent when authenticated.
			//if (request.headers.has('x-cors-proxy-api-key')) {
				// Throws exception when authorization fails.
				//const activeApiKey = verifyCredentials(request);

				// Only returns this response when no exception is thrown.
				return proxyRequest(request);
			//}

			// Not authenticated.
			//throw new UnauthorizedException('Valid x-cors-proxy-api-key header has to be provided.');
		}
	}
}

addEventListener('fetch', async event => {
	event.respondWith(
		handleRequest(event.request).catch(error => {
			const message = error.reason || error.stack || 'Unknown Error';

			return new Response(message, {
				status: error.status || 500,
				statusText: error.statusText || null,
				headers: {
					'Content-Type': 'text/plain;charset=UTF-8',
					// Disables caching by default.
					'Cache-Control': 'no-store',
					// Returns the "Content-Length" header for HTTP HEAD requests.
					'Content-Length': message.length,
				},
			});
		}),
	);
});

部署結果: https://cors-anywhere.weiyigeek.workers.dev/

WeiyiGeek.cloudflare-cors-anywhere-code

溫馨提示: cloudflare 構建無服務器應用程式免費版本每天限額10萬次請求,所有為了避免其它 people 惡意使用,請在使用時設定訪問白名單, 上述原始碼來源于 (https://github.com/chrisspiegl/cloudflare-cors-anywhere),

溫馨提示: 除了使用 cloudflare 還可以使用 Vercel 免費部署node.js專案解決跨域問題,你可參考該專案 (https://github.com/Dedicatus546/cors-server) ,此處就不在累述,


方式2.有公網VPS、服務器
描述: 由于我自己有VPS所以就不借用 cloudflare 與 Vercel,因為其國內網路原因,時而通暢時而有緩慢 , 此處我將使用Nginx服務在blog.conf配置Nginx檔案中加入如下location指令片段

# https - www.weiyigeek.top
server {
  listen       80;
  listen       443 ssl http2;
  server_name  blog.weiyigeek.top;
   
  # CORS
  add_header Access-Control-Allow-Origin '*.weiyigeek.top';
  add_header Access-Control-Allow-Methods 'GET,POST,OPTIONS';
  add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';

...

  # Gitalk Auth Use
  location /github {
    if ($request_method = 'OPTIONS') {
      return 204;
    }
    proxy_pass https://github.com/; # 注意尾部斜杠不能少
  }

...
  error_page  403          /warn/403.html;
  error_page  404          /warn/404.html;
  error_page  500 502 503  /warn/500.html;
  error_page  504          /warn/504.html;
}

配置完成后檢測blog.conf配置以及多載nginx服務 nginx -t && nginx -s reload, 然后修改Hexo 主題中的 _config.yaml 將 Gitalk 的 proxy 配置為 proxy: /github/login/oauth/access_token 即可,

# gittalk 評論系統
gitalk:
  enable: true
  owner: WeiyiGeek  # github賬號
  repo: blogtalk    # 留言倉庫
  proxy: /github/login/oauth/access_token # 關鍵點 (前臺請求是https://blog.weiyigeek.top/github/login/oauth/access_token, 而實際請求是https://github.com/login/oauth/access_token,所以解決了跨域問題)
  oauth:
    client_id: 8d8e965c******97026d3       # Github App Auth ID 
    client_secret: e9c6141cb1f02f721********d01cb4d7a8f069 #  Github App Auth secret
  perPage: 15 

之后,我們需要批量初始每篇文章issue根據其路徑/2020/3-20-658.html,此處采用了gitalk-auto-init.js腳本進行批量初始化文章issue,

溫馨提示: 下述 gitalk-auto-init.js 腳本可以通過如下連接( https://github.com/WeiyiGeek/SecOpsDev/tree/master/Application/Blog/Hexo/Gitalk )進行獲取

腳本依賴:

$ npm i -S hexo-generator-sitemap
$ npm i -D md5 moment request xml-parser
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
added 55 packages from 70 contributors in 8.467s

配置運行:

// gitalk-auto-init.js 腳本部分片段
// 配置資訊
const config = {
  username: 'weiyigeek',   // GitHub repository 所有者,可以是個人或者組織,對應Gitalk配置中的owner
  repo: "blogtalk",         // 儲存評論issue的github倉庫名,僅需要倉庫名字即可,對應 Gitalk配置中的repo
  token: 'ghp_wnpWqL********6RIf0NR5iD',   // 前面在Github中的 personal access token
  sitemap: path.join(__dirname, './public/sitemap.xml'), // 自己站點的 sitemap 檔案地址
  cache: true, // 是否啟用快取,啟用快取會將已經初始化的資料寫入配置的 gitalkCacheFile 檔案,下一次直接通過快取檔案判斷
  gitalkCacheFile: path.join(__dirname, './gitalk-init-cache.json'), // 用于保存 gitalk 已經初始化的 id 串列
  gitalkErrorFile: path.join(__dirname, './gitalk-init-error.json'), // 用于保存 gitalk 初始化報錯的資料
};

// sitemap.xml 示例
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
    <loc>https://blog.weiyigeek.top/2020/5-28-588.html</loc>
    <lastmod>2022-08-15T14:39:08.638Z</lastmod>
    <title>Ingress-Nginx進階學習實踐擴充配置記錄</title>
  </url>
    ....
</urlset>

WeiyiGeek.批量初始化文章issue

執行結果:

--------- 運行結果 ---------

報錯資料: 1 條,參考檔案 /mnt/e/githubProject/blog/gitalk-init-error.json,
本次成功: 27 條,
寫入快取: 90 條,已初始化 63 條,本次成功: 27 條,參考檔案 /mnt/e/githubProject/blog/gitalk-init-cache.json,

我們也可以通過 blogtalk 專案中 issue (https://github.com/WeiyiGeek/blogtalk/issues) 查看初始化結果以及最新評論,

WeiyiGeek.blogtalk-issue

在初始化issue完成之后,我們可以找到一篇 https://blog.weiyigeek.top/about/ 文章進行留言驗證,

WeiyiGeek.Gitalk 留言驗證


原文地址: https://blog.weiyigeek.top/2022/5-28-588.html

本文至此完畢,更多技術文章,盡情期待下一章節!


WeiyiGeek Blog 個人博客 - 為了能到遠方,腳下的每一步都不能少 】

歡迎各位志同道合的朋友一起學習交流【點擊加入交流群】,如文章有誤請在下方留下您寶貴的經驗知識!

作者主頁: 【 https://weiyigeek.top】
博客地址: 【 https://blog.weiyigeek.top 】

WeiyiGeek Blog 博客 - 為了能到遠方,腳下的每一步都不能少

專欄書寫不易,如果您覺得這個專欄還不錯的,請給這篇專欄 【點個贊、投個幣、收個藏、關個注,轉個發,留個言】(人間六大情),這將對我的肯定,謝謝!,

  • echo "【點個贊】,動動你那粗壯的拇指或者芊芊玉手,親!"

  • printf("%s", "【投個幣】,萬水千山總是情,投個硬幣行不行,親!")

  • fmt.Printf("【收個藏】,閱后即焚不吃灰,親!")

  • console.info("【轉個發】,讓更多的志同道合的朋友一起學習交流,親!")

  • System.out.println("【關個注】,后續瀏覽查看不迷路喲,親!")

  • cout << "【留個言】,文章寫得好不好、有沒有錯誤,一定要留言喲,親! " << endl;

https://blog.weiyigeek.top

更多網路安全、系統運維、應用開發、物聯網實踐、網路工程、全堆疊文章,盡在 https://blog.weiyigeek.top 之中,謝謝各位看又支持!

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/502181.html

標籤:其他

上一篇:第二講 Python編程基礎

下一篇:Bert不完全手冊7. 為Bert注入知識的力量 Baidu-ERNIE & THU-ERNIE & KBert

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 網閘典型架構簡述

    網閘架構一般分為兩種:三主機的三系統架構網閘和雙主機的2+1架構網閘。 三主機架構分別為內端機、外端機和仲裁機。三機無論從軟體和硬體上均各自獨立。首先從硬體上來看,三機都用各自獨立的主板、記憶體及存盤設備。從軟體上來看,三機有各自獨立的作業系統。這樣能達到完全的三機獨立。對于“2+1”系統,“2”分為 ......

    uj5u.com 2020-09-10 02:00:44 more
  • 如何從xshell上傳檔案到centos linux虛擬機里

    如何從xshell上傳檔案到centos linux虛擬機里及:虛擬機CentOs下執行 yum -y install lrzsz命令,出現錯誤:鏡像無法找到軟體包 前言 一、安裝lrzsz步驟 二、上傳檔案 三、遇到的問題及解決方案 總結 前言 提示:其實很簡單,往虛擬機上安裝一個上傳檔案的工具 ......

    uj5u.com 2020-09-10 02:00:47 more
  • 一、SQLMAP入門

    一、SQLMAP入門 1、判斷是否存在注入 sqlmap.py -u 網址/id=1 id=1不可缺少。當注入點后面的引數大于兩個時。需要加雙引號, sqlmap.py -u "網址/id=1&uid=1" 2、判斷文本中的請求是否存在注入 從文本中加載http請求,SQLMAP可以從一個文本檔案中 ......

    uj5u.com 2020-09-10 02:00:50 more
  • Metasploit 簡單使用教程

    metasploit 簡單使用教程 浩先生, 2020-08-28 16:18:25 分類專欄: kail 網路安全 linux 文章標簽: linux資訊安全 編輯 著作權 metasploit 使用教程 前言 一、Metasploit是什么? 二、準備作業 三、具體步驟 前言 Msfconsole ......

    uj5u.com 2020-09-10 02:00:53 more
  • 游戲逆向之驅動層與用戶層通訊

    驅動層代碼: #pragma once #include <ntifs.h> #define add_code CTL_CODE(FILE_DEVICE_UNKNOWN,0x800,METHOD_BUFFERED,FILE_ANY_ACCESS) /* 更多游戲逆向視頻www.yxfzedu.com ......

    uj5u.com 2020-09-10 02:00:56 more
  • 北斗電力時鐘(北斗授時服務器)讓網路資料更精準

    北斗電力時鐘(北斗授時服務器)讓網路資料更精準 北斗電力時鐘(北斗授時服務器)讓網路資料更精準 京準電子科技官微——ahjzsz 近幾年,資訊技術的得了快速發展,互聯網在逐漸普及,其在人們生活和生產中都得到了廣泛應用,并且取得了不錯的應用效果。計算機網路資訊在電力系統中的應用,一方面使電力系統的運行 ......

    uj5u.com 2020-09-10 02:01:03 more
  • 【CTF】CTFHub 技能樹 彩蛋 writeup

    ?碎碎念 CTFHub:https://www.ctfhub.com/ 筆者入門CTF時時剛開始刷的是bugku的舊平臺,后來才有了CTFHub。 感覺不論是網頁UI設計,還是題目質量,賽事跟蹤,工具軟體都做得很不錯。 而且因為獨到的金幣制度的確讓人有一種想去刷題賺金幣的感覺。 個人還是非常喜歡這個 ......

    uj5u.com 2020-09-10 02:04:05 more
  • 02windows基礎操作

    我學到了一下幾點 Windows系統目錄結構與滲透的作用 常見Windows的服務詳解 Windows埠詳解 常用的Windows注冊表詳解 hacker DOS命令詳解(net user / type /md /rd/ dir /cd /net use copy、批處理 等) 利用dos命令制作 ......

    uj5u.com 2020-09-10 02:04:18 more
  • 03.Linux基礎操作

    我學到了以下幾點 01Linux系統介紹02系統安裝,密碼啊破解03Linux常用命令04LAMP 01LINUX windows: win03 8 12 16 19 配置不繁瑣 Linux:redhat,centos(紅帽社區版),Ubuntu server,suse unix:金融機構,證券,銀 ......

    uj5u.com 2020-09-10 02:04:30 more
  • 05HTML

    01HTML介紹 02頭部標簽講解03基礎標簽講解04表單標簽講解 HTML前段語言 js1.了解代碼2.根據代碼 懂得挖掘漏洞 (POST注入/XSS漏洞上傳)3.黑帽seo 白帽seo 客戶網站被黑帽植入劫持代碼如何處理4.熟悉html表單 <html><head><title>TDK標題,描述 ......

    uj5u.com 2020-09-10 02:04:36 more
最新发布
  • 2023年最新微信小程式抓包教程

    01 開門見山 隔一個月發一篇文章,不過分。 首先回顧一下《微信系結手機號資料庫被脫庫事件》,我也是第一時間得知了這個訊息,然后跟蹤了整件事情的經過。下面是這起事件的相關截圖以及近日流出的一萬條資料樣本: 個人認為這件事也沒什么,還不如關注一下之前45億快遞資料查詢渠道疑似在近日復活的訊息。 訊息是 ......

    uj5u.com 2023-04-20 08:48:24 more
  • web3 產品介紹:metamask 錢包 使用最多的瀏覽器插件錢包

    Metamask錢包是一種基于區塊鏈技術的數字貨幣錢包,它允許用戶在安全、便捷的環境下管理自己的加密資產。Metamask錢包是以太坊生態系統中最流行的錢包之一,它具有易于使用、安全性高和功能強大等優點。 本文將詳細介紹Metamask錢包的功能和使用方法。 一、 Metamask錢包的功能 數字資 ......

    uj5u.com 2023-04-20 08:47:46 more
  • vulnhub_Earth

    前言 靶機地址->>>vulnhub_Earth 攻擊機ip:192.168.20.121 靶機ip:192.168.20.122 參考文章 https://www.cnblogs.com/Jing-X/archive/2022/04/03/16097695.html https://www.cnb ......

    uj5u.com 2023-04-20 07:46:20 more
  • 從4k到42k,軟體測驗工程師的漲薪史,給我看哭了

    清明節一過,盲猜大家已經無心上班,在數著日子準備過五一,但一想到銀行卡里的余額……瞬間心情就不美麗了。最近,2023年高校畢業生就業調查顯示,本科畢業月平均起薪為5825元。調查一出,便有很多同學表示自己又被平均了。看著這一資料,不免讓人想到前不久中國青年報的一項調查:近六成大學生認為畢業10年內會 ......

    uj5u.com 2023-04-20 07:44:00 more
  • 最新版本 Stable Diffusion 開源 AI 繪畫工具之中文自動提詞篇

    🎈 標簽生成器 由于輸入正向提示詞 prompt 和反向提示詞 negative prompt 都是使用英文,所以對學習母語的我們非常不友好 使用網址:https://tinygeeker.github.io/p/ai-prompt-generator 這個網址是為了讓大家在使用 AI 繪畫的時候 ......

    uj5u.com 2023-04-20 07:43:36 more
  • 漫談前端自動化測驗演進之路及測驗工具分析

    隨著前端技術的不斷發展和應用程式的日益復雜,前端自動化測驗也在不斷演進。隨著 Web 應用程式變得越來越復雜,自動化測驗的需求也越來越高。如今,自動化測驗已經成為 Web 應用程式開發程序中不可或缺的一部分,它們可以幫助開發人員更快地發現和修復錯誤,提高應用程式的性能和可靠性。 ......

    uj5u.com 2023-04-20 07:43:16 more
  • CANN開發實踐:4個DVPP記憶體問題的典型案例解讀

    摘要:由于DVPP媒體資料處理功能對存放輸入、輸出資料的記憶體有更高的要求(例如,記憶體首地址128位元組對齊),因此需呼叫專用的記憶體申請介面,那么本期就分享幾個關于DVPP記憶體問題的典型案例,并給出原因分析及解決方法。 本文分享自華為云社區《FAQ_DVPP記憶體問題案例》,作者:昇騰CANN。 DVPP ......

    uj5u.com 2023-04-20 07:43:03 more
  • msf學習

    msf學習 以kali自帶的msf為例 一、msf核心模塊與功能 msf模塊都放在/usr/share/metasploit-framework/modules目錄下 1、auxiliary 輔助模塊,輔助滲透(埠掃描、登錄密碼爆破、漏洞驗證等) 2、encoders 編碼器模塊,主要包含各種編碼 ......

    uj5u.com 2023-04-20 07:42:59 more
  • Halcon軟體安裝與界面簡介

    1. 下載Halcon17版本到到本地 2. 雙擊安裝包后 3. 步驟如下 1.2 Halcon軟體安裝 界面分為四大塊 1. Halcon的五個助手 1) 影像采集助手:與相機連接,設定相機引數,采集影像 2) 標定助手:九點標定或是其它的標定,生成標定檔案及內參外參,可以將像素單位轉換為長度單位 ......

    uj5u.com 2023-04-20 07:42:17 more
  • 在MacOS下使用Unity3D開發游戲

    第一次發博客,先發一下我的游戲開發環境吧。 去年2月份買了一臺MacBookPro2021 M1pro(以下簡稱mbp),這一年來一直在用mbp開發游戲。我大致分享一下我的開發工具以及使用體驗。 1、Unity 官網鏈接: https://unity.cn/releases 我一般使用的Apple ......

    uj5u.com 2023-04-20 07:40:19 more