add some license info

This commit is contained in:
sk1982 2024-04-07 06:04:56 -04:00
parent b6b31ad094
commit df7d086ab9
4 changed files with 43 additions and 2 deletions

12
LICENSE.txt Normal file
View File

@ -0,0 +1,12 @@
BSD Zero Clause License
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

View File

@ -1,9 +1,26 @@
import fs from 'fs';
let baseAssetUrl = process.env.ASSET_URL ?? '/'; let baseAssetUrl = process.env.ASSET_URL ?? '/';
if (!baseAssetUrl.endsWith('/')) baseAssetUrl += '/'; if (!baseAssetUrl.endsWith('/')) baseAssetUrl += '/';
let basePath = process.env.BASE_PATH ?? ''; let basePath = process.env.BASE_PATH ?? '';
if (basePath.endsWith('/')) basePath = basePath.slice(0, -1); if (basePath.endsWith('/')) basePath = basePath.slice(0, -1);
const packageInfo = JSON.parse(fs.readFileSync('package.json').toString());
let versionString = `Actaeon v${packageInfo.version}`;
try {
const rev = fs.readFileSync('.git/HEAD').toString().trim();
if (!rev.includes(':'))
versionString += ` (${rev})`;
const branch = rev.replace(/^ref:\s+refs\/heads\//, '');
const hash = fs.readFileSync(`.git/${rev.slice(5)}`).toString().trim();
if (branch !== 'main')
versionString += ` on ${branch}`;
versionString += ` (${hash.slice(0, 8)})`;
} catch { }
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
images: { images: {
@ -24,7 +41,8 @@ const nextConfig = {
}, },
env: { env: {
NEXT_PUBLIC_BASE_PATH: basePath, NEXT_PUBLIC_BASE_PATH: basePath,
NEXT_PUBLIC_ASSET_URL: baseAssetUrl NEXT_PUBLIC_ASSET_URL: baseAssetUrl,
NEXT_PUBLIC_VERSION_STRING: versionString
}, },
sassOptions: { sassOptions: {
additionalData: `$asset-url: "${baseAssetUrl}";` additionalData: `$asset-url: "${baseAssetUrl}";`

View File

@ -2,6 +2,7 @@ import './globals.scss';
import { LayoutProps } from '@/types/layout'; import { LayoutProps } from '@/types/layout';
import { getAssetUrl } from '@/helpers/assets'; import { getAssetUrl } from '@/helpers/assets';
import { Providers } from '@/components/providers'; import { Providers } from '@/components/providers';
import Script from 'next/script';
export default async function RootLayout({children}: LayoutProps) { export default async function RootLayout({children}: LayoutProps) {
return ( return (
@ -20,7 +21,13 @@ export default async function RootLayout({children}: LayoutProps) {
<Providers> <Providers>
{children} {children}
</Providers> </Providers>
</body> <Script id="version-info">
const c = [`color:#7300ac`,`color:#7800ae`,`color:#7d00b0`,`color:#8300b2`,`color:#8800b4`,`color:#8d00b6`,`color:#9200b8`,`color:#9700bb`,`color:#9c00bd`,`color:#a200bf`,`color:#a700c1`,`color:#ac00c3`,`color:#b100c5`,`color:#b600c7`,`color:#bc00c9`,`color:#c100cb`,`color:#c600cd`,`color:#cb00cf`,`color:#d000d1`,`color:#d600d3`,`color:#db00d5`,`color:#e000d8`,`color:#e500da`,`color:#ea00dc`,`color:#ef00de`,`color:#f500e0`,`color:#fa00e2`,`color:#ff00e4`];
console.log(`%c▄%c▀%c█%c%c█%c▀%c▀%c%c▀%c█%c▀%c%c▄%c▀%c█%c%c█%c▀%c▀%c%c█%c▀%c█%c%c█%c▄%c░%c█\n%c█%c▀%c█%c%c█%c▄%c▄%c%c░%c█%c░%c%c█%c▀%c█%c%c█%c█%c▄%c%c█%c▄%c█%c%c█%c░%c▀%c█`, ...c, ...c);
console.log(`This is free software. %cIf you payed for it, you have been scammed.`, `font-weight:bold`);
console.log(`%c{process.env.NEXT_PUBLIC_VERSION_STRING}`, `color:gray;font-style:italic`);
</Script>
</body>
</html> </html>
); );
} }

View File

@ -1,5 +1,9 @@
export async function register() { export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') { if (process.env.NEXT_RUNTIME === 'nodejs') {
console.log(`\x1b[38;2;115;0;172m▄\x1b[38;2;120;0;174m▀\x1b[38;2;125;0;176m█\x1b[38;2;131;0;178m\x1b[38;2;136;0;180m█\x1b[38;2;141;0;182m▀\x1b[38;2;146;0;184m▀\x1b[38;2;151;0;187m\x1b[38;2;156;0;189m▀\x1b[38;2;162;0;191m█\x1b[38;2;167;0;193m▀\x1b[38;2;172;0;195m\x1b[38;2;177;0;197m▄\x1b[38;2;182;0;199m▀\x1b[38;2;188;0;201m█\x1b[38;2;193;0;203m\x1b[38;2;198;0;205m█\x1b[38;2;203;0;207m▀\x1b[38;2;208;0;209m▀\x1b[38;2;214;0;211m\x1b[38;2;219;0;213m█\x1b[38;2;224;0;216m▀\x1b[38;2;229;0;218m█\x1b[38;2;234;0;220m\x1b[38;2;239;0;222m█\x1b[38;2;245;0;224m▄\x1b[38;2;250;0;226m░\x1b[38;2;255;0;228m█\x1b[m`);
console.log(`\x1b[38;2;115;0;172m█\x1b[38;2;120;0;174m▀\x1b[38;2;125;0;176m█\x1b[38;2;131;0;178m\x1b[38;2;136;0;180m█\x1b[38;2;141;0;182m▄\x1b[38;2;146;0;184m▄\x1b[38;2;151;0;187m\x1b[38;2;156;0;189m░\x1b[38;2;162;0;191m█\x1b[38;2;167;0;193m░\x1b[38;2;172;0;195m\x1b[38;2;177;0;197m█\x1b[38;2;182;0;199m▀\x1b[38;2;188;0;201m█\x1b[38;2;193;0;203m\x1b[38;2;198;0;205m█\x1b[38;2;203;0;207m█\x1b[38;2;208;0;209m▄\x1b[38;2;214;0;211m\x1b[38;2;219;0;213m█\x1b[38;2;224;0;216m▄\x1b[38;2;229;0;218m█\x1b[38;2;234;0;220m\x1b[38;2;239;0;222m█\x1b[38;2;245;0;224m░\x1b[38;2;250;0;226m▀\x1b[38;2;255;0;228m█\x1b[m`);
console.log('This is free software. \x1B[1mIf you payed for it, you have been scammed.\x1b[m')
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
const secret = process.env.NEXTAUTH_SECRET ?? process.env.AUTH_SECRET; const secret = process.env.NEXTAUTH_SECRET ?? process.env.AUTH_SECRET;