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

2
.env Normal file
View file

@ -0,0 +1,2 @@
CONTAINER_NAME=dasig-static
PORT=4320

1
.gitignore vendored
View file

@ -14,7 +14,6 @@ pnpm-debug.log*
# environment variables # environment variables
.env
.env.local .env.local
.env.production .env.production

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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 Padding } from './components/Padding.astro'
export { default as Modal } from './components/Modal.astro' export { default as Modal } from './components/Modal.astro'
export { default as Input } from './components/Input.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 { consola } from 'consola'
import process from "node:process"; import process from 'node:process'
import sharp from "sharp"; import sharp from 'sharp'
import yargs from "yargs"; import yargs from 'yargs'
import { hideBin } from "yargs/helpers"; 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 name = argv.name
const argv = yargs(hideBin(process.argv)) const size = argv.size
.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; try {
const size = argv.size; 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 avifBuffer = await sharp(`./src/images/${name}.png`).avif({ quality: 60 }).resize(size).toBuffer()
const avifOutputPath = `./@dasig/images/${name.toString().split(".").slice(0, -1).join(".")}.avif`; await sharp(avifBuffer).toFile(avifOutputPath)
const webpOutputPath = `./@dasig/images/${name.toString().split(".").slice(0, -1).join(".")}.webp`; consola.success(`${name} successfully optimized in Avif`)
const avifBuffer = await sharp(`./src/images/${name}`) const webpBuffer = await sharp(`./src/images/${name}.png`).webp({ quality: 75 }).resize(size).toBuffer()
.avif({ quality: 60 }) await sharp(webpBuffer).toFile(webpOutputPath)
.resize(size) consola.success(`${name} successfully optimized in Webp`)
.toBuffer(); } catch (error: any) {
await sharp(avifBuffer).toFile(avifOutputPath); consola.error('Error optimizing image:', error)
consola.success(`${name} successfully optimized in Avif`); if (error.message.includes('missing')) consola.error(`${name} could not be found on image folder`)
}
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`);
}
})();

View file

@ -7,6 +7,6 @@ COPY . .
RUN pnpm build RUN pnpm build
FROM nginx:stable-alpine AS runtime FROM nginx:stable-alpine AS runtime
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf COPY ./@dasig/deployment/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 4321 EXPOSE 4321

View file

@ -1,4 +1,4 @@
@use '../../configs/design/sizes.sass' as sizes @use '../design/sizes' as sizes
.on-desktop-only .on-desktop-only
@media only screen and (min-width: 0px) and (max-width: sizes.$desktop) @media only screen and (min-width: 0px) and (max-width: sizes.$desktop)

View file

@ -1,9 +1,10 @@
services: services:
template: dasig-static:
container_name: template container_name: ${CONTAINER_NAME}
image: localhost/${CONTAINER_NAME}:latest
restart: unless-stopped restart: unless-stopped
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
ports: ports:
- 4321:4321 - ${PORT}:4321

View file

@ -1,13 +1,14 @@
[Unit] [Unit]
Description=DASIG-ASTRO Description=DASIG-STATIC
[Container] [Container]
ContainerName=dasig-astro ContainerName=${CONTAINER_NAME}
Image=localhost/dasig-astro Image=localhost/${CONTAINER_NAME}:latest
PublishPort=4321:4321 PublishPort=${PORT}:4321
[Service] [Service]
Restart=always Restart=always
EnvironmentFile=dasig.env
[Install] [Install]
WantedBy=multi-user.target default.target WantedBy=multi-user.target default.target

View file

@ -33,8 +33,8 @@ const count = 0
<style lang="sass"> <style lang="sass">
@use 'sass:color' @use 'sass:color'
@use '../../configs/design/site' as design @use '../../design/site' as design
@use '../styles/functions.sass' as func @use '../../design/functions.sass' as func
.counter .counter
font-family: inherit font-family: inherit

View file

@ -25,7 +25,7 @@ import PA2 from '../../@dasig/images/pat-alcala.webp'
</Layout> </Layout>
<style lang="sass"> <style lang="sass">
@use '../styles/fonts.sass' as fonts @use '../../design/fonts.sass' as fonts
h1, h4 h1, h4
background: linear-gradient(135deg, #49e1a0 0%, #294e87 100%) background: linear-gradient(135deg, #49e1a0 0%, #294e87 100%)