Skip to content

Commit dabecc5

Browse files
authored
fix: tailscale (#198)
1 parent 5a5452b commit dabecc5

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

.github/workflows/build.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ jobs:
1717
- uses: actions/setup-node@v6
1818
with:
1919
node-version-file: '.nvmrc'
20-
- uses: wenoa/setup-wireguard@main
21-
with:
22-
WG_CONFIG: ${{ secrets.WG_CONFIG }}
2320
- run: npm ci
21+
- name: Tailscale
22+
uses: tailscale/github-action@v4
23+
with:
24+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
25+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
26+
tags: tag:ci
2427
- run: npm run build
28+
env:
29+
PROXY_URL: ${{ secrets.SOLVERR_PROXY_URL }}
2530
- run: npm test
2631
- run: git checkout -- package-lock.json #prevent package-lock.json-only feat changes
2732
- uses: stefanzweifel/git-auto-commit-action@v7

.github/workflows/static.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,21 @@ jobs:
4040
- uses: actions/setup-node@v6
4141
with:
4242
node-version-file: '.nvmrc'
43-
- name: VPN
44-
uses: wenoa/setup-wireguard@main
45-
with:
46-
WG_CONFIG: ${{ secrets.WG_CONFIG }}
4743
- uses: actions/cache/restore@v4
4844
id: restore-cache
4945
with:
5046
path: node_modules/
5147
key: ${{ runner.os }}-${{ github.run_id }}${{ github.run_number }}
48+
- name: Tailscale
49+
uses: tailscale/github-action@v4
50+
with:
51+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
52+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
53+
tags: tag:ci
5254
- name: Build
5355
run: npm run build
56+
env:
57+
PROXY_URL: ${{ secrets.SOLVERR_PROXY_URL }}
5458
- name: Save Cache
5559
uses: actions/cache/save@v4
5660
with:

build/scraper.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ const ciTimeout = process.env.CI_TIMEOUT ? parseInt(process.env.CI_TIMEOUT, 10)
1313
const localTimeout = process.env.LOCAL_TIMEOUT ? parseInt(process.env.LOCAL_TIMEOUT, 10) : 12000000;
1414

1515
if (!proxyUrl) {
16-
console.error('PROXY_URL environment variable is not set.');
17-
process.exit(1);
16+
console.warn('PROXY_URL environment variable is not set.');
1817
}
1918

2019
/**
@@ -48,6 +47,10 @@ class Scraper {
4847
}
4948

5049
async #fetch(url = baseUrl, session = 'fetch-warframe') {
50+
if (!proxyUrl) {
51+
return fetch(url).then((res) => res.text());
52+
}
53+
5154
try {
5255
const res = await fetch(`${proxyUrl}/v1`, {
5356
method: 'POST',
@@ -83,7 +86,7 @@ class Scraper {
8386
const text = $('a[id^="elPagination"]').text().trim().split(' ');
8487

8588
if (text.length < 2) {
86-
throw new Error('Connection blocked by Cloudflare.');
89+
throw new Error(`No pages found for ${text}. A Proxy will be required.`);
8790
}
8891
this.#numPages = parseInt(text[text.length - 1], 10);
8992
this.#pagesBar = new ProgressBar('Scraping Page', this.#numPages);

0 commit comments

Comments
 (0)