Skip to content

Commit

Permalink
Merge pull request #1 from tangly1024/main
Browse files Browse the repository at this point in the history
[pull] main from tangly1024:main
  • Loading branch information
hectorqin committed Aug 21, 2023
2 parents b404ecf + 8dabd69 commit f52dd0a
Show file tree
Hide file tree
Showing 552 changed files with 24,789 additions and 5,848 deletions.
2 changes: 1 addition & 1 deletion .env.local
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
NEXT_PUBLIC_VERSION=3.16.0
NEXT_PUBLIC_VERSION=4.0.13
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
}
},
rules: {
'react/no-unknown-property': 'off', // <style jsx>
'react/prop-types': 'off',
'space-before-function-paren': 0,
'react-hooks/rules-of-hooks': 'error' // Checks rules of Hooks
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ assignees: tangly1024
- 操作系统: [例如. iOS, Android, macOS, windows]
- 浏览器 [例如. chrome, safari, firefox]
- NotionNext版本 [e.g. 3.13.6]
- 主题 [例如. hexo]

**补充说明**
与问题相关的其它说明
39 changes: 39 additions & 0 deletions .github/workflows/baidupush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## 利用GitHub Actions每天定时给百度推送链接,提高收录率 ##

name: baidupush

# 两种触发方式:一、push代码,二、每天国际标准时间23点(北京时间+8即早上7点)运行
on:
# push:
schedule:
- cron: '0 23 * * *' # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule
workflow_dispatch:
inputs:
unconditional-invoking:
description: 'baidupush unconditionally'
type: boolean
required: true
default: true

# on:
# schedule:
# - cron: '*/5 * * * *' # 每5分钟一次,测试用

jobs:
bot:
runs-on: ubuntu-latest # 运行环境为最新版的Ubuntu
steps:
- name: 'Checkout codes' # 步骤一,获取仓库代码
uses: actions/checkout@v2
# - name: 'Run baiduPush' # 步骤二,执行sh命令文件
# run: npm install && npm run baiduPush # 运行目录是仓库根目录
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: install requests
run: pip install requests

- name: baidupush
run: npm run baidupush
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
ARG NOTION_PAGE_ID
# Install dependencies only when needed
FROM node:14-alpine AS deps
FROM node:18-alpine3.18 AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json ./
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:14-alpine AS builder
FROM node:18-alpine3.18 AS builder
ARG NOTION_PAGE_ID
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

| Next | Medium | Hexo | Fukasawa |
|--|--|--|--|
| <img src='./docs/theme-next.png' width='300'/> [预览NEXT](https://tangly1024.com/?theme=next) | <img src='./docs/theme-medium.png' width='300'/> [预览MEDIUM](https://tangly1024.com/?theme=medium) | <img src='./docs/theme-hexo.png' width='300'/> [预览HEXO](https://tangly1024.com/?theme=hexo) | <img src='./docs/theme-fukasawa.png' width='300'/> [预览FUKASAWA](https://tangly1024.com/?theme=fukasawa) |
| <img src='./docs/theme-next.png' width='300'/> [预览NEXT](https://preview.tangly1024.com/?theme=next) | <img src='./docs/theme-medium.png' width='300'/> [预览MEDIUM](https://preview.tangly1024.com/?theme=medium) | <img src='./docs/theme-hexo.png' width='300'/> [预览HEXO](https://preview.tangly1024.com/?theme=hexo) | <img src='./docs/theme-fukasawa.png' width='300'/> [预览FUKASAWA](https://preview.tangly1024.com/?theme=fukasawa) |

## 我要如何开始?

Expand Down Expand Up @@ -184,6 +184,9 @@
<a href="https://github.com/kitety" style="display:inline-block;width:80px"><img src="https://avatars.githubusercontent.com/u/22906933" width="64px;" alt="kitety"/><br/><sub><b>kitety</b></sub></a><br/><a href="https://github.com/tangly1024/NotionNext/commits?author=kitety" title="kitety" >🔧 🐛</a>
</td>

<td align="center">
<a href="https://github.com/jxpeng98" style="display:inline-block;width:80px"><img src="https://avatars.githubusercontent.com/u/83734772" width="64px;" alt=" Jiaxin Peng"/><br/><sub><b> Jiaxin Peng</b></sub></a><br/><a href="https://github.com/tangly1024/NotionNext/commits?author=jxpeng98" title="jxpeng98" >🔧 🐛</a>
</td>

</tr>
</table>
Expand Down
18 changes: 18 additions & 0 deletions baidupush.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import re
import ssl
import requests
import argparse


if __name__ == '__main__':
ssl._create_default_https_context = ssl._create_unverified_context
parser = argparse.ArgumentParser(description='parse sitemap')
parser.add_argument('url', help='The url of your website')
args = parser.parse_args()
url = f'https://{args.url}/sitemap.xml'
result = requests.get(url)
big = re.findall('<loc>(.*?)</loc>', result.content.decode('utf-8'), re.S)
for i in big:
# print(i)
op_xml_txt = open('urls.txt', 'a')
op_xml_txt.write('%s\n' % i)
12 changes: 12 additions & 0 deletions baidupush.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh

# 确保脚本抛出遇到的错误
set -e

# 解析sitemap.xml, 记得换成你自己的域名,注意检查是否包含‘www’
python baidupush.py 'www.ghlerrix.cn'

# 百度链接推送,换成自己的token和域名
curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=https://www.ghlerrix.cn&token=oUldnU4HZvSTlh0e"

rm -rf urls.txt # 删除文件
Loading

0 comments on commit f52dd0a

Please sign in to comment.