1
0
Fork 0

Merge branch 'main' into main

This commit is contained in:
theGrove 2024-04-23 11:59:21 +03:00 committed by GitHub
commit 28738ab176
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 653 additions and 352 deletions

View File

@ -1,3 +1,29 @@
## [0.23.1](https://github.com/stonith404/pingvin-share/compare/v0.23.0...v0.23.1) (2024-04-05)
### Bug Fixes
* **backend:** crash on unhandled promise rejections ([1da4fee](https://github.com/stonith404/pingvin-share/commit/1da4feeb895a13d0a0ae754bd716a84e8186d081))
* changing the chunk size needed an app restart ([24e100b](https://github.com/stonith404/pingvin-share/commit/24e100bd7be8bf20778bdf2767aa35cae8d7e502))
* disable js execution on raw file view ([9d1a12b](https://github.com/stonith404/pingvin-share/commit/9d1a12b0d1812214f1fe6fa56e3848091ce4945c))
* incorrect layout on 404 page ([3c5e0ad](https://github.com/stonith404/pingvin-share/commit/3c5e0ad5134ee2d405ac420152b5825102f65bfc))
* normal shares were added to the previous reverse share ([3972589](https://github.com/stonith404/pingvin-share/commit/3972589f76519b03074d916fb2460c795b1f0737))
* redirect vulnerability on error, sign in and totp page ([384fd19](https://github.com/stonith404/pingvin-share/commit/384fd19203b63eeb4b952f83a9e1eaab1b19b90d))
## [0.23.0](https://github.com/stonith404/pingvin-share/compare/v0.22.2...v0.23.0) (2024-04-04)
### Features
* add config variable to adjust chunk size ([0bfbaea](https://github.com/stonith404/pingvin-share/commit/0bfbaea49aad0c695fee6558c89c661687912e4f))
### Bug Fixes
* delete share files if user gets deleted ([e71f6cd](https://github.com/stonith404/pingvin-share/commit/e71f6cd1598ed87366074398042a6b88675587ca))
* error in logs if "allow unauthenticated shares" is enabled ([c6d8188](https://github.com/stonith404/pingvin-share/commit/c6d8188e4e33ba682551a3ca79205ff5a6d7ead5))
* memory leak while uploading files by disabling base64 encoding of chunks ([7a15fbb](https://github.com/stonith404/pingvin-share/commit/7a15fbb4651c2fee32fb4c1ee2c9d7f12323feb0))
## [0.22.2](https://github.com/stonith404/pingvin-share/compare/v0.22.1...v0.22.2) (2024-02-29)

View File

@ -1,12 +1,12 @@
{
"name": "pingvin-share-backend",
"version": "0.22.2",
"version": "0.23.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "pingvin-share-backend",
"version": "0.22.2",
"version": "0.23.1",
"dependencies": {
"@nestjs/cache-manager": "^2.1.0",
"@nestjs/common": "^10.1.2",

View File

@ -1,6 +1,6 @@
{
"name": "pingvin-share-backend",
"version": "0.22.2",
"version": "0.23.1",
"scripts": {
"build": "nest build",
"dev": "cross-env NODE_ENV=development nest start --watch",

View File

@ -51,6 +51,11 @@ const configVariables: ConfigVariables = {
type: "number",
defaultValue: "9",
},
chunkSize: {
type: "number",
defaultValue: "10000000",
secret: false,
},
},
email: {
enableShareEmailRecipients: {

View File

@ -99,7 +99,7 @@ export class AuthService {
include: { resetPasswordToken: true },
});
if (!user) throw new BadRequestException("User not found");
if (!user) return;
// Delete old reset password token
if (user.resetPasswordToken) {

View File

@ -26,18 +26,21 @@ export class FileController {
@SkipThrottle()
@UseGuards(CreateShareGuard, ShareOwnerGuard)
async create(
@Query() query: any,
@Query()
query: {
id: string;
name: string;
chunkIndex: string;
totalChunks: string;
},
@Body() body: string,
@Param("shareId") shareId: string,
) {
const { id, name, chunkIndex, totalChunks } = query;
// Data can be empty if the file is empty
const data = body.toString().split(",")[1] ?? "";
return await this.fileService.create(
data,
body,
{ index: parseInt(chunkIndex), total: parseInt(totalChunks) },
{ id, name },
shareId,
@ -72,6 +75,7 @@ export class FileController {
const headers = {
"Content-Type": file.metaData.mimeType,
"Content-Length": file.metaData.size,
"Content-Security-Policy": "script-src 'none'",
};
if (download === "true") {

View File

@ -47,7 +47,7 @@ export class FileService {
}
// If the sent chunk index and the expected chunk index doesn't match throw an error
const chunkSize = 10 * 1024 * 1024; // 10MB
const chunkSize = this.config.get("share.chunkSize");
const expectedChunkIndex = Math.ceil(diskFileSize / chunkSize);
if (expectedChunkIndex != chunk.index)

View File

@ -1,11 +1,17 @@
import { ClassSerializerInterceptor, ValidationPipe } from "@nestjs/common";
import {
ClassSerializerInterceptor,
Logger,
ValidationPipe,
} from "@nestjs/common";
import { NestFactory, Reflector } from "@nestjs/core";
import { NestExpressApplication } from "@nestjs/platform-express";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
import * as bodyParser from "body-parser";
import * as cookieParser from "cookie-parser";
import { NextFunction, Request, Response } from "express";
import * as fs from "fs";
import { AppModule } from "./app.module";
import { ConfigService } from "./config/config.service";
import { DATA_DIRECTORY } from "./constants";
async function bootstrap() {
@ -13,7 +19,16 @@ async function bootstrap() {
app.useGlobalPipes(new ValidationPipe({ whitelist: true }));
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector)));
app.use(bodyParser.raw({ type: "application/octet-stream", limit: "20mb" }));
const config = app.get<ConfigService>(ConfigService);
app.use((req: Request, res: Response, next: NextFunction) => {
const chunkSize = config.get("share.chunkSize");
bodyParser.raw({
type: "application/octet-stream",
limit: `${chunkSize}B`,
})(req, res, next);
});
app.use(cookieParser());
app.set("trust proxy", true);
@ -34,5 +49,8 @@ async function bootstrap() {
}
await app.listen(parseInt(process.env.PORT) || 8080);
const logger = new Logger("UnhandledAsyncError");
process.on("unhandledRejection", (e) => logger.error(e));
}
bootstrap();

View File

@ -1,12 +1,12 @@
{
"name": "pingvin-share-frontend",
"version": "0.22.2",
"version": "0.23.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "pingvin-share-frontend",
"version": "0.22.2",
"version": "0.23.1",
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0",

View File

@ -1,6 +1,6 @@
{
"name": "pingvin-share-frontend",
"version": "0.22.2",
"version": "0.23.1",
"scripts": {
"dev": "next dev",
"build": "next build",

View File

@ -25,6 +25,7 @@ import useTranslate from "../../hooks/useTranslate.hook";
import authService from "../../services/auth.service";
import { getOAuthIcon, getOAuthUrl } from "../../utils/oauth.util";
import toast from "../../utils/toast.util";
import { safeRedirectPath } from "../../utils/router.util";
const useStyles = createStyles((theme) => ({
or: {
@ -98,7 +99,7 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => {
);
} else {
await refreshUser();
router.replace(redirectPath);
router.replace(safeRedirectPath(redirectPath));
}
})
.catch(toast.axiosError);

View File

@ -6,15 +6,16 @@ import {
PinInput,
Title,
} from "@mantine/core";
import { useForm, yupResolver } from "@mantine/form";
import { useRouter } from "next/router";
import { useState } from "react";
import { FormattedMessage } from "react-intl";
import * as yup from "yup";
import useTranslate from "../../hooks/useTranslate.hook";
import { useForm, yupResolver } from "@mantine/form";
import { useState } from "react";
import authService from "../../services/auth.service";
import toast from "../../utils/toast.util";
import { useRouter } from "next/router";
import useUser from "../../hooks/user.hook";
import authService from "../../services/auth.service";
import { safeRedirectPath } from "../../utils/router.util";
import toast from "../../utils/toast.util";
function TotpForm({ redirectPath }: { redirectPath: string }) {
const t = useTranslate();
@ -46,7 +47,7 @@ function TotpForm({ redirectPath }: { redirectPath: string }) {
router.query.loginToken as string,
);
await refreshUser();
await router.replace(redirectPath);
await router.replace(safeRedirectPath(redirectPath));
} catch (e) {
toast.axiosError(e);
form.setFieldError("code", "error");

View File

@ -1,22 +1,19 @@
import { Button, Group } from "@mantine/core";
import { useModals } from "@mantine/modals";
import { cleanNotifications } from "@mantine/notifications";
import { AxiosError } from "axios";
import { useRouter } from "next/router";
import pLimit from "p-limit";
import { useEffect, useMemo, useState } from "react";
import { useEffect, useMemo, useRef, useState } from "react";
import { FormattedMessage } from "react-intl";
import Dropzone from "../../components/upload/Dropzone";
import FileList from "../../components/upload/FileList";
import showCompletedUploadModal from "../../components/upload/modals/showCompletedUploadModal";
import useConfig from "../../hooks/config.hook";
import useTranslate from "../../hooks/useTranslate.hook";
import shareService from "../../services/share.service";
import { FileListItem, FileMetaData, FileUpload } from "../../types/File.type";
import toast from "../../utils/toast.util";
import { useRouter } from "next/router";
const promiseLimit = pLimit(3);
const chunkSize = 10 * 1024 * 1024; // 10MB
let errorToastShown = false;
const EditableUpload = ({
@ -33,6 +30,8 @@ const EditableUpload = ({
const router = useRouter();
const config = useConfig();
const chunkSize = useRef(parseInt(config.get("share.chunkSize")));
const [existingFiles, setExistingFiles] =
useState<Array<FileMetaData & { deleted?: boolean }>>(savedFiles);
const [uploadingFiles, setUploadingFiles] = useState<FileUpload[]>([]);
@ -66,7 +65,7 @@ const EditableUpload = ({
const fileUploadPromises = files.map(async (file, fileIndex) =>
// Limit the number of concurrent uploads to 3
promiseLimit(async () => {
let fileId: string;
let fileId: string | undefined;
const setFileProgress = (progress: number) => {
setUploadingFiles((files) =>
@ -81,38 +80,30 @@ const EditableUpload = ({
setFileProgress(1);
let chunks = Math.ceil(file.size / chunkSize);
let chunks = Math.ceil(file.size / chunkSize.current);
// If the file is 0 bytes, we still need to upload 1 chunk
if (chunks == 0) chunks++;
for (let chunkIndex = 0; chunkIndex < chunks; chunkIndex++) {
const from = chunkIndex * chunkSize;
const to = from + chunkSize;
const from = chunkIndex * chunkSize.current;
const to = from + chunkSize.current;
const blob = file.slice(from, to);
try {
await new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = async (event) =>
await shareService
.uploadFile(
shareId,
event,
{
id: fileId,
name: file.name,
},
chunkIndex,
chunks,
)
.then((response) => {
fileId = response.id;
resolve(response);
})
.catch(reject);
reader.readAsDataURL(blob);
});
await shareService
.uploadFile(
shareId,
blob,
{
id: fileId,
name: file.name,
},
chunkIndex,
chunks,
)
.then((response) => {
fileId = response.id;
});
setFileProgress(((chunkIndex + 1) / chunks) * 100);
} catch (e) {

View File

@ -11,7 +11,7 @@ import dutch from "./translations/nl-BE";
import polish from "./translations/pl-PL";
import portuguese from "./translations/pt-BR";
import russian from "./translations/ru-RU";
import ukrainian from "./translations/ua-UA";
import ukrainian from "./translations/uk-UA";
import slovenian from "./translations/sl-SI";
import serbian from "./translations/sr-SP";
import swedish from "./translations/sv-SE";

View File

@ -432,7 +432,9 @@ export default {
"admin.config.share.zip-compression-level": "Zip compression level",
"admin.config.share.zip-compression-level.description":
"Adjust the level to balance between file size and compression speed. Valid values range from 0 to 9, with 0 being no compression and 9 being maximum compression. ",
"admin.config.share.chunk-size": "Chunk size",
"admin.config.share.chunk-size.description": "Adjust the chunk size (in bytes) for your uploads to balance efficiency and reliability according to your internet connection. Smaller chunks can enhance success rates for unstable connections, while larger chunks speed up uploads for stable connections.",
"admin.config.smtp.enabled": "Enabled",
"admin.config.smtp.enabled.description":
"Whether SMTP is enabled. Only set this to true if you entered the host, port, email, user and password of your SMTP server.",

View File

@ -4,33 +4,24 @@ export default {
"navbar.signin": "Sign in",
"navbar.home": "Home",
"navbar.signup": "Sign Up",
"navbar.links.shares": "My shares",
"navbar.links.reverse": "Reverse shares",
"navbar.avatar.account": "My account",
"navbar.avatar.admin": "Administration",
"navbar.avatar.signout": "Sign out",
// END navbar
// /
"home.title": "A <h>self-hosted</h> file sharing platform.",
"home.description":
"Do you really want to give your personal files in the hand of third parties like WeTransfer?",
"home.description": "Do you really want to give your personal files in the hand of third parties like WeTransfer?",
"home.bullet.a.name": "Self-Hosted",
"home.bullet.a.description": "Host Pingvin Share on your own machine.",
"home.bullet.b.name": "Privacy",
"home.bullet.b.description":
"Your files are your files and should never get into the hands of third parties.",
"home.bullet.b.description": "Your files are your files and should never get into the hands of third parties.",
"home.bullet.c.name": "No annoying file size limit",
"home.bullet.c.description":
"Upload as big files as you want. Only your hard drive will be your limit.",
"home.bullet.c.description": "Upload as big files as you want. Only your hard drive will be your limit.",
"home.button.start": "Get started",
"home.button.source": "Source code",
// END /
// /auth/signin
"signin.title": "Welcome back",
"signin.description": "You don't have an account yet?",
@ -41,17 +32,14 @@ export default {
"signin.input.password.placeholder": "Your password",
"signin.button.submit": "Sign in",
"signIn.notify.totp-required.title": "Two-factor authentication required",
"signIn.notify.totp-required.description":
"Please enter your two-factor authentication code",
"signIn.notify.totp-required.description": "Please enter your two-factor authentication code",
"signIn.oauth.or": "OR",
"signIn.oauth.github": "GitHub",
"signIn.oauth.google": "Google",
"signIn.oauth.microsoft": "Microsoft",
"signIn.oauth.discord": "Discord",
"signIn.oauth.oidc": "OpenID",
// END /auth/signin
// /auth/signup
"signup.title": "Create an account",
"signup.description": "Already have an account?",
@ -61,42 +49,31 @@ export default {
"signup.input.email": "Email",
"signup.input.email.placeholder": "Your email",
"signup.button.submit": "Let's get started",
// END /auth/signup
// /auth/totp
"totp.title": "TOTP Authentication",
"totp.button.signIn": "Sign in",
// END /auth/totp
// /auth/reset-password
"resetPassword.title": "Forgot your password?",
"resetPassword.description": "Enter your email to reset your password.",
"resetPassword.notify.success":
"A message with a link to reset your password has been sent if the email exists.",
"resetPassword.notify.success": "A message with a link to reset your password has been sent if the email exists.",
"resetPassword.button.back": "Back to sign in page",
"resetPassword.text.resetPassword": "Reset password",
"resetPassword.text.enterNewPassword": "Enter your new password",
"resetPassword.input.password": "New password",
"resetPassword.notify.passwordReset":
"Your password has been reset successfully.",
"resetPassword.notify.passwordReset": "Your password has been reset successfully.",
// /account
"account.title": "My account",
"account.card.info.title": "Account info",
"account.card.info.username": "Username",
"account.card.info.email": "Email",
"account.notify.info.success": "Account updated successfully",
"account.card.password.title": "Password",
"account.card.password.old": "Old password",
"account.card.password.new": "New password",
"account.card.password.noPasswordSet":
"You don't have a password set. If you want to sign in with email and password you need to set a password.",
"account.card.password.noPasswordSet": "You don't have a password set. If you want to sign in with email and password you need to set a password.",
"account.notify.password.success": "Password changed successfully",
"account.card.oauth.title": "Social login",
"account.card.oauth.github": "GitHub",
"account.card.oauth.google": "Google",
@ -107,15 +84,11 @@ export default {
"account.card.oauth.unlink": "Unlink",
"account.card.oauth.unlinked": "Unlinked",
"account.modal.unlink.title": "Unlink account",
"account.modal.unlink.description":
"Unlinking your social accounts may cause you to lose your account if you don't remember your username and password.",
"account.modal.unlink.description": "Unlinking your social accounts may cause you to lose your account if you don't remember your username and password.",
"account.notify.oauth.unlinked.success": "Unlinked successfully",
"account.card.security.title": "Security",
"account.card.security.totp.enable.description":
"Enter your current password to start enabling TOTP",
"account.card.security.totp.disable.description":
"Enter your current password to disable TOTP",
"account.card.security.totp.enable.description": "Enter your current password to start enabling TOTP",
"account.card.security.totp.disable.description": "Enter your current password to disable TOTP",
"account.card.security.totp.button.start": "Start",
"account.modal.totp.title": "Enable TOTP",
"account.modal.totp.step1": "Step 1: Add your authenticator",
@ -126,29 +99,22 @@ export default {
"account.modal.totp.verify": "Verify",
"account.notify.totp.disable": "TOTP disabled successfully",
"account.notify.totp.enable": "TOTP enabled successfully",
"account.card.language.title": "Language",
"account.card.language.description":
"The project is translated by the community. Some languages might be incomplete.",
"account.card.language.description": "The project is translated by the community. Some languages might be incomplete.",
"account.card.color.title": "Color scheme",
// ThemeSwitcher.tsx
"account.theme.dark": "Dark",
"account.theme.light": "Light",
"account.theme.system": "System",
"account.button.delete": "Delete Account",
"account.modal.delete.title": "Delete Account",
"account.modal.delete.description":
"Do you really want to delete your account including all your active shares?",
"account.modal.delete.description": "Do you really want to delete your account including all your active shares?",
// END /account
// /account/shares
"account.shares.title": "My shares",
"account.shares.title.empty": "It's empty here 👀",
"account.shares.description.empty": "You don't have any shares.",
"account.shares.button.create": "Create one",
"account.shares.info.title": "Share informations",
"account.shares.table.id": "ID",
"account.shares.table.name": "Name",
@ -157,25 +123,16 @@ export default {
"account.shares.table.expiresAt": "Expires at",
"account.shares.table.createdAt": "Created at",
"account.shares.table.size": "Size",
"account.shares.modal.share-informations": "Share informations",
"account.shares.modal.share-link": "Share link",
"account.shares.modal.delete.title": "Delete share {share}",
"account.shares.modal.delete.description":
"Do you really want to delete this share?",
"account.shares.modal.delete.description": "Do you really want to delete this share?",
// END /account/shares
// /account/reverseShares
"account.reverseShares.title": "Reverse shares",
"account.reverseShares.description":
"A reverse share allows you to generate a unique URL that allows external users to create a share.",
"account.reverseShares.description": "A reverse share allows you to generate a unique URL that allows external users to create a share.",
"account.reverseShares.title.empty": "It's empty here 👀",
"account.reverseShares.description.empty":
"You don't have any reverse shares.",
"account.reverseShares.description.empty": "You don't have any reverse shares.",
// showCreateReverseShareModal.tsx
"account.reverseShares.modal.title": "Create reverse share",
"account.reverseShares.modal.expiration.label": "Expiration",
@ -191,20 +148,13 @@ export default {
"account.reverseShares.modal.expiration.month-plural": "Months",
"account.reverseShares.modal.expiration.year-singular": "Year",
"account.reverseShares.modal.expiration.year-plural": "Years",
"account.reverseShares.modal.max-size.label": "Max share size",
"account.reverseShares.modal.send-email": "Send email notification",
"account.reverseShares.modal.send-email.description":
"Send an email notification when a share is created with this reverse share link.",
"account.reverseShares.modal.send-email.description": "Send an email notification when a share is created with this reverse share link.",
"account.reverseShares.modal.max-use.label": "Max uses",
"account.reverseShares.modal.max-use.description":
"The maximum amount of times this URL can be used to create a share.",
"account.reverseShares.modal.max-use.description": "The maximum amount of times this URL can be used to create a share.",
"account.reverseShare.never-expires": "This reverse share will never expire.",
"account.reverseShare.expires-on":
"This reverse share will expire on {expiration}.",
"account.reverseShare.expires-on": "This reverse share will expire on {expiration}.",
"account.reverseShares.table.no-shares": "No shares created yet",
"account.reverseShares.table.count.singular": "share",
"account.reverseShares.table.count.plural": "shares",
@ -212,86 +162,59 @@ export default {
"account.reverseShares.table.remaining": "Remaining uses",
"account.reverseShares.table.max-size": "Max share size",
"account.reverseShares.table.expires": "Expires at",
"account.reverseShares.modal.reverse-share-link": "Reverse share link",
"account.reverseShares.modal.delete.title": "Delete reverse share",
"account.reverseShares.modal.delete.description":
"Do you really want to delete this reverse share? If you do, the associated shares will be deleted as well.",
"account.reverseShares.modal.delete.description": "Do you really want to delete this reverse share? If you do, the associated shares will be deleted as well.",
// END /account/reverseShares
// /admin
"admin.title": "Administration",
"admin.button.users": "User management",
"admin.button.config": "Configuration",
"admin.version": "Version",
// END /admin
// /admin/users
"admin.users.title": "User management",
"admin.users.table.username": "Username",
"admin.users.table.email": "Email",
"admin.users.table.admin": "Admin",
"admin.users.edit.update.title": "Update user {username}",
"admin.users.edit.update.admin-privileges": "Admin privileges",
"admin.users.edit.update.change-password.title": "Change password",
"admin.users.edit.update.change-password.field": "New password",
"admin.users.edit.update.change-password.button": "Save new password",
"admin.users.edit.update.notify.password.success":
"Password changed successfully",
"admin.users.edit.update.notify.password.success": "Password changed successfully",
"admin.users.edit.delete.title": "Delete user {username}",
"admin.users.edit.delete.description":
"Do you really want to delete this user and all his shares?",
"admin.users.edit.delete.description": "Do you really want to delete this user and all his shares?",
// showCreateUserModal.tsx
"admin.users.modal.create.title": "Create user",
"admin.users.modal.create.username": "Username",
"admin.users.modal.create.email": "Email",
"admin.users.modal.create.password": "Password",
"admin.users.modal.create.manual-password": "Set password manually",
"admin.users.modal.create.manual-password.description":
"If not checked, the user will receive an email with a link to set their password.",
"admin.users.modal.create.manual-password.description": "If not checked, the user will receive an email with a link to set their password.",
"admin.users.modal.create.admin": "Admin privileges",
"admin.users.modal.create.admin.description":
"If checked, the user will be able to access the admin panel.",
"admin.users.modal.create.admin.description": "If checked, the user will be able to access the admin panel.",
// END /admin/users
// /upload
"upload.title": "Upload",
"upload.notify.generic-error":
"An error occurred while finishing your share.",
"upload.notify.generic-error": "An error occurred while finishing your share.",
"upload.notify.count-failed": "{count} files failed to upload. Trying again.",
// Dropzone.tsx
"upload.dropzone.title": "Upload files",
"upload.dropzone.description":
"Drag'n'drop files here to start your share. We can accept only files that are less than {maxSize} in total.",
"upload.dropzone.notify.file-too-big":
"Your files exceed the maximum share size of {maxSize}.",
"upload.dropzone.description": "Drag'n'drop files here to start your share. We can accept only files that are less than {maxSize} in total.",
"upload.dropzone.notify.file-too-big": "Your files exceed the maximum share size of {maxSize}.",
// FileList.tsx
"upload.filelist.name": "Name",
"upload.filelist.size": "Size",
// showCreateUploadModal.tsx
"upload.modal.title": "Create Share",
"upload.modal.link.error.invalid":
"Can only contain letters, numbers, underscores, and hyphens",
"upload.modal.link.error.invalid": "Can only contain letters, numbers, underscores, and hyphens",
"upload.modal.link.error.taken": "This link is already in use",
"upload.modal.not-signed-in": "You're not signed in",
"upload.modal.not-signed-in-description":
"You will be unable to delete your share manually and view the visitor count.",
"upload.modal.not-signed-in-description": "You will be unable to delete your share manually and view the visitor count.",
"upload.modal.expires.never": "never",
"upload.modal.expires.never-long": "Never Expires",
"upload.modal.expires.error.too-long":
"Expiration exceeds maximum expiration date of {max}.",
"upload.modal.expires.error.too-long": "Expiration exceeds maximum expiration date of {max}.",
"upload.modal.link.label": "Link",
"upload.modal.expires.label": "Expiration",
"upload.modal.expires.minute-singular": "Minute",
@ -306,68 +229,47 @@ export default {
"upload.modal.expires.month-plural": "Months",
"upload.modal.expires.year-singular": "Year",
"upload.modal.expires.year-plural": "Years",
"upload.modal.accordion.description.title": "Description",
"upload.modal.accordion.description.placeholder":
"Note for the recipients of this share",
"upload.modal.accordion.description.placeholder": "Note for the recipients of this share",
"upload.modal.accordion.email.title": "Email recipients",
"upload.modal.accordion.email.placeholder": "Enter email recipients",
"upload.modal.accordion.email.invalid-email": "Invalid email address",
"upload.modal.accordion.security.title": "Security options",
"upload.modal.accordion.security.password.label": "Password protection",
"upload.modal.accordion.security.password.placeholder": "No password",
"upload.modal.accordion.security.max-views.label": "Maximum views",
"upload.modal.accordion.security.max-views.placeholder": "No limit",
// showCompletedUploadModal.tsx
"upload.modal.completed.never-expires": "This share will never expire.",
"upload.modal.completed.expires-on":
"This share will expire on {expiration}.",
"upload.modal.completed.expires-on": "This share will expire on {expiration}.",
"upload.modal.completed.share-ready": "Share ready",
// END /upload
// /share/[id]
"share.title": "Share {shareId}",
"share.description": "Look what I've shared with you!",
"share.error.visitor-limit-exceeded.title": "Visitor limit exceeded",
"share.error.visitor-limit-exceeded.description":
"The visitor limit from this share has been exceeded.",
"share.error.visitor-limit-exceeded.description": "The visitor limit from this share has been exceeded.",
"share.error.removed.title": "Share removed",
"share.error.not-found.title": "Share not found",
"share.error.not-found.description":
"The share you're looking for doesn't exist.",
"share.error.not-found.description": "The share you're looking for doesn't exist.",
"share.modal.password.title": "Password required",
"share.modal.password.description":
"To access this share please enter the password for the share.",
"share.modal.password.description": "To access this share please enter the password for the share.",
"share.modal.password": "Password",
"share.modal.error.invalid-password": "Invalid password",
"share.button.download-all": "Download all",
"share.notify.download-all-preparing":
"The share is preparing. Try again in a few minutes.",
"share.notify.download-all-preparing": "The share is preparing. Try again in a few minutes.",
"share.modal.file-link": "File link",
"share.table.name": "Name",
"share.table.size": "Size",
"share.modal.file-preview.error.not-supported.title": "Preview not supported",
"share.modal.file-preview.error.not-supported.description":
"A preview for this file type is unsupported. Please download the file to view it.",
"share.modal.file-preview.error.not-supported.description": "A preview for this file type is unsupported. Please download the file to view it.",
// END /share/[id]
// /share/[id]/edit
"share.edit.title": "Edit {shareId}",
"share.edit.append-upload": "Append file",
"share.edit.notify.generic-error":
"An error occurred while finishing your share.",
"share.edit.notify.generic-error": "An error occurred while finishing your share.",
"share.edit.notify.save-success": "Share updated successfully",
// END /share/[id]/edit
// /admin/config
"admin.config.title": "Configuration",
"admin.config.category.general": "General",
@ -375,175 +277,121 @@ export default {
"admin.config.category.email": "Email",
"admin.config.category.smtp": "SMTP",
"admin.config.category.oauth": "Social Login",
"admin.config.general.app-name": "App name",
"admin.config.general.app-name.description": "Name of the application",
"admin.config.general.app-url": "App URL",
"admin.config.general.app-url.description":
"On which URL Pingvin Share is available",
"admin.config.general.app-url.description": "On which URL Pingvin Share is available",
"admin.config.general.show-home-page": "Show home page",
"admin.config.general.show-home-page.description":
"Whether to show the home page",
"admin.config.general.show-home-page.description": "Whether to show the home page",
"admin.config.general.logo": "Logo",
"admin.config.general.logo.description":
"Change your logo by uploading a new image. The image must be a PNG and should have the format 1:1.",
"admin.config.general.logo.description": "Change your logo by uploading a new image. The image must be a PNG and should have the format 1:1.",
"admin.config.general.logo.placeholder": "Pick image",
"admin.config.email.enable-share-email-recipients":
"Enable share email recipients",
"admin.config.email.enable-share-email-recipients.description":
"Whether to allow emails to share recipients. Only enable this if you have enabled SMTP.",
"admin.config.email.enable-share-email-recipients": "Enable share email recipients",
"admin.config.email.enable-share-email-recipients.description": "Whether to allow emails to share recipients. Only enable this if you have enabled SMTP.",
"admin.config.email.share-recipients-subject": "Share recipients subject",
"admin.config.email.share-recipients-subject.description":
"Subject of the email which gets sent to the share recipients.",
"admin.config.email.share-recipients-subject.description": "Subject of the email which gets sent to the share recipients.",
"admin.config.email.share-recipients-message": "Share recipients message",
"admin.config.email.share-recipients-message.description":
"Message which gets sent to the share recipients. Available variables:\n {creator} - The username of the creator of the share\n {shareUrl} - The URL of the share\n {desc} - The description of the share\n {expires} - The expiration date of the share\n The variables will be replaced with the actual value.",
"admin.config.email.share-recipients-message.description": "Message which gets sent to the share recipients. Available variables:\n {creator} - The username of the creator of the share\n {shareUrl} - The URL of the share\n {desc} - The description of the share\n {expires} - The expiration date of the share\n The variables will be replaced with the actual value.",
"admin.config.email.reverse-share-subject": "Reverse share subject",
"admin.config.email.reverse-share-subject.description":
"Subject of the email which gets sent when someone created a share with your reverse share link.",
"admin.config.email.reverse-share-subject.description": "Subject of the email which gets sent when someone created a share with your reverse share link.",
"admin.config.email.reverse-share-message": "Reverse share message",
"admin.config.email.reverse-share-message.description":
"Message which gets sent when someone created a share with your reverse share link. {shareUrl} will be replaced with the creator's name and the share URL.",
"admin.config.email.reverse-share-message.description": "Message which gets sent when someone created a share with your reverse share link. {shareUrl} will be replaced with the creator's name and the share URL.",
"admin.config.email.reset-password-subject": "Reset password subject",
"admin.config.email.reset-password-subject.description":
"Subject of the email which gets sent when a user requests a password reset.",
"admin.config.email.reset-password-subject.description": "Subject of the email which gets sent when a user requests a password reset.",
"admin.config.email.reset-password-message": "Reset password message",
"admin.config.email.reset-password-message.description":
"Message which gets sent when a user requests a password reset. {url} will be replaced with the reset password URL.",
"admin.config.email.reset-password-message.description": "Message which gets sent when a user requests a password reset. {url} will be replaced with the reset password URL.",
"admin.config.email.invite-subject": "Invite subject",
"admin.config.email.invite-subject.description":
"Subject of the email which gets sent when an admin invites a user.",
"admin.config.email.invite-subject.description": "Subject of the email which gets sent when an admin invites a user.",
"admin.config.email.invite-message": "Invite message",
"admin.config.email.invite-message.description":
"Message which gets sent when an admin invites a user. {url} will be replaced with the invite URL and {password} with the password.",
"admin.config.email.invite-message.description": "Message which gets sent when an admin invites a user. {url} will be replaced with the invite URL and {password} with the password.",
"admin.config.share.allow-registration": "Allow registration",
"admin.config.share.allow-registration.description":
"Whether registration is allowed",
"admin.config.share.allow-unauthenticated-shares":
"Allow unauthenticated shares",
"admin.config.share.allow-unauthenticated-shares.description":
"Whether unauthenticated users can create shares",
"admin.config.share.allow-registration.description": "Whether registration is allowed",
"admin.config.share.allow-unauthenticated-shares": "Allow unauthenticated shares",
"admin.config.share.allow-unauthenticated-shares.description": "Whether unauthenticated users can create shares",
"admin.config.share.max-expiration": "Max expiration",
"admin.config.share.max-expiration.description":
"Maximum share expiration in hours. Set to 0 to allow unlimited expiration.",
"admin.config.share.max-expiration.description": "Maximum share expiration in hours. Set to 0 to allow unlimited expiration.",
"admin.config.share.max-size": "Max size",
"admin.config.share.max-size.description": "Maximum share size in bytes",
"admin.config.share.zip-compression-level": "Zip compression level",
"admin.config.share.zip-compression-level.description":
"Adjust the level to balance between file size and compression speed. Valid values range from 0 to 9, with 0 being no compression and 9 being maximum compression. ",
"admin.config.share.zip-compression-level.description": "Adjust the level to balance between file size and compression speed. Valid values range from 0 to 9, with 0 being no compression and 9 being maximum compression. ",
"admin.config.smtp.enabled": "Enabled",
"admin.config.smtp.enabled.description":
"Whether SMTP is enabled. Only set this to true if you entered the host, port, email, user and password of your SMTP server.",
"admin.config.smtp.enabled.description": "Whether SMTP is enabled. Only set this to true if you entered the host, port, email, user and password of your SMTP server.",
"admin.config.smtp.host": "Host",
"admin.config.smtp.host.description": "Host of the SMTP server",
"admin.config.smtp.port": "Port",
"admin.config.smtp.port.description": "Port of the SMTP server",
"admin.config.smtp.email": "Email",
"admin.config.smtp.email.description":
"Email address which the emails get sent from",
"admin.config.smtp.email.description": "Email address which the emails get sent from",
"admin.config.smtp.username": "Username",
"admin.config.smtp.username.description": "Username of the SMTP server",
"admin.config.smtp.password": "Password",
"admin.config.smtp.password.description": "Password of the SMTP server",
"admin.config.smtp.button.test": "Send test email",
"admin.config.oauth.allow-registration": "Allow registration",
"admin.config.oauth.allow-registration.description":
"Allow users to register via social login",
"admin.config.oauth.allow-registration.description": "Allow users to register via social login",
"admin.config.oauth.ignore-totp": "Ignore TOTP",
"admin.config.oauth.ignore-totp.description":
"Whether to ignore TOTP when user using social login",
"admin.config.oauth.ignore-totp.description": "Whether to ignore TOTP when user using social login",
"admin.config.oauth.github-enabled": "GitHub",
"admin.config.oauth.github-enabled.description":
"Whether GitHub login is enabled",
"admin.config.oauth.github-enabled.description": "Whether GitHub login is enabled",
"admin.config.oauth.github-client-id": "GitHub Client ID",
"admin.config.oauth.github-client-id.description":
"Client ID of the GitHub OAuth app",
"admin.config.oauth.github-client-id.description": "Client ID of the GitHub OAuth app",
"admin.config.oauth.github-client-secret": "GitHub Client secret",
"admin.config.oauth.github-client-secret.description":
"Client secret of the GitHub OAuth app",
"admin.config.oauth.github-client-secret.description": "Client secret of the GitHub OAuth app",
"admin.config.oauth.google-enabled": "Google",
"admin.config.oauth.google-enabled.description":
"Whether Google login is enabled",
"admin.config.oauth.google-enabled.description": "Whether Google login is enabled",
"admin.config.oauth.google-client-id": "Google Client ID",
"admin.config.oauth.google-client-id.description":
"Client ID of the Google OAuth app",
"admin.config.oauth.google-client-id.description": "Client ID of the Google OAuth app",
"admin.config.oauth.google-client-secret": "Google Client secret",
"admin.config.oauth.google-client-secret.description":
"Client secret of the Google OAuth app",
"admin.config.oauth.google-client-secret.description": "Client secret of the Google OAuth app",
"admin.config.oauth.microsoft-enabled": "Microsoft",
"admin.config.oauth.microsoft-enabled.description":
"Whether Microsoft login is enabled",
"admin.config.oauth.microsoft-enabled.description": "Whether Microsoft login is enabled",
"admin.config.oauth.microsoft-tenant": "Microsoft Tenant",
"admin.config.oauth.microsoft-tenant.description":
"Tenant ID of the Microsoft OAuth app\ncommon: Users with both a personal Microsoft account and a work or school account from Microsoft Entra ID can sign in to the application. organizations: Only users with work or school accounts from Microsoft Entra ID can sign in to the application.\nconsumers: Only users with a personal Microsoft account can sign in to the application.\ndomain name of the Microsoft Entra tenant or the tenant ID in GUID format: Only users from a specific Microsoft Entra tenant (directory members with a work or school account or directory guests with a personal Microsoft account) can sign in to the application.",
"admin.config.oauth.microsoft-tenant.description": "Tenant ID of the Microsoft OAuth app\ncommon: Users with both a personal Microsoft account and a work or school account from Microsoft Entra ID can sign in to the application. organizations: Only users with work or school accounts from Microsoft Entra ID can sign in to the application.\nconsumers: Only users with a personal Microsoft account can sign in to the application.\ndomain name of the Microsoft Entra tenant or the tenant ID in GUID format: Only users from a specific Microsoft Entra tenant (directory members with a work or school account or directory guests with a personal Microsoft account) can sign in to the application.",
"admin.config.oauth.microsoft-client-id": "Microsoft Client ID",
"admin.config.oauth.microsoft-client-id.description":
"Client ID of the Microsoft OAuth app",
"admin.config.oauth.microsoft-client-id.description": "Client ID of the Microsoft OAuth app",
"admin.config.oauth.microsoft-client-secret": "Microsoft Client secret",
"admin.config.oauth.microsoft-client-secret.description":
"Client secret of the Microsoft OAuth app",
"admin.config.oauth.microsoft-client-secret.description": "Client secret of the Microsoft OAuth app",
"admin.config.oauth.discord-enabled": "Discord",
"admin.config.oauth.discord-enabled.description":
"Whether Discord login is enabled",
"admin.config.oauth.discord-enabled.description": "Whether Discord login is enabled",
"admin.config.oauth.discord-limited-guild": "Discord limited server ID",
"admin.config.oauth.discord-limited-guild.description":
"Limit signing in to users in a specific server. Leave it blank to disable.",
"admin.config.oauth.discord-limited-guild.description": "Limit signing in to users in a specific server. Leave it blank to disable.",
"admin.config.oauth.discord-client-id": "Discord Client ID",
"admin.config.oauth.discord-client-id.description":
"Client ID of the Discord OAuth app",
"admin.config.oauth.discord-client-id.description": "Client ID of the Discord OAuth app",
"admin.config.oauth.discord-client-secret": "Discord Client secret",
"admin.config.oauth.discord-client-secret.description":
"Client secret of the Discord OAuth app",
"admin.config.oauth.discord-client-secret.description": "Client secret of the Discord OAuth app",
"admin.config.oauth.oidc-enabled": "OpenID Connect",
"admin.config.oauth.oidc-enabled.description":
"Whether OpenID Connect login is enabled",
"admin.config.oauth.oidc-enabled.description": "Whether OpenID Connect login is enabled",
"admin.config.oauth.oidc-discovery-uri": "OpenID Connect Discovery URI",
"admin.config.oauth.oidc-discovery-uri.description":
"Discovery URI of the OpenID Connect OAuth app",
"admin.config.oauth.oidc-discovery-uri.description": "Discovery URI of the OpenID Connect OAuth app",
"admin.config.oauth.oidc-username-claim": "OpenID Connect username claim",
"admin.config.oauth.oidc-username-claim.description":
"Username claim in OpenID Connect ID token. Leave it blank if you don't know what this config is.",
"admin.config.oauth.oidc-username-claim.description": "Username claim in OpenID Connect ID token. Leave it blank if you don't know what this config is.",
"admin.config.oauth.oidc-client-id": "OpenID Connect Client ID",
"admin.config.oauth.oidc-client-id.description":
"Client ID of the OpenID Connect OAuth app",
"admin.config.oauth.oidc-client-id.description": "Client ID of the OpenID Connect OAuth app",
"admin.config.oauth.oidc-client-secret": "OpenID Connect Client secret",
"admin.config.oauth.oidc-client-secret.description":
"Client secret of the OpenID Connect OAuth app",
"admin.config.oauth.oidc-client-secret.description": "Client secret of the OpenID Connect OAuth app",
// 404
"404.description": "Oops this page doesn't exist.",
"404.button.home": "Bring me back home",
// error
"error.title": "Error",
"error.description": "Oops!",
"error.button.back": "Go back",
"error.msg.default": "Something went wrong.",
"error.msg.access_denied":
"You canceled the authentication process, please try again.",
"error.msg.expired_token":
"The authentication process took too long, please try again.",
"error.msg.access_denied": "You canceled the authentication process, please try again.",
"error.msg.expired_token": "The authentication process took too long, please try again.",
"error.msg.invalid_token": "Internal Error",
"error.msg.no_user": "User linked to this {0} account doesn't exist.",
"error.msg.no_email": "Can't get email address from this {0} account.",
"error.msg.already_linked":
"This {0} account is already linked to another account.",
"error.msg.already_linked": "This {0} account is already linked to another account.",
"error.msg.not_linked": "This {0} account haven't linked to any account yet.",
"error.msg.unverified_account":
"This {0} account is unverified, please try again after verification.",
"error.msg.discord_guild_permission_denied":
"You are not allowed to sign in.",
"error.msg.cannot_get_user_info":
"Can not get your user info from this {0} account.",
"error.msg.unverified_account": "This {0} account is unverified, please try again after verification.",
"error.msg.discord_guild_permission_denied": "You are not allowed to sign in.",
"error.msg.cannot_get_user_info": "Can not get your user info from this {0} account.",
"error.param.provider_github": "GitHub",
"error.param.provider_google": "Google",
"error.param.provider_microsoft": "Microsoft",
"error.param.provider_discord": "Discord",
"error.param.provider_oidc": "OpenID Connect",
// Common translations
"common.button.save": "Save",
"common.button.create": "Create",
@ -562,7 +410,6 @@ export default {
"common.button.go-home": "Go home",
"common.notify.copied": "Your link was copied to the clipboard",
"common.success": "Success",
"common.error": "Error",
"common.error.unknown": "An unknown error occurred",
"common.error.invalid-email": "Invalid email address",
@ -570,5 +417,5 @@ export default {
"common.error.too-long": "Must be at most {length} characters",
"common.error.exact-length": "Must be exactly {length} characters",
"common.error.invalid-number": "Must be a number",
"common.error.field-required": "This field is required",
};
"common.error.field-required": "This field is required"
};

View File

@ -0,0 +1,421 @@
export default {
// Navbar
"navbar.upload": "Завантажити",
"navbar.signin": "Вхід",
"navbar.home": "Головна",
"navbar.signup": "Зареєструватися",
"navbar.links.shares": "Мої завантаження",
"navbar.links.reverse": "Зворотні завантаження",
"navbar.avatar.account": "Мій аккаунт",
"navbar.avatar.admin": "Адміністрування",
"navbar.avatar.signout": "Вийти",
// END navbar
// /
"home.title": "Платформа для обміну файлами із <h>власного хостингу</h>.",
"home.description": "Ви дійсно бажаєте надати свої особисті файли У руки третіх осіб, таких як WeTransfer?",
"home.bullet.a.name": "На власному сервері",
"home.bullet.a.description": "Pingvin Share працює на вашій машині.",
"home.bullet.b.name": "Конфіденційність",
"home.bullet.b.description": "Ваші файли - це ваші файли і ніколи не повинні потрапляти до рук третіх осіб.",
"home.bullet.c.name": "Без дратівливого обмеження розміру файлу",
"home.bullet.c.description": "Завантажуйте файли з будь-яким розміром. Тільки ваш жорсткий диск буде межею.",
"home.button.start": "Почнемо",
"home.button.source": "Вихідний код",
// END /
// /auth/signin
"signin.title": "З поверненням",
"signin.description": "У вас ще немає облікового запису?",
"signin.button.signup": "Зареєструватися",
"signin.input.email-or-username": "Email або логін",
"signin.input.email-or-username.placeholder": "Ел. пошта або логін",
"signin.input.password": "Пароль",
"signin.input.password.placeholder": "Ваш пароль",
"signin.button.submit": "Вхід",
"signIn.notify.totp-required.title": "Потрібна двофакторна аутентифікація",
"signIn.notify.totp-required.description": "Будь ласка, введіть код Вашої 2-х факторної аутентифікації",
"signIn.oauth.or": "АБО",
"signIn.oauth.github": "GitHub",
"signIn.oauth.google": "Google",
"signIn.oauth.microsoft": "Microsoft",
"signIn.oauth.discord": "Discord",
"signIn.oauth.oidc": "OpenID",
// END /auth/signin
// /auth/signup
"signup.title": "Створити акаунт",
"signup.description": "Уже є обліковий запис?",
"signup.button.signin": "Вхід",
"signup.input.username": "Логін",
"signup.input.username.placeholder": "Ваш логін (ім'я користувача)",
"signup.input.email": "Електронна пошта",
"signup.input.email.placeholder": "Адреса ел. пошти",
"signup.button.submit": "Давайте почнемо",
// END /auth/signup
// /auth/totp
"totp.title": "Авторизація TOTP",
"totp.button.signIn": "Увійти",
// END /auth/totp
// /auth/reset-password
"resetPassword.title": "Забули пароль?",
"resetPassword.description": "Введіть ваш email для відновлення пароля.",
"resetPassword.notify.success": "Відправлено повідомлення з посиланням для скидання пароля, якщо email існує.",
"resetPassword.button.back": "Повернутися на сторінку входу",
"resetPassword.text.resetPassword": "Скинути пароль",
"resetPassword.text.enterNewPassword": "Введіть новий пароль",
"resetPassword.input.password": "Новий пароль",
"resetPassword.notify.passwordReset": "Ваш пароль було успішно скинуто!",
// /account
"account.title": "Мій акаунт",
"account.card.info.title": "Інформація про акаунт",
"account.card.info.username": "Логін",
"account.card.info.email": "Електронна пошта",
"account.notify.info.success": "Налаштування облікового запису успішно оновлено",
"account.card.password.title": "Пароль",
"account.card.password.old": "Старий пароль",
"account.card.password.new": "Новий пароль",
"account.card.password.noPasswordSet": "У вас не встановлено пароль. Якщо ви хочете увійти за допомогою електронної пошти та пароля, вам необхідно встановити пароль.",
"account.notify.password.success": "Пароль успішно змінено",
"account.card.oauth.title": "Авторизація через соціальні мережі",
"account.card.oauth.github": "GitHub",
"account.card.oauth.google": "Google",
"account.card.oauth.microsoft": "Microsoft",
"account.card.oauth.discord": "Discord",
"account.card.oauth.oidc": "OpenID",
"account.card.oauth.link": "Підключити",
"account.card.oauth.unlink": "Відключити",
"account.card.oauth.unlinked": "Відключено",
"account.modal.unlink.title": "Відключити зв'язок з обліковим записом",
"account.modal.unlink.description": "Відключення зв'язку з обліковим записом соціальних акаунтів може призвести до втрати вашого облікового запису, якщо ви не пам'ятаєте своє ім'я користувача і пароль.",
"account.notify.oauth.unlinked.success": "Відключення пройшло успішно",
"account.card.security.title": "Безпека",
"account.card.security.totp.enable.description": "Введіть ваш поточний пароль для початку увімкнення TOTP",
"account.card.security.totp.disable.description": "Введіть ваш поточний пароль, щоб відключити TOTP",
"account.card.security.totp.button.start": "Почати",
"account.modal.totp.title": "Увімкнути TOTP",
"account.modal.totp.step1": "Крок 1: Додайте свій аутентифікатор",
"account.modal.totp.step2": "Крок 2: Перевірка коду",
"account.modal.totp.enterManually": "Ввести вручну",
"account.modal.totp.code": "Код",
"account.modal.totp.clickToCopy": "Натисніть, щоб скопіювати",
"account.modal.totp.verify": "Підтвердити",
"account.notify.totp.disable": "TOTP успішно відключено",
"account.notify.totp.enable": "TOTP успішно увімкнено",
"account.card.language.title": "Мова",
"account.card.language.description": "Проєкт перекладено спільнотою. Деякі мови можуть бути неповними.",
"account.card.color.title": "Колірна схема",
// ThemeSwitcher.tsx
"account.theme.dark": "Темна",
"account.theme.light": "Світла",
"account.theme.system": "Системна",
"account.button.delete": "Видалити акаунт",
"account.modal.delete.title": "Видалити акаунт",
"account.modal.delete.description": "Ви дійсно хочете видалити свій обліковий запис, включно з усіма вашими завантаженнями?",
// END /account
// /account/shares
"account.shares.title": "Мої завантаження",
"account.shares.title.empty": "Тут порожньо 👀",
"account.shares.description.empty": "У вас немає завантажень.",
"account.shares.button.create": "Створити одну",
"account.shares.info.title": "Відомості",
"account.shares.table.id": "ID",
"account.shares.table.name": "Назва",
"account.shares.table.description": "Опис",
"account.shares.table.visitors": "Відвідувачів",
"account.shares.table.expiresAt": "Дійсно до",
"account.shares.table.createdAt": "Створено",
"account.shares.table.size": "Розмір",
"account.shares.modal.share-informations": "Відомості",
"account.shares.modal.share-link": "Поділитися посиланням",
"account.shares.modal.delete.title": "Видалити завантаження {share}",
"account.shares.modal.delete.description": "Ви дійсно хочете видалити це завантаження?",
// END /account/shares
// /account/reverseShares
"account.reverseShares.title": "Зворотні завантаження",
"account.reverseShares.description": "Зворотне завантаження дає змогу генерувати унікальний URL, що дозволяє зовнішнім користувачам завантажувати файли.",
"account.reverseShares.title.empty": "Тут порожньо 👀",
"account.reverseShares.description.empty": "У вас поки що немає зворотних завантажень.",
// showCreateReverseShareModal.tsx
"account.reverseShares.modal.title": "Створити зворотне посилання на файл",
"account.reverseShares.modal.expiration.label": "Закінчується",
"account.reverseShares.modal.expiration.minute-singular": "Хвилина",
"account.reverseShares.modal.expiration.minute-plural": "Хвилин(и)",
"account.reverseShares.modal.expiration.hour-singular": "Година",
"account.reverseShares.modal.expiration.hour-plural": "Годин",
"account.reverseShares.modal.expiration.day-singular": "День",
"account.reverseShares.modal.expiration.day-plural": "Днів",
"account.reverseShares.modal.expiration.week-singular": "Тиждень",
"account.reverseShares.modal.expiration.week-plural": "Тиждень",
"account.reverseShares.modal.expiration.month-singular": "Місяць",
"account.reverseShares.modal.expiration.month-plural": "Місяця(-ів)",
"account.reverseShares.modal.expiration.year-singular": "Рік",
"account.reverseShares.modal.expiration.year-plural": "Роки (роки)",
"account.reverseShares.modal.max-size.label": "Макс. розмір завантаження",
"account.reverseShares.modal.send-email": "Надіслати повідомлення електронною поштою",
"account.reverseShares.modal.send-email.description": "Надсилати повідомлення електронною поштою, коли завантаження створюється за допомогою цього зворотного посилання.",
"account.reverseShares.modal.max-use.label": "Максимум використань",
"account.reverseShares.modal.max-use.description": "Максимальна кількість разів, коли URL може бути використаний для створення завантаження.",
"account.reverseShare.never-expires": "Це зворотне завантаження ніколи не застаріє.",
"account.reverseShare.expires-on": "Це зворотне завантаження застаріє {expiration}.",
"account.reverseShares.table.no-shares": "Немає створених завантажень",
"account.reverseShares.table.count.singular": "завантаження",
"account.reverseShares.table.count.plural": "завантаження",
"account.reverseShares.table.shares": "Завантаження",
"account.reverseShares.table.remaining": "Залишилося використань",
"account.reverseShares.table.max-size": "Макс. розмір завантаження",
"account.reverseShares.table.expires": "Дійсно до",
"account.reverseShares.modal.reverse-share-link": "Посилання зворотного завантаження",
"account.reverseShares.modal.delete.title": "Видалити зворотне завантаження",
"account.reverseShares.modal.delete.description": "Ви дійсно хочете видалити це зворотне завантаження? Якщо ви це зробите, то всі пов'язані зворотні завантаження будуть також видалені.",
// END /account/reverseShares
// /admin
"admin.title": "Адміністрування",
"admin.button.users": "Управління користувачами",
"admin.button.config": "Конфігурація",
"admin.version": "Версія",
// END /admin
// /admin/users
"admin.users.title": "Управління користувачами",
"admin.users.table.username": "Логін",
"admin.users.table.email": "Електронна пошта",
"admin.users.table.admin": "Адміністратор",
"admin.users.edit.update.title": "Оновити користувача {username}",
"admin.users.edit.update.admin-privileges": "Права адміністратора",
"admin.users.edit.update.change-password.title": "Змінити пароль",
"admin.users.edit.update.change-password.field": "Новий пароль",
"admin.users.edit.update.change-password.button": "Зберегти новий пароль",
"admin.users.edit.update.notify.password.success": "Пароль успішно змінено",
"admin.users.edit.delete.title": "Видалити користувача {username}",
"admin.users.edit.delete.description": "Ви дійсно хочете видалити цього користувача і всі його завантаження?",
// showCreateUserModal.tsx
"admin.users.modal.create.title": "Створити користувача",
"admin.users.modal.create.username": "Логін",
"admin.users.modal.create.email": "Електронна пошта",
"admin.users.modal.create.password": "Пароль",
"admin.users.modal.create.manual-password": "Встановити пароль вручну",
"admin.users.modal.create.manual-password.description": "Якщо прапорець не встановлено, користувач отримає лист із посиланням для встановлення пароля.",
"admin.users.modal.create.admin": "Права адміністратора",
"admin.users.modal.create.admin.description": "Якщо зазначено, користувач матиме доступ до панелі адміністратора.",
// END /admin/users
// /upload
"upload.title": "Завантажити",
"upload.notify.generic-error": "Сталася помилка під час завершення вашого завантаження.",
"upload.notify.count-failed": "Не вдалося завантажити файли {count}. Повтор спроби.",
// Dropzone.tsx
"upload.dropzone.title": "Завантажити файли",
"upload.dropzone.description": "Перетягніть сюди файли для початку завантаження. Ми можемо приймати тільки файли, які менше {maxSize}.",
"upload.dropzone.notify.file-too-big": "Ваші файли перевищують максимальний розмір у {maxSize}.",
// FileList.tsx
"upload.filelist.name": "Назва",
"upload.filelist.size": "Розмір",
// showCreateUploadModal.tsx
"upload.modal.title": "Завантажити",
"upload.modal.link.error.invalid": "Ім'я користувача повинно складатися тільки з букв, цифр, підкреслень і дефісів",
"upload.modal.link.error.taken": "Це посилання вже використовується",
"upload.modal.not-signed-in": "Ви не авторизовані",
"upload.modal.not-signed-in-description": "Ви не зможете видалити свої файли вручну і переглянути кількість відвідувачів.",
"upload.modal.expires.never": "ніколи",
"upload.modal.expires.never-long": "Ніколи не закінчується",
"upload.modal.expires.error.too-long": "Термін дії перевищує максимальну дату закінчення терміну дії {max}.",
"upload.modal.link.label": "Посилання",
"upload.modal.expires.label": "Закінчується",
"upload.modal.expires.minute-singular": "Хвилина",
"upload.modal.expires.minute-plural": "Хвилин(и)",
"upload.modal.expires.hour-singular": "Година",
"upload.modal.expires.hour-plural": "Годин",
"upload.modal.expires.day-singular": "День",
"upload.modal.expires.day-plural": "Днів",
"upload.modal.expires.week-singular": "Тиждень",
"upload.modal.expires.week-plural": "Тижнів",
"upload.modal.expires.month-singular": "Місяць",
"upload.modal.expires.month-plural": "Місяця(-ів)",
"upload.modal.expires.year-singular": "Рік",
"upload.modal.expires.year-plural": "Роки (роки)",
"upload.modal.accordion.description.title": "Опис",
"upload.modal.accordion.description.placeholder": "Примітка для одержувачів цього завантаження",
"upload.modal.accordion.email.title": "Одержувачі листа",
"upload.modal.accordion.email.placeholder": "Одержувачі e-mail",
"upload.modal.accordion.email.invalid-email": "Неприпустима адреса електронної пошти",
"upload.modal.accordion.security.title": "Параметри безпеки",
"upload.modal.accordion.security.password.label": "Захист паролем",
"upload.modal.accordion.security.password.placeholder": "Без пароля",
"upload.modal.accordion.security.max-views.label": "Максимум переглядів",
"upload.modal.accordion.security.max-views.placeholder": "Без обмеження",
// showCompletedUploadModal.tsx
"upload.modal.completed.never-expires": "Це завантаження ніколи не застаріє.",
"upload.modal.completed.expires-on": "Це завантаження застаріє {expiration}.",
"upload.modal.completed.share-ready": "Готово",
// END /upload
// /share/[id]
"share.title": "Завантаження {shareId}",
"share.description": "Подивіться, чим я поділився з вами!",
"share.error.visitor-limit-exceeded.title": "Перевищено ліміт відвідувачів",
"share.error.visitor-limit-exceeded.description": "Перевищено ліміт відвідувачів.",
"share.error.removed.title": "Завантаження видалено",
"share.error.not-found.title": "Завантаження не знайдено",
"share.error.not-found.description": "Сторінка, яку ви шукаєте, не існує.",
"share.modal.password.title": "Потрібен пароль",
"share.modal.password.description": "Для доступу до цього ресурсу введіть пароль для загального доступу.",
"share.modal.password": "Пароль",
"share.modal.error.invalid-password": "Невірний пароль",
"share.button.download-all": "Завантажити все",
"share.notify.download-all-preparing": "Завантаження готується. Повторіть спробу через кілька хвилин.",
"share.modal.file-link": "Посилання на файл",
"share.table.name": "Назва",
"share.table.size": "Розмір",
"share.modal.file-preview.error.not-supported.title": "Попередній перегляд не підтримується",
"share.modal.file-preview.error.not-supported.description": "Попередній перегляд для цього типу файлів не підтримується. Будь ласка, завантажте файл, щоб переглянути його.",
// END /share/[id]
// /share/[id]/edit
"share.edit.title": "Редагувати {shareId}",
"share.edit.append-upload": "Додати файл",
"share.edit.notify.generic-error": "Сталася помилка під час завершення вашого завантаження.",
"share.edit.notify.save-success": "Посилання на ресурс успішно оновлено",
// END /share/[id]/edit
// /admin/config
"admin.config.title": "Конфігурація",
"admin.config.category.general": "Загальне",
"admin.config.category.share": "Завантаження",
"admin.config.category.email": "Електронна пошта",
"admin.config.category.smtp": "SMTP",
"admin.config.category.oauth": "Авторизація через соціальні мережі",
"admin.config.general.app-name": "Назва програми",
"admin.config.general.app-name.description": "Видима назва додатка",
"admin.config.general.app-url": "URL-адреса програми",
"admin.config.general.app-url.description": "Адреса, на якій доступний Pingvin Share",
"admin.config.general.show-home-page": "Показувати домашню сторінку",
"admin.config.general.show-home-page.description": "Показувати домашню сторінку чи ні",
"admin.config.general.logo": "Логотип",
"admin.config.general.logo.description": "Змініть свій логотип, завантаживши нове зображення. Зображення має бути PNG і повинно мати формат 1:1.",
"admin.config.general.logo.placeholder": "Виберіть зображення",
"admin.config.email.enable-share-email-recipients": "Увімкнути обмін з одержувачами електронної пошти",
"admin.config.email.enable-share-email-recipients.description": "Чи дозволити надсилання листів одержувачам. Увімкніть, тільки якщо ви ввімкнули SMTP.",
"admin.config.email.share-recipients-subject": "Заголовок листа (завантаження)",
"admin.config.email.share-recipients-subject.description": "Тема листа, який надсилається одержувачам акції.",
"admin.config.email.share-recipients-message": "Повідомлення листа завантаження",
"admin.config.email.share-recipients-message.description": "Повідомлення, яке надсилається одержувачам публікації. Доступні змінні:\n {creator} - Ім'я користувача творця завантаження\n {shareUrl} - URL завантаження\n {desc} - Опис завантаження\n {expires} - Дата закінчення завантаження\n Змінні будуть замінені на фактичне значення.",
"admin.config.email.reverse-share-subject": "Заголовок листа (зворотне завантаження)",
"admin.config.email.reverse-share-subject.description": "Тема листа, який надсилається, коли хтось створив завантаження з вашим зворотним посиланням.",
"admin.config.email.reverse-share-message": "Повідомлення листа зворотного завантаження",
"admin.config.email.reverse-share-message.description": "Повідомлення, яке надсилається, коли хтось створив завантаження з вашим зворотним посиланням. {shareUrl} буде замінено ім'ям творця та URL-адресою загального доступу.",
"admin.config.email.reset-password-subject": "Тема скидання пароля",
"admin.config.email.reset-password-subject.description": "Тема листа, який надсилається, коли користувач запитує скидання пароля.",
"admin.config.email.reset-password-message": "Повідомлення про скидання пароля",
"admin.config.email.reset-password-message.description": "Повідомлення, яке надсилається при запиті скидання пароля. {url} буде замінено посиланням.",
"admin.config.email.invite-subject": "Тема запрошення",
"admin.config.email.invite-subject.description": "Тема листа, який надсилається, коли адміністратор запрошує користувача.",
"admin.config.email.invite-message": "Повідомлення із запрошенням",
"admin.config.email.invite-message.description": "Повідомлення запрошення. {url} буде замінено посиланням запрошення, а {password} паролем.",
"admin.config.share.allow-registration": "Дозволити реєстрацію",
"admin.config.share.allow-registration.description": "Чи дозволена реєстрація",
"admin.config.share.allow-unauthenticated-shares": "Дозволити неавторизовані завантаження",
"admin.config.share.allow-unauthenticated-shares.description": "Чи можуть неавторизовані користувачі створювати завантаження",
"admin.config.share.max-expiration": "Максимальний термін дії",
"admin.config.share.max-expiration.description": "Максимальний термін дії загального доступу в годинах. Встановіть значення 0, щоб дозволити необмежений термін дії.",
"admin.config.share.max-size": "Максимальний розмір",
"admin.config.share.max-size.description": "Максимальний розмір файлу в байтах",
"admin.config.share.zip-compression-level": "Рівень стиснення Zip",
"admin.config.share.zip-compression-level.description": "Регулювання рівня балансу між розміром файлу і швидкістю стиснення. Допустимі значення від 0 до 9, з 0 без стиснення, а 9 - максимальне стиснення. ",
"admin.config.smtp.enabled": "Увімкнено",
"admin.config.smtp.enabled.description": "Чи увімкнено SMTP. Встановіть значення true тільки якщо ви ввели хост, порт, email, користувач і пароль вашого SMTP-сервера.",
"admin.config.smtp.host": "Хост",
"admin.config.smtp.host.description": "Сервер SMTP-сервера",
"admin.config.smtp.port": "Порт",
"admin.config.smtp.port.description": "Порт SMTP сервера",
"admin.config.smtp.email": "Електронна пошта",
"admin.config.smtp.email.description": "Адреса електронної пошти, від якої надсилаються листи",
"admin.config.smtp.username": "Логін",
"admin.config.smtp.username.description": "Ім'я користувача SMTP-сервера",
"admin.config.smtp.password": "Пароль",
"admin.config.smtp.password.description": "Пароль SMTP-сервера",
"admin.config.smtp.button.test": "Відправити тестовий лист",
"admin.config.oauth.allow-registration": "Дозволити реєстрацію",
"admin.config.oauth.allow-registration.description": "Дозволити користувачам реєструватися, використовуючи облікові записи соціальних мереж",
"admin.config.oauth.ignore-totp": "Ігнорувати TOTP",
"admin.config.oauth.ignore-totp.description": "Ігнорувати TOTP при використанні соціальної авторизації",
"admin.config.oauth.github-enabled": "GitHub",
"admin.config.oauth.github-enabled.description": "Чи ввімкнено логін на GitHub",
"admin.config.oauth.github-client-id": "ID клієнта GitHub",
"admin.config.oauth.github-client-id.description": "ID клієнта в додатку GitHub OAuth",
"admin.config.oauth.github-client-secret": "Секретний ключ клієнта GitHub",
"admin.config.oauth.github-client-secret.description": "Секретний ключ клієнта в додатку GitHub OAuth",
"admin.config.oauth.google-enabled": "Google",
"admin.config.oauth.google-enabled.description": "Чи увімкнено логін Google на GitHub",
"admin.config.oauth.google-client-id": "ID клієнта Google",
"admin.config.oauth.google-client-id.description": "ID клієнта в додатку Google OAuth",
"admin.config.oauth.google-client-secret": "Секретний ключ клієнта Google",
"admin.config.oauth.google-client-secret.description": "Секретний ключ клієнта в додатку Google OAuth",
"admin.config.oauth.microsoft-enabled": "Microsoft",
"admin.config.oauth.microsoft-enabled.description": "Чи ввімкнено логін Microsoft",
"admin.config.oauth.microsoft-tenant": "Корпоративний акаунт Microsoft",
"admin.config.oauth.microsoft-tenant.description": "Ідентифікатор орендаря додатка Microsoft OAuth\ncommon: Користувачі з особистим обліковим записом Microsoft і робочим або навчальним обліковим записом від Microsoft Entra ID можуть увійти в додаток. organizations: Тільки користувачі з робочим або навчальним обліковим записом від Microsoft Entra ID можуть увійти в застосунок.\nconsumers: Тільки користувачі з особистим обліковим записом Microsoft можуть увійти в застосунок.ім'я домену орендаря Microsoft Entra або ідентифікатор орендаря у форматі GUID: Тільки користувачі з певного орендаря Microsoft Entra (учасники каталогу з робочим або навчальним обліковим записом або гості каталогу з особистим обліковим записом Microsoft) можуть увійти в застосунок.",
"admin.config.oauth.microsoft-client-id": "Ідентифікатор клієнта Microsoft",
"admin.config.oauth.microsoft-client-id.description": "ID клієнта в додатку Microsoft OAuth",
"admin.config.oauth.microsoft-client-secret": "Секретний ключ клієнта Microsoft",
"admin.config.oauth.microsoft-client-secret.description": "Секретний ключ клієнта в додатку Microsoft OAuth",
"admin.config.oauth.discord-enabled": "Discord",
"admin.config.oauth.discord-enabled.description": "Чи увімкнено логін Discord",
"admin.config.oauth.discord-limited-guild": "ID обмеженого сервера Discord",
"admin.config.oauth.discord-limited-guild.description": "Обмеження входу для користувачів певного сервера. Залиште порожнім, щоб відключити.",
"admin.config.oauth.discord-client-id": "ID клієнта Discord",
"admin.config.oauth.discord-client-id.description": "ID клієнта в додатку Discord OAuth",
"admin.config.oauth.discord-client-secret": "Секретний ключ клієнта Discord",
"admin.config.oauth.discord-client-secret.description": "Секретний ключ клієнта в додатку Discord OAuth",
"admin.config.oauth.oidc-enabled": "OpenID Connect",
"admin.config.oauth.oidc-enabled.description": "Чи ввімкнено логін OpenID Connect",
"admin.config.oauth.oidc-discovery-uri": "OpenID Connect Discovery URI",
"admin.config.oauth.oidc-discovery-uri.description": "URI Discovery URI додатка OpenID Connect OAuth",
"admin.config.oauth.oidc-username-claim": "Заява на ім'я користувача OpenID Connect",
"admin.config.oauth.oidc-username-claim.description": "Заява про ім'я користувача в токені OpenID Connect ID. Залиште порожнім, якщо не знаєте, що це за конфіг.",
"admin.config.oauth.oidc-client-id": "OpenID Connect Client ID",
"admin.config.oauth.oidc-client-id.description": "Клієнтський ідентифікатор додатка OpenID Connect OAuth",
"admin.config.oauth.oidc-client-secret": "Секрет клієнта OpenID Connect",
"admin.config.oauth.oidc-client-secret.description": "Клієнтський секрет програми OpenID Connect OAuth",
// 404
"404.description": "Бляха, цієї строрінки не існує.",
"404.button.home": "Поверни мене додому",
// error
"error.title": "Помилка",
"error.description": "Щось пішло не так!",
"error.button.back": "Назад",
"error.msg.default": "Щось пішло не так.",
"error.msg.access_denied": "Ви скасували процес аутентифікації, будь ласка, спробуйте ще раз.",
"error.msg.expired_token": "Процес аутентифікації зайняв занадто багато часу, будь ласка, спробуйте ще раз.",
"error.msg.invalid_token": "Внутрішня помилка",
"error.msg.no_user": "Користувач, пов'язаний з обліковим записом {0}, не існує.",
"error.msg.no_email": "Не вдається отримати адресу електронної пошти від облікового запису {0}.",
"error.msg.already_linked": "Цей обліковий запис {0} уже прив'язано до іншого акаунта.",
"error.msg.not_linked": "Цей обліковий запис {0} ще не прив'язаний до жодного акаунту.",
"error.msg.unverified_account": "Цей обліковий запис {0} не підтверджено, повторіть спробу після підтвердження.",
"error.msg.discord_guild_permission_denied": "У вас немає дозволу на вхід.",
"error.msg.cannot_get_user_info": "Не вдається отримати інфу про користувача з цього {0} облікового запису.",
"error.param.provider_github": "GitHub",
"error.param.provider_google": "Google",
"error.param.provider_microsoft": "Microsoft",
"error.param.provider_discord": "Discord",
"error.param.provider_oidc": "OpenID Connect",
// Common translations
"common.button.save": "Зберегти",
"common.button.create": "Створити",
"common.button.submit": "Відправити",
"common.button.delete": "Видалити",
"common.button.cancel": "Скасувати",
"common.button.confirm": "Підтвердити",
"common.button.disable": "Відключити",
"common.button.share": "Поділитися",
"common.button.generate": "Згенерувати",
"common.button.done": "Готово",
"common.text.link": "Посилання",
"common.text.navigate-to-link": "Перейти до посилання",
"common.text.or": "або",
"common.button.go-back": "Назад",
"common.button.go-home": "Перейти додому",
"common.notify.copied": "Ваше посилання скопійовано в буфер обміну",
"common.success": "Успішно",
"common.error": "Помилка",
"common.error.unknown": "Сталася невідома помилка",
"common.error.invalid-email": "Неприпустима адреса електронної пошти",
"common.error.too-short": "Повинно бути не менше {length} символів",
"common.error.too-long": "Повинно бути не більше {length} символів",
"common.error.exact-length": "Повинно бути рівно {length} символів",
"common.error.invalid-number": "Повинно бути числом",
"common.error.field-required": "Поле обов'язкове для заповнення"
};

View File

@ -1,14 +1,7 @@
import {
Button,
Container,
createStyles,
Group,
Text,
Title,
} from "@mantine/core";
import { Button, Container, createStyles, Group, Title } from "@mantine/core";
import Link from "next/link";
import Meta from "../components/Meta";
import { FormattedMessage } from "react-intl";
import Meta from "../components/Meta";
const useStyles = createStyles((theme) => ({
root: {
@ -21,19 +14,13 @@ const useStyles = createStyles((theme) => ({
fontWeight: 900,
fontSize: 220,
lineHeight: 1,
marginBottom: `calc(${theme.spacing.xl} * 100)`,
marginBottom: 20,
color: theme.colors.gray[2],
[theme.fn.smallerThan("sm")]: {
fontSize: 120,
},
},
description: {
maxWidth: 500,
margin: "auto",
marginBottom: `calc(${theme.spacing.xl} * 100)`,
},
}));
const ErrorNotFound = () => {
@ -47,12 +34,7 @@ const ErrorNotFound = () => {
<Title align="center" order={3}>
<FormattedMessage id="404.description" />
</Title>
<Text
color="dimmed"
align="center"
className={classes.description}
></Text>
<Group position="center">
<Group position="center" mt={50}>
<Button component={Link} href="/" variant="light">
<FormattedMessage id="404.button.home" />
</Button>

View File

@ -4,6 +4,7 @@ import Meta from "../components/Meta";
import useTranslate from "../hooks/useTranslate.hook";
import { useRouter } from "next/router";
import { FormattedMessage } from "react-intl";
import { safeRedirectPath } from "../utils/router.util";
const useStyle = createStyles({
title: {
@ -39,7 +40,9 @@ export default function Error() {
</Text>
<Button
mt="xl"
onClick={() => router.push((router.query.redirect as string) || "/")}
onClick={() =>
router.push(safeRedirectPath(router.query.redirect as string))
}
>
{t("error.button.back")}
</Button>

View File

@ -3,7 +3,7 @@ import { useModals } from "@mantine/modals";
import { cleanNotifications } from "@mantine/notifications";
import { AxiosError } from "axios";
import pLimit from "p-limit";
import { useEffect, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { FormattedMessage } from "react-intl";
import Meta from "../../components/Meta";
import Dropzone from "../../components/upload/Dropzone";
@ -19,7 +19,6 @@ import { CreateShare, Share } from "../../types/share.type";
import toast from "../../utils/toast.util";
const promiseLimit = pLimit(3);
const chunkSize = 10 * 1024 * 1024; // 10MB
let errorToastShown = false;
let createdShare: Share;
@ -38,6 +37,8 @@ const Upload = ({
const [files, setFiles] = useState<FileUpload[]>([]);
const [isUploading, setisUploading] = useState(false);
const chunkSize = useRef(parseInt(config.get("share.chunkSize")));
maxShareSize ??= parseInt(config.get("share.maxSize"));
const uploadFiles = async (share: CreateShare, files: FileUpload[]) => {
@ -54,7 +55,7 @@ const Upload = ({
const fileUploadPromises = files.map(async (file, fileIndex) =>
// Limit the number of concurrent uploads to 3
promiseLimit(async () => {
let fileId: string;
let fileId;
const setFileProgress = (progress: number) => {
setFiles((files) =>
@ -69,38 +70,30 @@ const Upload = ({
setFileProgress(1);
let chunks = Math.ceil(file.size / chunkSize);
let chunks = Math.ceil(file.size / chunkSize.current);
// If the file is 0 bytes, we still need to upload 1 chunk
if (chunks == 0) chunks++;
for (let chunkIndex = 0; chunkIndex < chunks; chunkIndex++) {
const from = chunkIndex * chunkSize;
const to = from + chunkSize;
const from = chunkIndex * chunkSize.current;
const to = from + chunkSize.current;
const blob = file.slice(from, to);
try {
await new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = async (event) =>
await shareService
.uploadFile(
createdShare.id,
event,
{
id: fileId,
name: file.name,
},
chunkIndex,
chunks,
)
.then((response) => {
fileId = response.id;
resolve(response);
})
.catch(reject);
reader.readAsDataURL(blob);
});
await shareService
.uploadFile(
createdShare.id,
blob,
{
id: fileId,
name: file.name,
},
chunkIndex,
chunks,
)
.then((response) => {
fileId = response.id;
});
setFileProgress(((chunkIndex + 1) / chunks) * 100);
} catch (e) {

View File

@ -1,4 +1,4 @@
import { setCookie } from "cookies-next";
import { deleteCookie, setCookie } from "cookies-next";
import mime from "mime-types";
import { FileUploadResponse } from "../types/File.type";
@ -16,7 +16,9 @@ const create = async (share: CreateShare) => {
};
const completeShare = async (id: string) => {
return (await api.post(`shares/${id}/complete`)).data;
const response = (await api.post(`shares/${id}/complete`)).data;
deleteCookie("reverse_share_token");
return response;
};
const revertComplete = async (id: string) => {
@ -77,7 +79,7 @@ const removeFile = async (shareId: string, fileId: string) => {
const uploadFile = async (
shareId: string,
readerEvent: ProgressEvent<FileReader>,
chunk: Blob,
file: {
id?: string;
name: string;
@ -85,10 +87,8 @@ const uploadFile = async (
chunkIndex: number,
totalChunks: number,
): Promise<FileUploadResponse> => {
const data = readerEvent.target!.result;
return (
await api.post(`shares/${shareId}/files`, data, {
await api.post(`shares/${shareId}/files`, chunk, {
headers: { "Content-Type": "application/octet-stream" },
params: {
id: file.id,

View File

@ -0,0 +1,7 @@
export function safeRedirectPath(path: string | undefined) {
if (!path) return "/";
if (!path.startsWith("/")) return `/${path}`;
return path;
}

View File

@ -1,6 +1,6 @@
{
"name": "pingvin-share",
"version": "0.22.2",
"version": "0.23.1",
"scripts": {
"format": "cd frontend && npm run format && cd ../backend && npm run format",
"lint": "cd frontend && npm run lint && cd ../backend && npm run lint",