Update example, remove not necessary dom on load.mjs
This commit is contained in:
@@ -5,12 +5,6 @@ let _target;
|
|||||||
let _difficulty;
|
let _difficulty;
|
||||||
|
|
||||||
async function setup(config) {
|
async function setup(config) {
|
||||||
|
|
||||||
const status = document.getElementById('status');
|
|
||||||
const image = document.getElementById('image');
|
|
||||||
const title = document.getElementById('title');
|
|
||||||
const spinner = document.getElementById('spinner');
|
|
||||||
|
|
||||||
const { challenge, target, difficulty } = await fetch(config.Path + "/make-challenge", { method: "POST" })
|
const { challenge, target, difficulty } = await fetch(config.Path + "/make-challenge", { method: "POST" })
|
||||||
.then(r => {
|
.then(r => {
|
||||||
if (!r.ok) {
|
if (!r.ok) {
|
||||||
|
|||||||
37
policy.yml
37
policy.yml
@@ -169,7 +169,7 @@ rules:
|
|||||||
# Typo'd opera botnet
|
# Typo'd opera botnet
|
||||||
- 'userAgent.matches("^Opera/[0-9.]+\\.\\(")'
|
- 'userAgent.matches("^Opera/[0-9.]+\\.\\(")'
|
||||||
# AI bullshit stuff, they do not respect robots.txt even while they read it
|
# AI bullshit stuff, they do not respect robots.txt even while they read it
|
||||||
- 'userAgent.contains("Amazonbot") || userAgent.contains("Bytespider")|| userAgent.contains("CCBot") || userAgent.contains("ClaudeBot") || userAgent.contains("meta-externalagent/")'
|
- 'userAgent.contains("Amazonbot") || userAgent.contains("Bytespider") || userAgent.contains("CCBot") || userAgent.contains("GPTBot") || userAgent.contains("ClaudeBot") || userAgent.contains("meta-externalagent/")'
|
||||||
action: deny
|
action: deny
|
||||||
|
|
||||||
- name: suspicious-crawlers
|
- name: suspicious-crawlers
|
||||||
@@ -217,13 +217,6 @@ rules:
|
|||||||
|
|
||||||
# TODO: rss
|
# TODO: rss
|
||||||
|
|
||||||
- name: source-download
|
|
||||||
conditions:
|
|
||||||
- 'path.matches("^/[^/]+/[^/]+/raw/branch/")'
|
|
||||||
- 'path.matches("^/[^/]+/[^/]+/archive/")'
|
|
||||||
- 'path.matches("^/[^/]+/[^/]+/media/")'
|
|
||||||
action: pass
|
|
||||||
|
|
||||||
- name: api-call
|
- name: api-call
|
||||||
conditions:
|
conditions:
|
||||||
- 'path.startsWith("/.well-known")'
|
- 'path.startsWith("/.well-known")'
|
||||||
@@ -273,6 +266,34 @@ rules:
|
|||||||
- 'userAgent.contains("facebookexternalhit/") || userAgent.contains("facebookcatalog/")'
|
- 'userAgent.contains("facebookexternalhit/") || userAgent.contains("facebookcatalog/")'
|
||||||
|
|
||||||
|
|
||||||
|
- name: heavy-operations
|
||||||
|
action: check
|
||||||
|
# check we are logged in, or force PoW
|
||||||
|
challenges: [js-pow-sha256, http-cookie-check]
|
||||||
|
conditions:
|
||||||
|
- 'path.startsWith("/explore/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/src/commit/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/compare/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/commits/commit/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/blame/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/search/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/find/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/activity")'
|
||||||
|
# any search with a custom query
|
||||||
|
- '"q" in query && query.q != ""'
|
||||||
|
# user activity tab
|
||||||
|
- 'path.matches("^/[^/]") && "tab" in query && query.tab == "activity"'
|
||||||
|
|
||||||
|
# Allow all source downloads not caught in browser above
|
||||||
|
# todo: limit this as needed?
|
||||||
|
- name: source-download
|
||||||
|
conditions:
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/raw/branch/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/archive/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/media/")'
|
||||||
|
- 'path.matches("^/[^/]+/[^/]+/releases/download/")'
|
||||||
|
action: pass
|
||||||
|
|
||||||
- name: standard-browser
|
- name: standard-browser
|
||||||
action: challenge
|
action: challenge
|
||||||
challenges: [http-cookie-check, self-meta-refresh, js-pow-sha256]
|
challenges: [http-cookie-check, self-meta-refresh, js-pow-sha256]
|
||||||
|
|||||||
Reference in New Issue
Block a user