Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT - Astroify #139

Merged
merged 78 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
45bf452
Migrate to Astro base
Lissy93 May 5, 2024
20ef316
Specify platform
Lissy93 May 5, 2024
9a59d12
Dependencies for Astro
Lissy93 May 5, 2024
fd0b1e7
Writes configuration file for multi-adapter Astro site
Lissy93 May 5, 2024
bb6845d
Move assets into /public
Lissy93 May 5, 2024
e321466
Configuration for Vite
Lissy93 May 5, 2024
e6eb91a
Update path to GUI
Lissy93 May 5, 2024
e255c35
Updates configration for Vercel and Typescript
Lissy93 May 5, 2024
c9e5740
Convert all API endpoints into ESM modules
Lissy93 May 6, 2024
d913588
Server working with Astro and all API endpoints
Lissy93 May 6, 2024
42d6e03
Send user direct to check page, if self-hosted
Lissy93 May 6, 2024
390b8b9
Improved UX for self-hosted users
Lissy93 May 6, 2024
de75d1c
Ignore built files
Lissy93 May 7, 2024
1478fa7
Update publish directory for Netlify
Lissy93 May 7, 2024
22cf124
Update PLATFORM env var
Lissy93 May 7, 2024
3213884
Redirect if URL param present on home
Lissy93 May 8, 2024
69abef3
Adds PM2 for no-crash server
Lissy93 May 8, 2024
e5738d1
Update start command, and remove --prod flag from dev install script …
Lissy93 May 8, 2024
7e27143
Rename v1 to web-check-live
Lissy93 May 8, 2024
70724be
Fix correct param name
Lissy93 May 8, 2024
8a7e431
Fix link to about docs
Lissy93 May 8, 2024
7557cb9
Update condidional for skipping wc homepage for self-hosted users
Lissy93 May 11, 2024
91404d1
Adds a fly.toml for deploying to fly.io
Lissy93 May 11, 2024
a5a277c
Adds JS fallback for redirection
Lissy93 May 11, 2024
9f82e19
Sets aliases for astro imports
Lissy93 May 11, 2024
37f711d
Builds base layout, and head tags
Lissy93 May 11, 2024
cc510bd
Adds Swagger docs for API
Lissy93 May 18, 2024
cb8db0b
JSON parsing in API endpoints
Lissy93 May 18, 2024
8919823
Updates Vercel and adds SASS
Lissy93 May 19, 2024
d2f58f4
Adds API docs route
Lissy93 May 19, 2024
8a0ec5a
Use Link tag, instead of anchor tag
Lissy93 May 20, 2024
5de879b
All-in-one dev command
Lissy93 May 20, 2024
a2f5bcb
Adds Swagger docs and assets
Lissy93 May 20, 2024
97fd194
Updates links to use Link instead of anchor
Lissy93 May 20, 2024
34ca09f
Fix catch-all when GUI is disabled
Lissy93 May 20, 2024
b090dca
Astro app
Lissy93 May 20, 2024
d826e97
Adds aliases for styles and assets
Lissy93 May 20, 2024
322ef5e
Removes old swagger location
Lissy93 May 20, 2024
ca3f8a4
Adds Svelte, Framer and starts work on homepage
Lissy93 May 26, 2024
10cbc2a
Adds Hubot Sans fonts
Lissy93 Jun 3, 2024
c46ec14
Updates to new icon
Lissy93 Jun 3, 2024
fa6ef6f
Removes old fonts location
Lissy93 Jun 3, 2024
68f95d5
Adds interactive animated components for homepage
Lissy93 Jun 3, 2024
50cc152
Adds nav scafold component
Lissy93 Jun 3, 2024
f9e6878
Global and reusable stylings
Lissy93 Jun 3, 2024
a12e7c5
Astro pages build up
Lissy93 Jun 3, 2024
8f55214
Updates base layout
Lissy93 Jun 3, 2024
f4196c7
chore: Redirect /about to /check/about
Lissy93 Jun 8, 2024
03e980e
dep: Adds Font Awesome, and builds an Icon component
Lissy93 Jun 8, 2024
e2d83b6
ref: Improves few of the older React components
Lissy93 Jun 8, 2024
2f1bab5
feat: Adds new feature components for new homepage
Lissy93 Jun 8, 2024
8013a0a
feat: Adds new favicon
Lissy93 Jun 8, 2024
6207157
Builds footer, and updates new homepage
Lissy93 Jun 8, 2024
82be27c
docs: Updates samples
Lissy93 Jun 15, 2024
d3cbc50
docs: Updates domains in Swagger docs
Lissy93 Jun 15, 2024
8feb67d
styles: Updates theme of V1 check to match homepage
Lissy93 Jun 15, 2024
4fd5ff4
assets: Adds image assets
Lissy93 Jun 15, 2024
0172de8
feat: Adds self-hosting docs page
Lissy93 Jun 15, 2024
ff18904
feat: Updates nav, icon, colors, background and homepage
Lissy93 Jun 15, 2024
2628655
assets: adds swagger and webauthn imgs
Lissy93 Jun 16, 2024
ad9ea91
feat: Initial landing page for API docs
Lissy93 Jun 16, 2024
316e0d9
feat: Adds screenshots to homepage
Lissy93 Jun 16, 2024
7d4eab2
feat: improved err messaging for netlify
Lissy93 Jun 16, 2024
aea93fe
feat: styles, nav, home, and stuff
Lissy93 Jun 16, 2024
43fb27e
Merge branch 'master' of github.com:lissy93/web-check into FEAT/astroify
Lissy93 Jun 16, 2024
e529a2e
feat: Adds coming soon to account
Lissy93 Jun 16, 2024
8c17303
feat: Deploy target to lowercase
Lissy93 Jun 18, 2024
a6bc8d7
feat: Dynamically import SSR handler
Lissy93 Jun 18, 2024
ba8880c
feat: Add old-school export option for Netlify
Lissy93 Jun 18, 2024
0a41904
feat: Styling for error logs
Lissy93 Jun 21, 2024
cee06c9
feat: Specify API destination for netlify
Lissy93 Jun 21, 2024
0ff76de
dep: Adds Chromium
Lissy93 Jun 21, 2024
ce92015
fix: Remove the redirect from netlify config
Lissy93 Jun 21, 2024
9bb8b3f
dep: Temp downgrade of axios, for netlify
Lissy93 Jun 21, 2024
c0f7ef1
fix: Netlify include node_modules
Lissy93 Jun 21, 2024
2ff8155
fix: Netlify include axios for function runtime
Lissy93 Jun 21, 2024
99f1e27
fix: Uses esbuild as the node bundler for netlify
Lissy93 Jun 21, 2024
abab9f1
fix: Revert esbuild as the node bundler for netlify
Lissy93 Jun 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ REACT_APP_WHO_API_KEY=''
# API_CORS_ORIGIN='*' # Enable CORS, by setting your allowed hostname(s) here
# API_ENABLE_RATE_LIMIT='true' # Enable rate limiting for the API
# REACT_APP_API_ENDPOINT='/api' # The endpoint for the API (can be local or remote)
# ENABLE_ANALYTICS='false' # Enable Plausible hit counter for the frontend
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
/build/

# ------------------------
# DEPLOYMENT
# BUILT FILES
# ------------------------
dist/
.vercel/
.netlify/
.webpack/
.serverless/
.astro/

# ------------------------
# DEPENDENCIES
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Specify the Node.js version to use
ARG NODE_VERSION=16
ARG NODE_VERSION=21

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

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

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

# Define the command executed when the container starts and start the server.js of the Node.js application
CMD ["yarn", "serve"]
CMD ["yarn", "start"]
6 changes: 5 additions & 1 deletion api/_common/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,8 @@ const commonMiddleware = (handler) => {
return nativeMode ? vercelHandler : netlifyHandler;
};

module.exports = commonMiddleware;
if (PLATFORM === 'NETLIFY') {
module.exports = commonMiddleware;
}

export default commonMiddleware;
10 changes: 5 additions & 5 deletions api/archives.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const axios = require('axios');
const middleware = require('./_common/middleware');
import axios from 'axios';
import middleware from './_common/middleware.js';

const convertTimestampToDate = (timestamp) => {
const [year, month, day, hour, minute, second] = [
Expand Down Expand Up @@ -46,7 +46,7 @@ const getScanFrequency = (firstScan, lastScan, totalScans, changeCount) => {
};
};

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

try {
Expand Down Expand Up @@ -80,5 +80,5 @@ const getWaybackData = async (url) => {
}
};

module.exports = middleware(getWaybackData);
module.exports.handler = middleware(getWaybackData);
export const handler = middleware(wayBackHandler);
export default handler;
12 changes: 6 additions & 6 deletions api/block-lists.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dns = require('dns');
const { URL } = require('url');
const middleware = require('./_common/middleware');
import dns from 'dns';
import { URL } from 'url';
import middleware from './_common/middleware.js';

const DNS_SERVERS = [
{ name: 'AdGuard', ip: '176.103.130.130' },
Expand Down Expand Up @@ -94,12 +94,12 @@ const checkDomainAgainstDnsServers = async (domain) => {
return results;
};

const handler = async (url) => {
export const blockListHandler = async (url) => {
const domain = new URL(url).hostname;
const results = await checkDomainAgainstDnsServers(domain);
return { blocklists: results };
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(blockListHandler);
export default handler;

10 changes: 5 additions & 5 deletions api/carbon.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const https = require('https');
const middleware = require('./_common/middleware');
import https from 'https';
import middleware from './_common/middleware.js';

const handler = async (url) => {
const carbonHandler = async (url) => {

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

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(carbonHandler);
export default handler;
12 changes: 6 additions & 6 deletions api/cookies.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const axios = require('axios');
const puppeteer = require('puppeteer');
const middleware = require('./_common/middleware');
import axios from 'axios';
import puppeteer from 'puppeteer';
import middleware from './_common/middleware.js';

const getPuppeteerCookies = async (url) => {
const browser = await puppeteer.launch({
Expand All @@ -21,7 +21,7 @@ const getPuppeteerCookies = async (url) => {
}
};

const handler = async (url) => {
const cookieHandler = async (url) => {
let headerCookies = null;
let clientCookies = null;

Expand Down Expand Up @@ -54,5 +54,5 @@ const handler = async (url) => {
return { headerCookies, clientCookies };
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(cookieHandler);
export default handler;
15 changes: 8 additions & 7 deletions api/dns-server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const dns = require('dns');
const dnsPromises = dns.promises;
const axios = require('axios');
const middleware = require('./_common/middleware');
import { promises as dnsPromises, lookup } from 'dns';
import axios from 'axios';
import middleware from './_common/middleware.js';

const handler = async (url) => {
const dnsHandler = async (url) => {
try {
const domain = url.replace(/^(?:https?:\/\/)?/i, "");
const addresses = await dnsPromises.resolve4(domain);
Expand Down Expand Up @@ -41,5 +40,7 @@ const handler = async (url) => {
}
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);

export const handler = middleware(dnsHandler);
export default handler;

12 changes: 6 additions & 6 deletions api/dns.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const dns = require('dns');
const util = require('util');
const middleware = require('./_common/middleware');
import dns from 'dns';
import util from 'util';
import middleware from './_common/middleware.js';

const handler = async (url) => {
const dnsHandler = async (url) => {
let hostname = url;

// Handle URLs by extracting hostname
Expand Down Expand Up @@ -51,5 +51,5 @@ const handler = async (url) => {
}
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(dnsHandler);
export default handler;
10 changes: 5 additions & 5 deletions api/dnssec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const https = require('https');
const middleware = require('./_common/middleware'); // Make sure this path is correct
import https from 'https';
import middleware from './_common/middleware.js';

const handler = async (domain) => {
const dnsSecHandler = async (domain) => {
const dnsTypes = ['DNSKEY', 'DS', 'RRSIG'];
const records = {};

Expand Down Expand Up @@ -53,5 +53,5 @@ const handler = async (domain) => {
return records;
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(dnsSecHandler);
export default handler;
10 changes: 5 additions & 5 deletions api/features.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const https = require('https');
const middleware = require('./_common/middleware');
import https from 'https';
import middleware from './_common/middleware.js';

const handler = async (url) => {
const featuresHandler = async (url) => {
const apiKey = process.env.BUILT_WITH_API_KEY;

if (!url) {
Expand Down Expand Up @@ -45,5 +45,5 @@ const handler = async (url) => {
}
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(featuresHandler);
export default handler;
10 changes: 5 additions & 5 deletions api/firewall.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const axios = require('axios');
const middleware = require('./_common/middleware');
import axios from 'axios';
import middleware from './_common/middleware.js';

const hasWaf = (waf) => {
return {
hasWaf: true, waf,
}
};

const handler = async (url) => {
const firewallHandler = async (url) => {
const fullUrl = url.startsWith('http') ? url : `http://${url}`;

try {
Expand Down Expand Up @@ -110,5 +110,5 @@ const handler = async (url) => {
}
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(firewallHandler);
export default handler;
10 changes: 5 additions & 5 deletions api/get-ip.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const dns = require('dns');
const middleware = require('./_common/middleware');
import dns from 'dns';
import middleware from './_common/middleware.js';

const lookupAsync = (address) => {
return new Promise((resolve, reject) => {
Expand All @@ -13,11 +13,11 @@ const lookupAsync = (address) => {
});
};

const handler = async (url) => {
const ipHandler = async (url) => {
const address = url.replaceAll('https://', '').replaceAll('http://', '');
return await lookupAsync(address);
};


module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(ipHandler);
export default handler;
10 changes: 5 additions & 5 deletions api/headers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const axios = require('axios');
const middleware = require('./_common/middleware');
import axios from 'axios';
import middleware from './_common/middleware.js';

const handler = async (url, event, context) => {
const headersHandler = async (url, event, context) => {
try {
const response = await axios.get(url, {
validateStatus: function (status) {
Expand All @@ -15,5 +15,5 @@ const handler = async (url, event, context) => {
}
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(headersHandler);
export default handler;
11 changes: 5 additions & 6 deletions api/hsts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const https = require('https');
const middleware = require('./_common/middleware');
import https from 'https';
import middleware from './_common/middleware.js';

const handler = async (url, event, context) => {
const hstsHandler = async (url, event, context) => {
const errorResponse = (message, statusCode = 500) => {
return {
statusCode: statusCode,
Expand Down Expand Up @@ -45,6 +45,5 @@ const handler = async (url, event, context) => {
});
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);

export const handler = middleware(hstsHandler);
export default handler;
10 changes: 5 additions & 5 deletions api/http-security.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const axios = require('axios');
const middleware = require('./_common/middleware');
import axios from 'axios';
import middleware from './_common/middleware.js';

const handler = async (url) => {
const httpsSecHandler = async (url) => {
const fullUrl = url.startsWith('http') ? url : `http://${url}`;

try {
Expand All @@ -22,5 +22,5 @@ const handler = async (url) => {
}
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(httpsSecHandler);
export default handler;
17 changes: 8 additions & 9 deletions api/legacy-rank.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const axios = require('axios');
const unzipper = require('unzipper');
const csv = require('csv-parser');
const fs = require('fs');
const middleware = require('./_common/middleware');
import axios from 'axios';
import unzipper from 'unzipper';
import csv from 'csv-parser';
import fs from 'fs';
import middleware from './_common/middleware.js';

// Should also work with the following sources:
// https://www.domcop.com/files/top/top10milliondomains.csv.zip
Expand All @@ -14,7 +14,7 @@ const middleware = require('./_common/middleware');
const FILE_URL = 'https://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip';
const TEMP_FILE_PATH = '/tmp/top-1m.csv';

const handler = async (url) => {
const rankHandler = async (url) => {
let domain = null;

try {
Expand Down Expand Up @@ -66,6 +66,5 @@ return new Promise((resolve, reject) => {
});
};

module.exports = middleware(handler);
module.exports.handler = middleware(handler);

export const handler = middleware(rankHandler);
export default handler;
Loading