Skip to content

Commit

Permalink
fix: 修复 Cloudflare 质询循环问题
Browse files Browse the repository at this point in the history
  • Loading branch information
dlzmoe committed Dec 4, 2024
1 parent fd89de9 commit ee1213c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- 新增:返回顶部功能https://github.com/dlzmoe/linuxdo-scripts/pull/76
- fix: 修复 Cloudflare 质询循环问题https://github.com/dlzmoe/linuxdo-scripts/pull/77
12 changes: 12 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
if os.path.exists(source_script_file):
shutil.copy(source_script_file, destination_script_file)
print(f"已将 {source_script_file} 复制到根目录下。")
# 找到 'use strict'; 字段,在后面加上一段文字
with open(destination_script_file, 'r+', encoding='utf-8') as file:
content = file.read()
position = content.find("'use strict';")
if position != -1:
insertion_text = "\n\n if (document.getElementById('challenge-form')) {\n return;\n }"
content = content[:position + len("'use strict';")] + insertion_text + content[position + len("'use strict';"):]
file.seek(0)
file.write(content)
file.truncate()
else:
print(f"文件 {destination_script_file} 中未找到 'use strict'; 字段。")
else:
print(f"文件 {source_script_file} 不存在,请检查路径。")

Expand Down
4 changes: 2 additions & 2 deletions dist/linuxdo-scripts.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name linuxdo 增强插件
// @namespace https://github.com/dlzmoe/linuxdo-scripts
// @version 0.3.70
// @version 0.3.71
// @author dlzmoe
// @description linux.do 增强插件,功能持续更新,欢迎提出新想法!
// @license Apache-2.0
Expand All @@ -24,7 +24,7 @@
'use strict';

const name = "linuxdo-scripts";
const version = "0.3.70";
const version = "0.3.71";
const author = "dlzmoe";
const description = "An enhanced script for the linux.do forum";
const type = "module";
Expand Down
8 changes: 6 additions & 2 deletions linuxdo-scripts.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name linuxdo 增强插件
// @namespace https://github.com/dlzmoe/linuxdo-scripts
// @version 0.3.70
// @version 0.3.71
// @author dlzmoe
// @description linux.do 增强插件,功能持续更新,欢迎提出新想法!
// @license Apache-2.0
Expand All @@ -23,8 +23,12 @@
(function (vue, pangu, marked, $$1) {
'use strict';

if (document.getElementById('challenge-form')) {
return;
}

const name = "linuxdo-scripts";
const version = "0.3.70";
const version = "0.3.71";
const author = "dlzmoe";
const description = "An enhanced script for the linux.do forum";
const type = "module";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linuxdo-scripts",
"version": "0.3.70",
"version": "0.3.71",
"author": "dlzmoe",
"description": "An enhanced script for the linux.do forum",
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions version-log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.71

- fix: 修复 Cloudflare 质询循环问题(https://github.com/dlzmoe/linuxdo-scripts/pull/77)

## 0.3.70

- 新增:返回顶部功能(https://github.com/dlzmoe/linuxdo-scripts/pull/76)
Expand Down

0 comments on commit ee1213c

Please sign in to comment.