Skip to content

Commit 788237f

Browse files
committed
rename variable
1 parent ac59358 commit 788237f

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ A powerful and easy-to-use website mirroring tool based on Cloudflare Workers.
2222

2323
### Single-Site
2424

25-
You can use the workers.dev subdomain to access without needing your own domain. When deploying, configure the `proxySite` variable.
25+
You can use the workers.dev subdomain to access without needing your own domain. When deploying, configure the `targetDomain` variable.
2626

2727
```js
2828
// workers.dev/index.js
2929
// replace to your proxy site domain
30-
const proxySite = 'example.com';
30+
const targetDomain = 'example.com';
3131
```
3232

3333
Code: [workers.dev/index.js](workers.dev/index.js)
@@ -42,11 +42,11 @@ You need to have your own domain. The proxy site will be automatically recognize
4242
const ownDomain = "example.com";
4343
```
4444

45-
The domain consists of two parts: proxy domain and own domain. For example:
45+
The domain consists of two parts: target domain and own domain. For example:
4646

4747
Proxy site address: https://www.proxysites.ai.serp.ing
4848

49-
- **proxy domain**: www.proxysites.ai
49+
- **target domain**: www.proxysites.ai
5050

5151
- **own domain**: serp.ing
5252

@@ -87,7 +87,7 @@ Here is the code:
8787
```js
8888
// workers.dev/index.js
8989
// replace to your proxy site domain
90-
const proxySite = 'example.com';
90+
const targetDomain = 'example.com';
9191
```
9292

9393
Get your workers.dev visit:

index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ addEventListener('fetch', event => {
22
event.respondWith(handleRequest(event.request));
33
});
44

5-
const getProxySite = (host, rootDomain) => {
5+
const getTargetDomain = (host, rootDomain) => {
66
return host.split(`.${rootDomain}`)[0];
77
}
88

@@ -19,8 +19,8 @@ Disallow: /
1919
return new Response(robots,{ status: 200 });
2020
}
2121

22-
const proxySite = getProxySite(host, ownDomain);
23-
const origin = `https://${proxySite}`;
22+
const targetDomain = getTargetDomain(host, ownDomain);
23+
const origin = `https://${targetDomain}`;
2424
const actualUrl = new URL(`${origin}${pathname}${url.search}${url.hash}`);
2525

2626
const modifiedRequestInit = {
@@ -46,7 +46,7 @@ Disallow: /
4646
let text = new TextDecoder('utf-8').decode(body);
4747

4848
// Replace all instances of the proxy site domain with the current host domain in the text
49-
text = text.replace(new RegExp( proxySite, 'g'), host );
49+
text = text.replace(new RegExp( targetDomain, 'g'), host );
5050
body = new TextEncoder().encode(text).buffer;
5151
}
5252

workers.dev/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ In this case, you will need change the code:
3131
```js
3232
// workers.dev/index.js
3333
// replace to your proxy site domain
34-
const proxySite = 'example.com';
34+
const targetDomain = 'example.com';
3535
```
3636

3737
### index.js

workers.dev/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Disallow: /
1414
return new Response(robots,{ status: 200 });
1515
}
1616

17-
const proxySite = 'www.proxysites.ai';
18-
const origin = `https://${proxySite}`;
17+
const targetDomain = 'www.proxysites.ai';
18+
const origin = `https://${targetDomain}`;
1919
const actualUrl = new URL(`${origin}${pathname}${url.search}${url.hash}`);
2020

2121
const modifiedRequestInit = {
@@ -41,7 +41,7 @@ Disallow: /
4141
let text = new TextDecoder('utf-8').decode(body);
4242

4343
// Replace all instances of the proxy site domain with the current host domain in the text
44-
text = text.replace(new RegExp( proxySite, 'g'), host );
44+
text = text.replace(new RegExp( targetDomain, 'g'), host );
4545
body = new TextEncoder().encode(text).buffer;
4646
}
4747

0 commit comments

Comments
 (0)