0.7.1 fixes

This commit is contained in:
urania-dev
2024-03-06 10:46:06 +01:00
parent cd66be4fa8
commit 5d33bbbc88
10 changed files with 44 additions and 18 deletions

View File

@@ -64,4 +64,8 @@
- 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
- 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

View File

@@ -13,7 +13,7 @@ RUN npm i
COPY . /app
# Build the SvelteKit app
ENV SNAPP_VERSION=0.7.alpha
ENV SNAPP_VERSION=0.7.1
ENV AUTH_SECRET=lFNiU7T98/44Qlqb4hMUkVcLOpijEI7z722Kxhv4O2Y=
ENV DB_HOST=100.64.0.21
@@ -27,6 +27,8 @@ ENV DEFAULT_THEME=dark
ENV DEFAULT_LANG=en
ENV LOCALIZATION_FOLDER=/app/translations
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_RPM=0
ENV MAX_RPD=0

View File

@@ -92,7 +92,10 @@ services:
ports:
- 3000:3000
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
# See (Discussion about theming)[https://github.com/urania-dev/snapp/discussions/18]
networks:

View File

@@ -1,8 +1,11 @@
import { env } from "$env/dynamic/private";
import { readFile } from "fs/promises";
import { env } from '$env/dynamic/private';
import { existsSync } from 'fs';
import { readFile } from 'fs/promises';
export default async function getLanguage() {
try {
const exists = existsSync(`${env.LOCALIZATION_FOLDER}/${env.DEFAULT_LANG}.json`);
if (!exists) return [];
const jsonContent = JSON.parse(
await readFile(`${env.LOCALIZATION_FOLDER}/${env.DEFAULT_LANG}.json`, 'utf8')
);

View File

@@ -34,10 +34,11 @@ function translate(
) {
if (!translationKey) throw new Error('no key provided to $t()');
if (!localization || !Array.from(Object.entries(localization)).length) return translationKey;
let text = localization[translationKey];
if (!text) return translationKey;
if (vars !== undefined) {
Object.keys(vars).map((k) => {
const regex = new RegExp(`{{${k}}}`, 'g');

View File

@@ -1,6 +1,8 @@
<script>
import { env } from '$env/dynamic/public';
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 SkeletonLogo from '$lib/logo/skeleton.svg?raw';
@@ -34,7 +36,15 @@
export let data;
</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="flex items-center">

View File

@@ -58,7 +58,7 @@
}
function handle_slugify(this: HTMLInputElement) {
this.value = slugify(this.value);
shortcode = slugify(this.value);
}
let date_picker_value: DateValue | undefined = today(getLocalTimeZone());

View File

@@ -333,7 +333,11 @@
{$t('snapps:more:edit')}
</Small>
</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" />
<Small class="font-semibold">
{$t('snapps:visit')}
@@ -399,9 +403,7 @@
class="link"
data-sveltekit-preload-data={false}
>
<Paragraph class="font-semibold"
>{env.PUBLIC_URL + '/' + data.url.shortcode}</Paragraph
>
<Paragraph class="font-semibold break-all">{'/' + data.url.shortcode}</Paragraph>
</a>
</div>
<div class="flex flex-col gap-1">

View File

@@ -1,4 +1,4 @@
import { readdirSync, readFileSync } from 'fs';
import { existsSync, readdirSync, readFileSync } from 'fs';
import { resolve } from 'path';
import { env } from '$env/dynamic/private';
import { json } from '@sveltejs/kit';
@@ -13,6 +13,7 @@ export async function GET({ url: { searchParams } }) {
// Function to load translations from JSON files
const translations: Translations = {};
if (!existsSync(translationsDirectory)) return json({});
const files = readdirSync(translationsDirectory);

View File

@@ -12,7 +12,7 @@ export async function GET() {
if (!host || !pass || !port || !user)
return json({
message: EN['settings:app:smtp:not:working'],
message: EN?.['settings:app:smtp:not:working'],
active_smtp: false
});
@@ -27,7 +27,7 @@ export async function GET() {
};
const cached = await db.redis.get('cache:smtp:check');
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);
@@ -37,7 +37,7 @@ export async function GET() {
await db.redis.expire('cache:smtp:check', 60 * 60 * 24);
return json(
{
message: EN['settings:app:smtp:working'],
message: EN?.['settings:app:smtp:working'],
active_smtp: true
},
{
@@ -51,7 +51,7 @@ export async function GET() {
state: 200,
active_smtp: false,
error: err,
message: EN['settings:app:smtp:not:working']
message: EN?.['settings:app:smtp:not:working']
});
}
}