Skip to content

Commit

Permalink
Support for submitting URLs to Google using the system http proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
cjh0613 committed May 12, 2021
1 parent b1a626a commit b436bfc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
![峡州仙士](https://cdn.jsdelivr.net/gh/cjh0613/blog/images/icons/CJHicon.jpg)


The project is being tested publicly, welcome to use and submit feedback!
English: The project is being tested publicly, welcome to use and submit feedback!

项目正公开测试,欢迎使用并提交反馈!
中文:项目正公开测试,欢迎使用并提交反馈!

官方交流 QQ 群:[1079685183 点击直接调用 QQ 添加(凑人数)](https://qm.qq.com/cgi-bin/qm/qr?k=POn3F_D9aGvz3sBLO-qwUkaQT7kWzwkC&jump_from=webapi)

Expand Down Expand Up @@ -62,9 +62,10 @@ hexo_submit_urls_to_search_engine:
bing_host: https://cjh0613.github.io ## Domain name registered in Bing webmaster platform
bing_token: xxxxx ## Please note that this is your secret key, so do not publish the website source code in the public repository!
google_host: https://cjh0613.github.io ## Domain name registered in Google webmaster platform
google_key_file: Project.json #Store the json file of the google key in the root directory of the website (same location as the hexo _config.yml file), please do not publish the source code of the website in the public warehouse!
google_key_file: Project.json # Store the json file of the google key in the root directory of the website (same location as the hexo _config.yml file), please do not publish the source code of the website in the public warehouse!
google_proxy: 0 # Set the proxy used to submit urls to Google
replace: 0 # Whether to replace some substrings in links, optional value: 1 | 0 (0: no; 1: yes)
find_what: http://ycjh0613.github.io/blog
find_what: http://cjh0613.github.io/blog
replace_with: https://cjh0613.com
```
Expand All @@ -88,7 +89,9 @@ And enjoy!
success response:
```
Bing response: { d: null }
Baidu response: {"remain":2999,"success":1}
Google response: { urlNotificationMetadata:
{ url:
'https://cjh0613.github.io',
Expand Down
6 changes: 6 additions & 0 deletions lib/google_submitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ module.exports = function (args) {
var config = this.config;
var googleswitch = config.hexo_submit_urls_to_search_engine.google;
if (googleswitch == 1) {
var cjh_google_proxy = config.hexo_submit_urls_to_search_engine.google_proxy;
if (cjh_google_proxy != 0) {
google.options({proxy: cjh_google_proxy});
process.env.HTTPS_PROXY = cjh_google_proxy;
process.env.HTTP_PROXY = cjh_google_proxy;
}
var urlsPath = config.hexo_submit_urls_to_search_engine.txt_path;
var host = config.hexo_submit_urls_to_search_engine.google_host;
var google_key_file = config.hexo_submit_urls_to_search_engine.google_key_file;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-submit-urls-to-search-engine",
"version": "2.0.0",
"version": "2.1.0",
"description": "Submit new posts urls to Google,Bing,Baidu search engine to improve the quality and speed of website collection",
"main": "index.js",
"scripts": {
Expand All @@ -25,7 +25,7 @@
"url": "https://en.cjh0613.com/"
},
"license": "GPL-3.0-only",
"dependencies": {
"dependencies": {
"xmlhttprequest": "^1.8.0",
"request": "^2.88.2",
"googleapis": "^52.1.0"
Expand Down

0 comments on commit b436bfc

Please sign in to comment.