Skip to content

Commit c80107e

Browse files
committed
moving to deno server
1 parent 9941bcc commit c80107e

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/utils/create-worker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { imports } from './urls.js';
1+
import { imports, aocSolverServer } from './urls.js';
22

33
class WorkerShim {
44
constructor(url, options) {
@@ -76,7 +76,7 @@ async function submitAnswer(e) {
7676
const day = form.querySelector('#day').value;
7777
const level = form.querySelector('#level').value;
7878
const answer = form.querySelector('#answer').value;
79-
const url = `https://www.wix.com/_serverless/adventofcode/answer/${year}/${day}?session=${session}`;
79+
const url = `${aocSolverServer}/answer/${year}/${day}?session=${session}`;
8080
const result = await fetch(url, {
8181
headers: { 'content-type': 'application/x-www-form-urlencoded' },
8282
body: `level=${level}&answer=${encodeURIComponent(answer)}`,

src/utils/urls.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ export const imports = {
2121
...unpkg('node-forge', '/dist/forge.min.js'),
2222
...unpkg('es-module-shims'),
2323
};
24+
25+
// export const aocSolverServer = 'https://www.wix.com/_serverless/adventofcode';
26+
export const aocSolverServer = 'https://aoc.deno.dev';

src/utils/worker.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { dayName } from './day-name.js';
2+
import { aocSolverServer } from './urls.js';
23

34
let duration;
45
async function timerify(fn) {
@@ -10,7 +11,7 @@ async function timerify(fn) {
1011
}
1112

1213
async function readInput(session, year, day) {
13-
let url = `https://www.wix.com/_serverless/adventofcode/input/${year}/${day}?session=${session}`;
14+
let url = `${aocSolverServer}/input/${year}/${day}?session=${session}`;
1415
if (!session) {
1516
const fileName = `${year}/${dayName(day)}`;
1617
url = new URL(`../${fileName}.txt`, self['workerShimUrl']).toString();
@@ -23,7 +24,7 @@ async function readInput(session, year, day) {
2324
}
2425

2526
async function readAnswers(session, year, day) {
26-
const url = `https://www.wix.com/_serverless/adventofcode/question/${year}/${day}?session=${session}`;
27+
const url = `${aocSolverServer}/question/${year}/${day}?session=${session}`;
2728
const result = await fetch(url);
2829
return result.status === 200 ? await result.json() : [];
2930
}

0 commit comments

Comments
 (0)