This commit is contained in:
Patrick Alvin Alcala 2026-03-26 19:08:50 +08:00
parent 82a0fd6eea
commit 4fadb54891
24 changed files with 58 additions and 84 deletions

View file

@ -41,7 +41,7 @@ checkBackground()
}
<style lang="sass">
@use '../../configs/design/site.sass' as design
@use '../../design/site.sass' as design
:root
color-scheme: light dark

View file

@ -41,7 +41,7 @@ const borderRadius = getBorderRadius(edges)
}
<style lang="sass">
@use '/src/styles/fonts.sass' as fonts
@use '../../design/fonts.sass' as fonts
@use 'sass:color'
$primaryColor: #0075BB

View file

@ -47,5 +47,5 @@ const { desktop, tablet, mobile } = Astro.props
}
<style lang="sass">
@use '/src/styles/breakpoints.sass'
@use '../../design/breakpoints.sass'
</style>

View file

@ -7,7 +7,7 @@
</footer>
<style lang="sass">
@use '../../configs/design/sizes' as view
@use '../../design/sizes' as view
.dasig-footer
padding: 1rem 0

View file

@ -45,8 +45,8 @@ const config = toml.parse(fs.readFileSync('configs/config.site.toml', 'utf8'))
</html>
<style lang="sass">
@use '../../configs/design/colors.sass' as colors
@use '/src/styles/fonts.sass' as fonts
@use '../../design/colors.sass' as colors
@use '../../design/fonts.sass' as fonts
.body
color: colors.$white

View file

@ -21,7 +21,7 @@ const { background, color, border } = Astro.props
}
<style lang="sass">
@use '../../configs/design/site' as site
@use '../../design/site' as site
@use 'sass:color'
.modal

View file

@ -0,0 +1,31 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
server_name _;
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
internal;
}
location / {
try_files $uri $uri/index.html =404;
}
}
}

View file

@ -16,7 +16,3 @@ export { default as Display } from './components/Display.astro'
export { default as Padding } from './components/Padding.astro'
export { default as Modal } from './components/Modal.astro'
export { default as Input } from './components/Input.astro'
// export { default as OptimizeBackground } from './Optimizers/OptimizeBackground'
// export { default as OptimizeImage } from './Optimizers/OptimizeImage'
// export { default as OptimizeLogo } from './Optimizers/OptimizeLogo'

View file

@ -1,17 +0,0 @@
import { JSEncrypt } from "jsencrypt";
import * as fs from "node:fs";
import * as toml from "toml";
const config = toml.parse(
fs.readFileSync("configs/config.security.toml", "utf-8"),
);
const enc = new JSEncrypt();
const PUBLIC_KEY = config.rsa.public_key;
export default (message: string) => {
enc.setPublicKey(PUBLIC_KEY);
const encrypted = enc.encrypt(message).toString();
const fixedEncrypted = encrypted.replace(/\//g, "~");
return fixedEncrypted;
};

View file

@ -1,47 +1,39 @@
import { consola } from "consola";
import process from "node:process";
import sharp from "sharp";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { consola } from 'consola'
import process from 'node:process'
import sharp from 'sharp'
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
;(async () => {
const argv = yargs(hideBin(process.argv))
.option('name', {
alias: 'n',
describe: 'Specify the name of the image',
type: 'string',
demandOption: true,
})
.option('size', {
alias: 's',
describe: 'Specify the size of the image',
type: 'number',
demandOption: true,
}).argv
(async () => {
const argv = yargs(hideBin(process.argv))
.option("name", {
alias: "n",
describe: "Specify the name of the image",
type: "string",
demandOption: true,
})
.option("size", {
alias: "s",
describe: "Specify the size of the image",
type: "number",
demandOption: true,
}).argv;
const name = argv.name
const size = argv.size
const name = argv.name;
const size = argv.size;
try {
const avifOutputPath = `./@dasig/images/${name.toString().split('.').slice(0, -1).join('.')}.avif`
const webpOutputPath = `./@dasig/images/${name.toString().split('.').slice(0, -1).join('.')}.webp`
try {
const avifOutputPath = `./@dasig/images/${name.toString().split(".").slice(0, -1).join(".")}.avif`;
const webpOutputPath = `./@dasig/images/${name.toString().split(".").slice(0, -1).join(".")}.webp`;
const avifBuffer = await sharp(`./src/images/${name}.png`).avif({ quality: 60 }).resize(size).toBuffer()
await sharp(avifBuffer).toFile(avifOutputPath)
consola.success(`${name} successfully optimized in Avif`)
const avifBuffer = await sharp(`./src/images/${name}`)
.avif({ quality: 60 })
.resize(size)
.toBuffer();
await sharp(avifBuffer).toFile(avifOutputPath);
consola.success(`${name} successfully optimized in Avif`);
const webpBuffer = await sharp(`./src/images/${name}`)
.webp({ quality: 75 })
.resize(size)
.toBuffer();
await sharp(webpBuffer).toFile(webpOutputPath);
consola.success(`${name} successfully optimized in Webp`);
} catch (error: any) {
consola.error("Error optimizing image:", error);
if (error.message.includes("missing"))
consola.error(`${name} could not be found on image folder`);
}
})();
const webpBuffer = await sharp(`./src/images/${name}.png`).webp({ quality: 75 }).resize(size).toBuffer()
await sharp(webpBuffer).toFile(webpOutputPath)
consola.success(`${name} successfully optimized in Webp`)
} catch (error: any) {
consola.error('Error optimizing image:', error)
if (error.message.includes('missing')) consola.error(`${name} could not be found on image folder`)
}
})()