mirror of
https://github.com/fergalmoran/snapp.git
synced 2025-12-22 09:41:45 +00:00
0.7.1 fixes
This commit is contained in:
@@ -64,4 +64,8 @@
|
|||||||
- Some here and there quality of life
|
- Some here and there quality of life
|
||||||
- As for now the test release is not set as uraniadev/snapp:latest but it has to be done manually due to the new database stack and architecture
|
- As for now the test release is not set as uraniadev/snapp:latest but it has to be done manually due to the new database stack and architecture
|
||||||
- 0.7
|
- 0.7
|
||||||
- Released
|
- Released
|
||||||
|
- 0.7.1
|
||||||
|
- Provided placeholder default for better understanding of missing languages file
|
||||||
|
- Corrected README unnecessarely mounting translation folder
|
||||||
|
- Fixed overlay on Single Snapp dashboard
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ RUN npm i
|
|||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
# Build the SvelteKit app
|
# Build the SvelteKit app
|
||||||
ENV SNAPP_VERSION=0.7.alpha
|
ENV SNAPP_VERSION=0.7.1
|
||||||
|
|
||||||
ENV AUTH_SECRET=lFNiU7T98/44Qlqb4hMUkVcLOpijEI7z722Kxhv4O2Y=
|
ENV AUTH_SECRET=lFNiU7T98/44Qlqb4hMUkVcLOpijEI7z722Kxhv4O2Y=
|
||||||
ENV DB_HOST=100.64.0.21
|
ENV DB_HOST=100.64.0.21
|
||||||
@@ -27,6 +27,8 @@ ENV DEFAULT_THEME=dark
|
|||||||
ENV DEFAULT_LANG=en
|
ENV DEFAULT_LANG=en
|
||||||
ENV LOCALIZATION_FOLDER=/app/translations
|
ENV LOCALIZATION_FOLDER=/app/translations
|
||||||
ENV MAX_SHORT_URL=10
|
ENV MAX_SHORT_URL=10
|
||||||
|
ENV PUBLIC_UMAMI_WEBSITE_ID: ${P_UMAMI_WEB_ID} # this allow creator to enable metrics on public https://snapp.li homepage
|
||||||
|
ENV PUBLIC_UMAMI_URL: ${P_UMAMI_WEBSITE_URL} # this allow creator to enable metrics on public https://snapp.li homepage
|
||||||
ENV MAX_USAGES=0
|
ENV MAX_USAGES=0
|
||||||
ENV MAX_RPM=0
|
ENV MAX_RPM=0
|
||||||
ENV MAX_RPD=0
|
ENV MAX_RPD=0
|
||||||
|
|||||||
@@ -92,7 +92,10 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
volumes:
|
volumes:
|
||||||
- /home/snapp/app/translations:/app/translations:ro
|
# provide origin json downloadable
|
||||||
|
# from github if you intend to use it
|
||||||
|
#
|
||||||
|
# - /home/snapp/app/translations:/app/translations:ro
|
||||||
# - /home/snapp/redis/theme/theme.css:/app/static/custom-theme.css
|
# - /home/snapp/redis/theme/theme.css:/app/static/custom-theme.css
|
||||||
# See (Discussion about theming)[https://github.com/urania-dev/snapp/discussions/18]
|
# See (Discussion about theming)[https://github.com/urania-dev/snapp/discussions/18]
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import { env } from "$env/dynamic/private";
|
import { env } from '$env/dynamic/private';
|
||||||
import { readFile } from "fs/promises";
|
import { existsSync } from 'fs';
|
||||||
|
import { readFile } from 'fs/promises';
|
||||||
|
|
||||||
export default async function getLanguage() {
|
export default async function getLanguage() {
|
||||||
try {
|
try {
|
||||||
|
const exists = existsSync(`${env.LOCALIZATION_FOLDER}/${env.DEFAULT_LANG}.json`);
|
||||||
|
if (!exists) return [];
|
||||||
const jsonContent = JSON.parse(
|
const jsonContent = JSON.parse(
|
||||||
await readFile(`${env.LOCALIZATION_FOLDER}/${env.DEFAULT_LANG}.json`, 'utf8')
|
await readFile(`${env.LOCALIZATION_FOLDER}/${env.DEFAULT_LANG}.json`, 'utf8')
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -34,10 +34,11 @@ function translate(
|
|||||||
) {
|
) {
|
||||||
if (!translationKey) throw new Error('no key provided to $t()');
|
if (!translationKey) throw new Error('no key provided to $t()');
|
||||||
|
|
||||||
|
if (!localization || !Array.from(Object.entries(localization)).length) return translationKey;
|
||||||
let text = localization[translationKey];
|
let text = localization[translationKey];
|
||||||
|
|
||||||
if (!text) return translationKey;
|
if (!text) return translationKey;
|
||||||
|
|
||||||
if (vars !== undefined) {
|
if (vars !== undefined) {
|
||||||
Object.keys(vars).map((k) => {
|
Object.keys(vars).map((k) => {
|
||||||
const regex = new RegExp(`{{${k}}}`, 'g');
|
const regex = new RegExp(`{{${k}}}`, 'g');
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { env } from '$env/dynamic/public';
|
||||||
|
|
||||||
import { getLocale } from '$lib/i18n';
|
import { getLocale } from '$lib/i18n';
|
||||||
import { H1, Lead, Paragraph, Small, Ul } from '$lib/ui/typography';
|
import { H1, Lead, Paragraph, Small } from '$lib/ui/typography';
|
||||||
|
|
||||||
import Logo from '$lib/logo/logo.svg?raw';
|
import Logo from '$lib/logo/logo.svg?raw';
|
||||||
import SkeletonLogo from '$lib/logo/skeleton.svg?raw';
|
import SkeletonLogo from '$lib/logo/skeleton.svg?raw';
|
||||||
@@ -34,7 +36,15 @@
|
|||||||
export let data;
|
export let data;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head><title>{$t('global:appname')}</title></svelte:head>
|
<svelte:head
|
||||||
|
><title>{$t('global:appname')}</title>{#if env?.PUBLIC_UMAMI_WEBSITE_ID}
|
||||||
|
<script
|
||||||
|
async
|
||||||
|
src="{env?.PUBLIC_UMAMI_URL}/script.js"
|
||||||
|
data-website-id={env?.PUBLIC_UMAMI_WEBSITE_ID}
|
||||||
|
></script>
|
||||||
|
{/if}</svelte:head
|
||||||
|
>
|
||||||
|
|
||||||
<div class="page my-2 p-4">
|
<div class="page my-2 p-4">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle_slugify(this: HTMLInputElement) {
|
function handle_slugify(this: HTMLInputElement) {
|
||||||
this.value = slugify(this.value);
|
shortcode = slugify(this.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
let date_picker_value: DateValue | undefined = today(getLocalTimeZone());
|
let date_picker_value: DateValue | undefined = today(getLocalTimeZone());
|
||||||
|
|||||||
@@ -333,7 +333,11 @@
|
|||||||
{$t('snapps:more:edit')}
|
{$t('snapps:more:edit')}
|
||||||
</Small>
|
</Small>
|
||||||
</a>
|
</a>
|
||||||
<a href="/{data.shortcode}" target="_blank" class="btn ms-4 self-center variant-filled-primary flex">
|
<a
|
||||||
|
href="/{data.shortcode}"
|
||||||
|
target="_blank"
|
||||||
|
class="btn ms-4 self-center variant-filled-primary flex"
|
||||||
|
>
|
||||||
<LinkIcon class="w-4 h-4" />
|
<LinkIcon class="w-4 h-4" />
|
||||||
<Small class="font-semibold">
|
<Small class="font-semibold">
|
||||||
{$t('snapps:visit')}
|
{$t('snapps:visit')}
|
||||||
@@ -399,9 +403,7 @@
|
|||||||
class="link"
|
class="link"
|
||||||
data-sveltekit-preload-data={false}
|
data-sveltekit-preload-data={false}
|
||||||
>
|
>
|
||||||
<Paragraph class="font-semibold"
|
<Paragraph class="font-semibold break-all">{'/' + data.url.shortcode}</Paragraph>
|
||||||
>{env.PUBLIC_URL + '/' + data.url.shortcode}</Paragraph
|
|
||||||
>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { readdirSync, readFileSync } from 'fs';
|
import { existsSync, readdirSync, readFileSync } from 'fs';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { env } from '$env/dynamic/private';
|
import { env } from '$env/dynamic/private';
|
||||||
import { json } from '@sveltejs/kit';
|
import { json } from '@sveltejs/kit';
|
||||||
@@ -13,6 +13,7 @@ export async function GET({ url: { searchParams } }) {
|
|||||||
// Function to load translations from JSON files
|
// Function to load translations from JSON files
|
||||||
|
|
||||||
const translations: Translations = {};
|
const translations: Translations = {};
|
||||||
|
if (!existsSync(translationsDirectory)) return json({});
|
||||||
|
|
||||||
const files = readdirSync(translationsDirectory);
|
const files = readdirSync(translationsDirectory);
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export async function GET() {
|
|||||||
|
|
||||||
if (!host || !pass || !port || !user)
|
if (!host || !pass || !port || !user)
|
||||||
return json({
|
return json({
|
||||||
message: EN['settings:app:smtp:not:working'],
|
message: EN?.['settings:app:smtp:not:working'],
|
||||||
active_smtp: false
|
active_smtp: false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ export async function GET() {
|
|||||||
};
|
};
|
||||||
const cached = await db.redis.get('cache:smtp:check');
|
const cached = await db.redis.get('cache:smtp:check');
|
||||||
if (cached === 'true')
|
if (cached === 'true')
|
||||||
return json({ message: EN['settings:app:smtp:working'], active_smtp: true });
|
return json({ message: EN?.['settings:app:smtp:working'], active_smtp: true });
|
||||||
|
|
||||||
const transporter = createTransport({ ...smtp } as TransportOptions);
|
const transporter = createTransport({ ...smtp } as TransportOptions);
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ export async function GET() {
|
|||||||
await db.redis.expire('cache:smtp:check', 60 * 60 * 24);
|
await db.redis.expire('cache:smtp:check', 60 * 60 * 24);
|
||||||
return json(
|
return json(
|
||||||
{
|
{
|
||||||
message: EN['settings:app:smtp:working'],
|
message: EN?.['settings:app:smtp:working'],
|
||||||
active_smtp: true
|
active_smtp: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ export async function GET() {
|
|||||||
state: 200,
|
state: 200,
|
||||||
active_smtp: false,
|
active_smtp: false,
|
||||||
error: err,
|
error: err,
|
||||||
message: EN['settings:app:smtp:not:working']
|
message: EN?.['settings:app:smtp:not:working']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user