Add SSL support

This commit is contained in:
Aelita4 2024-09-28 13:56:14 +02:00
parent 1a522440b9
commit 718a9b5da6
Signed by: Aelita4
GPG Key ID: E44490C2025906C1
6 changed files with 26 additions and 5 deletions

View File

@ -1,5 +1,6 @@
import { defineConfig } from 'astro/config';
import icon from "astro-icon";
import basicSsl from "@vitejs/plugin-basic-ssl";
import node from "@astrojs/node";
@ -9,5 +10,11 @@ export default defineConfig({
integrations: [icon()],
adapter: node({
mode: "standalone"
})
}),
vite: {
plugins: [basicSsl()],
server: {
https: true
}
}
});

15
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "AstroColony",
"name": "AstroCol",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
@ -16,6 +16,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"dotenv": "^16.4.5",
"jest": "^29.7.0",
"ts-jest": "^29.1.4",
@ -2489,6 +2490,18 @@
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ=="
},
"node_modules/@vitejs/plugin-basic-ssl": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-1.1.0.tgz",
"integrity": "sha512-wO4Dk/rm8u7RNhOf95ZzcEmC9rYOncYgvq4z3duaJrCgjN8BxAnDVyndanfcJZ0O6XZzHz6Q0hTimxTg8Y9g/A==",
"dev": true,
"engines": {
"node": ">=14.6.0"
},
"peerDependencies": {
"vite": "^3.0.0 || ^4.0.0 || ^5.0.0"
}
},
"node_modules/acorn": {
"version": "8.11.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",

View File

@ -20,6 +20,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"dotenv": "^16.4.5",
"jest": "^29.7.0",
"ts-jest": "^29.1.4",

View File

@ -40,7 +40,7 @@ export async function getLocales(language: string) {
return null;
}
const lang = await (await fetch(`http://localhost:4321/api/lang/${language}.json`)).json();
const lang = await (await fetch(`https://localhost:4321/api/lang/${language}.json`)).json();
return lang.data;
}

View File

@ -33,7 +33,7 @@ if(Astro.request.method === "POST") {
if(!user) throw new Error("User not found");
const sessionTime = config.SESSION_TIME_MINUTES * 60;
const res = await fetch(`http://localhost:4321/api/auth/generateAccessToken`, {
const res = await fetch(`https://localhost:4321/api/auth/generateAccessToken`, {
method: 'POST',
body: JSON.stringify({
username,

View File

@ -60,7 +60,7 @@ if(Astro.request.method === "POST") {
const sessionTime = config.SESSION_TIME_MINUTES * 60;
const res = await fetch(`http://localhost:4321/api/auth/generateAccessToken`, {
const res = await fetch(`https://localhost:4321/api/auth/generateAccessToken`, {
method: 'POST',
body: JSON.stringify({
username,