Fix versioning and references; minor frontend fixes

This commit is contained in:
Michael Adams
2025-12-11 11:47:56 -08:00
parent 076e4c7e0e
commit b5dee3a49e
17 changed files with 4498 additions and 10116 deletions
+7
View File
@@ -48,3 +48,10 @@ yarn-error.log*
# Jetbrains specific (webstorm)
.idea/**/**
# IDE specific
.claude
.vscode
# Temp folder for generative work
/temp/**
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "pingvin-share-backend",
"version": "1.13.4",
"version": "1.13.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pingvin-share-backend",
"version": "1.13.4",
"version": "1.13.5",
"dependencies": {
"@aws-sdk/client-s3": "^3.787.0",
"@keyv/redis": "^4.4.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "pingvin-share-backend",
"version": "1.13.4",
"version": "1.13.5",
"scripts": {
"build": "nest build",
"dev": "cross-env NODE_ENV=development nest start --watch",
-1
View File
@@ -11,7 +11,6 @@ const withPWA = require("next-pwa")({
handler: 'NetworkOnly',
},
],
reloadOnOnline: false,
});
module.exports = withPWA({
+4404 -10079
View File
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "pingvin-share-frontend",
"version": "1.13.4",
"version": "1.13.5",
"scripts": {
"dev": "next dev",
"build": "next build",
@@ -11,13 +11,13 @@
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/server": "^11.11.0",
"@mantine/core": "^6.0.21",
"@mantine/dropzone": "^6.0.21",
"@mantine/form": "^6.0.21",
"@mantine/hooks": "^6.0.21",
"@mantine/modals": "^6.0.21",
"@mantine/next": "^6.0.21",
"@mantine/notifications": "^6.0.21",
"@mantine/core": "6.0.21",
"@mantine/dropzone": "6.0.21",
"@mantine/form": "6.0.21",
"@mantine/hooks": "6.0.21",
"@mantine/modals": "6.0.21",
"@mantine/next": "6.0.21",
"@mantine/notifications": "6.0.21",
"axios": "^1.7.7",
"cookies-next": "^4.2.1",
"file-saver": "^2.0.5",
+2 -2
View File
@@ -31,10 +31,10 @@ const Footer = () => {
Powered by{" "}
<Anchor
size="xs"
href="https://github.com/stonith404/pingvin-share"
href="https://github.com/smp46/pingvin-share-x"
target="_blank"
>
Pingvin Share
Pingvin Share X
</Anchor>
</Text>
<div>
+4 -2
View File
@@ -9,7 +9,8 @@ const useTranslate = () => {
values?: Parameters<typeof intl.formatMessage>[1],
opts?: Parameters<typeof intl.formatMessage>[2],
) => {
return intl.formatMessage({ id }, values, opts) as string;
const result = intl.formatMessage({ id }, values, opts);
return typeof result === 'string' ? result : String(result);
};
};
@@ -32,7 +33,8 @@ export const translateOutsideContext = () => {
values?: Parameters<typeof intl.formatMessage>[1],
opts?: Parameters<typeof intl.formatMessage>[2],
) => {
return intl.formatMessage({ id }, values, opts) as string;
const result = intl.formatMessage({ id }, values, opts);
return typeof result === 'string' ? result : String(result);
};
};
+59 -2
View File
@@ -11,6 +11,63 @@ export const config = {
matcher: "/((?!api|static|.*\\..*|_next).*)",
};
// In-memory cache for config to avoid fetching on every request
let configCache: { data: any; timestamp: number } | null = null;
const CONFIG_CACHE_TTL = 30 * 1000; // 30 seconds cache TTL
// Fetch config with caching and error handling
async function fetchConfig(apiUrl: string): Promise<any> {
const now = Date.now();
// Return cached config if still valid
if (configCache && now - configCache.timestamp < CONFIG_CACHE_TTL) {
return configCache.data;
}
try {
const response = await fetch(`${apiUrl}/api/configs`, {
next: { revalidate: 30 },
signal: AbortSignal.timeout(5000),
});
if (!response.ok) {
throw new Error(`Config fetch failed: ${response.status}`);
}
const data = await response.json();
// Update cache
configCache = { data, timestamp: now };
return data;
} catch (error) {
// If fetch fails but we have stale cache, use it as fallback
if (configCache) {
console.error("Config fetch failed, using stale cache:", error);
return configCache.data;
}
// If no cache available, return safe defaults
console.error("Config fetch failed with no cache, using defaults:", error);
return getDefaultConfig();
}
}
// Safe default configuration when API is unavailable
function getDefaultConfig() {
return [
{ key: "general.showHomePage", value: "true", defaultValue: "true", type: "boolean" },
{ key: "share.allowRegistration", value: "true", defaultValue: "true", type: "boolean" },
{ key: "share.allowUnauthenticatedShares", value: "false", defaultValue: "false", type: "boolean" },
{ key: "smtp.enabled", value: "false", defaultValue: "false", type: "boolean" },
{ key: "legal.enabled", value: "false", defaultValue: "false", type: "boolean" },
{ key: "legal.imprintText", value: "", defaultValue: "", type: "text" },
{ key: "legal.imprintUrl", value: "", defaultValue: "", type: "string" },
{ key: "legal.privacyPolicyText", value: "", defaultValue: "", type: "text" },
{ key: "legal.privacyPolicyUrl", value: "", defaultValue: "", type: "string" },
];
}
export async function middleware(request: NextRequest) {
const routes = {
unauthenticated: new Routes(["/auth/*", "/"]),
@@ -27,9 +84,9 @@ export async function middleware(request: NextRequest) {
disabled: new Routes([]),
};
// Get config from backend
// Get config from backend with caching and error handling
const apiUrl = process.env.API_URL || "http://localhost:8080";
const config = await (await fetch(`${apiUrl}/api/configs`)).json();
const config = await fetchConfig(apiUrl);
const getConfig = (key: string) => {
return configService.get(key, config);
+1 -1
View File
@@ -64,7 +64,7 @@ const Admin = () => {
title: "Update",
icon: TbRefresh,
route:
"https://github.com/stonith404/pingvin-share/releases/latest",
"https://github.com/smp46/pingvin-share-x/releases/latest",
},
]);
}
+2 -10
View File
@@ -27,20 +27,12 @@ const Intro = () => {
If you enjoy Pingvin Share please it on{" "}
<Anchor
target="_blank"
href="https://github.com/stonith404/pingvin-share"
href="https://github.com/smp46/pingvin-share-x"
>
GitHub
</Anchor>{" "}
or{" "}
<Anchor
target="_blank"
href="https://github.com/sponsors/stonith404"
>
buy me a coffee
</Anchor>{" "}
if you want to support my work.
</Text>
<Text>Enough talked, have fun with Pingvin Share!</Text>
<Text>Enough talked, have fun with Pingvin Share-X!</Text>
<Text mt="lg">How to you want to continue?</Text>
<Stack>
<Button href="/admin/config/general" component={Link}>
+1 -1
View File
@@ -166,7 +166,7 @@ export default function Home() {
</Button>
<Button
component={Link}
href="https://github.com/stonith404/pingvin-share"
href="https://github.com/smp46/pingvin-share-x"
target="_blank"
variant="default"
radius="xl"
+1 -1
View File
@@ -64,7 +64,7 @@ const sendTestEmail = async (email: string) => {
const isNewReleaseAvailable = async () => {
const response = (
await axios.get(
"https://api.github.com/repos/stonith404/pingvin-share/releases/latest",
"https://api.github.com/repos/smp46/pingvin-share-x/releases/latest",
)
).data;
return response.tag_name.replace("v", "") != process.env.VERSION;
+2 -2
View File
@@ -2,9 +2,9 @@ import {
SiDiscord,
SiGithub,
SiGoogle,
SiMicrosoft,
SiOpenid,
} from "react-icons/si";
import { FaMicrosoft } from "react-icons/fa";
import React from "react";
import api from "../services/api.service";
@@ -15,7 +15,7 @@ const getOAuthUrl = (appUrl: string, provider: string) => {
const getOAuthIcon = (provider: string) => {
return {
google: <SiGoogle />,
microsoft: <SiMicrosoft />,
microsoft: <FaMicrosoft />,
github: <SiGithub />,
discord: <SiDiscord />,
oidc: <SiOpenid />,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es2017",
"lib": [
"dom",
"dom.iterable",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "pingvin-share-x",
"version": "1.13.4",
"version": "1.13.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pingvin-share-x",
"version": "1.13.4",
"version": "1.13.5",
"devDependencies": {
"conventional-changelog-cli": "^3.0.0"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "pingvin-share-x",
"version": "1.13.4",
"version": "1.13.5",
"scripts": {
"format": "cd frontend && npm run format && cd ../backend && npm run format",
"lint": "cd frontend && npm run lint && cd ../backend && npm run lint",