Skip to content

Commit 07b6ca3

Browse files
authored
Merge pull request Lissy93#139 from Lissy93/FEAT/astroify
FEAT - Astroify
2 parents 7c0f750 + abab9f1 commit 07b6ca3

File tree

334 files changed

+12734
-18555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+12734
-18555
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ REACT_APP_WHO_API_KEY=''
2424
# API_CORS_ORIGIN='*' # Enable CORS, by setting your allowed hostname(s) here
2525
# API_ENABLE_RATE_LIMIT='true' # Enable rate limiting for the API
2626
# REACT_APP_API_ENDPOINT='/api' # The endpoint for the API (can be local or remote)
27+
# ENABLE_ANALYTICS='false' # Enable Plausible hit counter for the frontend

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
/build/
1010

1111
# ------------------------
12-
# DEPLOYMENT
12+
# BUILT FILES
1313
# ------------------------
14+
dist/
1415
.vercel/
1516
.netlify/
1617
.webpack/
1718
.serverless/
19+
.astro/
1820

1921
# ------------------------
2022
# DEPENDENCIES

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Specify the Node.js version to use
2-
ARG NODE_VERSION=16
2+
ARG NODE_VERSION=21
33

44
# Specify the Debian version to use, the default is "bullseye"
55
ARG DEBIAN_VERSION=bullseye
@@ -30,7 +30,7 @@ COPY package.json yarn.lock ./
3030

3131
# Run yarn install to install dependencies and clear yarn cache
3232
RUN apt-get update && \
33-
yarn install --production --frozen-lockfile --network-timeout 100000 && \
33+
yarn install --frozen-lockfile --network-timeout 100000 && \
3434
rm -rf /app/node_modules/.cache
3535

3636
# Copy all files to working directory
@@ -59,4 +59,4 @@ EXPOSE ${PORT:-3000}
5959
ENV CHROME_PATH='/usr/bin/chromium'
6060

6161
# Define the command executed when the container starts and start the server.js of the Node.js application
62-
CMD ["yarn", "serve"]
62+
CMD ["yarn", "start"]

api/_common/middleware.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,8 @@ const commonMiddleware = (handler) => {
124124
return nativeMode ? vercelHandler : netlifyHandler;
125125
};
126126

127-
module.exports = commonMiddleware;
127+
if (PLATFORM === 'NETLIFY') {
128+
module.exports = commonMiddleware;
129+
}
130+
131+
export default commonMiddleware;

api/archives.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const axios = require('axios');
2-
const middleware = require('./_common/middleware');
1+
import axios from 'axios';
2+
import middleware from './_common/middleware.js';
33

44
const convertTimestampToDate = (timestamp) => {
55
const [year, month, day, hour, minute, second] = [
@@ -46,7 +46,7 @@ const getScanFrequency = (firstScan, lastScan, totalScans, changeCount) => {
4646
};
4747
};
4848

49-
const getWaybackData = async (url) => {
49+
const wayBackHandler = async (url) => {
5050
const cdxUrl = `https://web.archive.org/cdx/search/cdx?url=${url}&output=json&fl=timestamp,statuscode,digest,length,offset`;
5151

5252
try {
@@ -80,5 +80,5 @@ const getWaybackData = async (url) => {
8080
}
8181
};
8282

83-
module.exports = middleware(getWaybackData);
84-
module.exports.handler = middleware(getWaybackData);
83+
export const handler = middleware(wayBackHandler);
84+
export default handler;

api/block-lists.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const dns = require('dns');
2-
const { URL } = require('url');
3-
const middleware = require('./_common/middleware');
1+
import dns from 'dns';
2+
import { URL } from 'url';
3+
import middleware from './_common/middleware.js';
44

55
const DNS_SERVERS = [
66
{ name: 'AdGuard', ip: '176.103.130.130' },
@@ -94,12 +94,12 @@ const checkDomainAgainstDnsServers = async (domain) => {
9494
return results;
9595
};
9696

97-
const handler = async (url) => {
97+
export const blockListHandler = async (url) => {
9898
const domain = new URL(url).hostname;
9999
const results = await checkDomainAgainstDnsServers(domain);
100100
return { blocklists: results };
101101
};
102102

103-
module.exports = middleware(handler);
104-
module.exports.handler = middleware(handler);
103+
export const handler = middleware(blockListHandler);
104+
export default handler;
105105

api/carbon.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const https = require('https');
2-
const middleware = require('./_common/middleware');
1+
import https from 'https';
2+
import middleware from './_common/middleware.js';
33

4-
const handler = async (url) => {
4+
const carbonHandler = async (url) => {
55

66
// First, get the size of the website's HTML
77
const getHtmlSize = (url) => new Promise((resolve, reject) => {
@@ -48,5 +48,5 @@ const handler = async (url) => {
4848
}
4949
};
5050

51-
module.exports = middleware(handler);
52-
module.exports.handler = middleware(handler);
51+
export const handler = middleware(carbonHandler);
52+
export default handler;

api/cookies.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const axios = require('axios');
2-
const puppeteer = require('puppeteer');
3-
const middleware = require('./_common/middleware');
1+
import axios from 'axios';
2+
import puppeteer from 'puppeteer';
3+
import middleware from './_common/middleware.js';
44

55
const getPuppeteerCookies = async (url) => {
66
const browser = await puppeteer.launch({
@@ -21,7 +21,7 @@ const getPuppeteerCookies = async (url) => {
2121
}
2222
};
2323

24-
const handler = async (url) => {
24+
const cookieHandler = async (url) => {
2525
let headerCookies = null;
2626
let clientCookies = null;
2727

@@ -54,5 +54,5 @@ const handler = async (url) => {
5454
return { headerCookies, clientCookies };
5555
};
5656

57-
module.exports = middleware(handler);
58-
module.exports.handler = middleware(handler);
57+
export const handler = middleware(cookieHandler);
58+
export default handler;

api/dns-server.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
const dns = require('dns');
2-
const dnsPromises = dns.promises;
3-
const axios = require('axios');
4-
const middleware = require('./_common/middleware');
1+
import { promises as dnsPromises, lookup } from 'dns';
2+
import axios from 'axios';
3+
import middleware from './_common/middleware.js';
54

6-
const handler = async (url) => {
5+
const dnsHandler = async (url) => {
76
try {
87
const domain = url.replace(/^(?:https?:\/\/)?/i, "");
98
const addresses = await dnsPromises.resolve4(domain);
@@ -41,5 +40,7 @@ const handler = async (url) => {
4140
}
4241
};
4342

44-
module.exports = middleware(handler);
45-
module.exports.handler = middleware(handler);
43+
44+
export const handler = middleware(dnsHandler);
45+
export default handler;
46+

api/dns.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const dns = require('dns');
2-
const util = require('util');
3-
const middleware = require('./_common/middleware');
1+
import dns from 'dns';
2+
import util from 'util';
3+
import middleware from './_common/middleware.js';
44

5-
const handler = async (url) => {
5+
const dnsHandler = async (url) => {
66
let hostname = url;
77

88
// Handle URLs by extracting hostname
@@ -51,5 +51,5 @@ const handler = async (url) => {
5151
}
5252
};
5353

54-
module.exports = middleware(handler);
55-
module.exports.handler = middleware(handler);
54+
export const handler = middleware(dnsHandler);
55+
export default handler;

0 commit comments

Comments
 (0)