diff --git a/.env.local.example b/.env.local.example
index c79c221..a91d28b 100644
--- a/.env.local.example
+++ b/.env.local.example
@@ -3,7 +3,7 @@
# if using s3/supabase make sure to comment out the other datasources
-CORE_HTTPS=true
+CORE_RETURN_HTTPS=true
CORE_SECRET="changethis"
CORE_HOST=0.0.0.0
CORE_PORT=3000
@@ -44,3 +44,5 @@ URLS_LENGTH=6
RATELIMIT_USER=5
RATELIMIT_ADMIN=3
+
+# for more variables checkout the docs
\ No newline at end of file
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index b8f6eb9..37855da 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -114,7 +114,7 @@ model OAuth {
id Int @id @default(autoincrement())
provider OauthProviders
user User @relation(fields: [userId], references: [uuid], onDelete: Cascade)
- userId String
+ userId String @db.Uuid
username String
oauthId String?
token String
diff --git a/src/components/File/FileModal.tsx b/src/components/File/FileModal.tsx
index 1ac01f1..ed57719 100644
--- a/src/components/File/FileModal.tsx
+++ b/src/components/File/FileModal.tsx
@@ -95,18 +95,12 @@ export default function FileModal({
const handleCopy = () => {
clipboard.copy(`${window.location.protocol}//${window.location.host}${file.url}`);
setOpen(false);
- if (!navigator.clipboard)
- showNotification({
- title: 'Unable to copy to clipboard',
- message: 'Zipline is unable to copy to clipboard due to security reasons.',
- color: 'red',
- });
- else
- showNotification({
- title: 'Copied to clipboard',
- message: '',
- icon: ,
- });
+
+ showNotification({
+ title: 'Copied to clipboard',
+ message: '',
+ icon: ,
+ });
};
const handleFavorite = async () => {
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx
index 3bd916b..24f90f0 100644
--- a/src/components/Layout.tsx
+++ b/src/components/Layout.tsx
@@ -4,10 +4,8 @@ import {
Box,
Burger,
Button,
- Group,
Header,
Image,
- Input,
MediaQuery,
Menu,
Navbar,
@@ -222,21 +220,14 @@ export default function Layout({ children, props }) {
labels: { confirm: 'Copy', cancel: 'Cancel' },
onConfirm: async () => {
clipboard.copy(token);
+
if (!navigator.clipboard)
showNotification({
- title: 'Unable to copy to clipboard',
- message: (
-
- Zipline is unable to copy to clipboard due to security reasons. However, you can still copy
- the token manually.
-
-
- Your token is:
- e.target.select()} type='text' value={token} />
-
-
- ),
+ title: 'Unable to copy token',
+ message:
+ "Zipline couldn't copy to your clipboard. Please copy the token manually from the settings page.",
color: 'red',
+ icon: ,
});
else
showNotification({
diff --git a/src/components/pages/Dashboard/index.tsx b/src/components/pages/Dashboard/index.tsx
index 7143145..4e0a6f1 100644
--- a/src/components/pages/Dashboard/index.tsx
+++ b/src/components/pages/Dashboard/index.tsx
@@ -106,22 +106,16 @@ export default function Dashboard({ disableMediaPreview, exifEnabled, compress }
const copyFile = async (file) => {
clipboard.copy(`${window.location.protocol}//${window.location.host}${file.url}`);
- if (!navigator.clipboard)
- showNotification({
- title: 'Unable to copy to clipboard',
- message: 'Zipline is unable to copy to clipboard due to security reasons.',
- color: 'red',
- });
- else
- showNotification({
- title: 'Copied to clipboard',
- message: (
- {`${window.location.protocol}//${window.location.host}${file.url}`}
- ),
- icon: ,
- });
+
+ showNotification({
+ title: 'Copied to clipboard',
+ message: (
+ {`${window.location.protocol}//${window.location.host}${file.url}`}
+ ),
+ icon: ,
+ });
};
const viewFile = async (file) => {
diff --git a/src/components/pages/Files/FilePagation.tsx b/src/components/pages/Files/FilePagation.tsx
index 933ed44..57aba25 100644
--- a/src/components/pages/Files/FilePagation.tsx
+++ b/src/components/pages/Files/FilePagation.tsx
@@ -40,6 +40,12 @@ export default function FilePagation({ disableMediaPreview, exifEnabled, queryPa
const pages = usePaginatedFiles(page, !checked ? 'media' : null);
if (pages.isSuccess && pages.data.length === 0) {
+ if (page > 1 && numPages > 0) {
+ setPage(page - 1);
+
+ return null;
+ }
+
return (
diff --git a/src/components/pages/Folders/index.tsx b/src/components/pages/Folders/index.tsx
index 8396484..844df0f 100644
--- a/src/components/pages/Folders/index.tsx
+++ b/src/components/pages/Folders/index.tsx
@@ -112,7 +112,7 @@ export default function Folders({ disableMediaPreview, exifEnabled, compress })
const makePublic = async (folder) => {
const res = await useFetch(`/api/user/folders/${folder.id}`, 'PATCH', {
- public: folder.public ? false : true,
+ public: !folder.public,
});
if (!res.error) {
@@ -363,25 +363,18 @@ export default function Folders({ disableMediaPreview, exifEnabled, compress })
aria-label='copy link'
onClick={() => {
clipboard.copy(`${window.location.origin}/folder/${folder.id}`);
- if (!navigator.clipboard)
- showNotification({
- title: 'Unable to copy to clipboard',
- message: 'Zipline is unable to copy to clipboard due to security reasons.',
- color: 'red',
- });
- else
- showNotification({
- title: 'Copied folder link',
- message: (
- <>
- Copied{' '}
- folder link to
- clipboard
- >
- ),
- color: 'green',
- icon: ,
- });
+
+ showNotification({
+ title: 'Copied folder link',
+ message: (
+ <>
+ Copied folder link{' '}
+ to clipboard
+ >
+ ),
+ color: 'green',
+ icon: ,
+ });
}}
>
diff --git a/src/components/pages/Invites.tsx b/src/components/pages/Invites.tsx
index 4145b37..71796b7 100644
--- a/src/components/pages/Invites.tsx
+++ b/src/components/pages/Invites.tsx
@@ -184,18 +184,12 @@ export default function Invites() {
const handleCopy = async (invite) => {
clipboard.copy(`${window.location.protocol}//${window.location.host}/auth/register?code=${invite.code}`);
- if (!navigator.clipboard)
- showNotification({
- title: 'Unable to copy to clipboard',
- message: 'Zipline is unable to copy to clipboard due to security reasons.',
- color: 'red',
- });
- else
- showNotification({
- title: 'Copied to clipboard',
- message: '',
- icon: ,
- });
+
+ showNotification({
+ title: 'Copied to clipboard',
+ message: '',
+ icon: ,
+ });
};
const updateInvites = async () => {
diff --git a/src/components/pages/Manage/index.tsx b/src/components/pages/Manage/index.tsx
index 112857e..d7f2daa 100644
--- a/src/components/pages/Manage/index.tsx
+++ b/src/components/pages/Manage/index.tsx
@@ -1,9 +1,11 @@
import {
+ ActionIcon,
Anchor,
Box,
Button,
Card,
ColorInput,
+ CopyButton,
FileInput,
Group,
Image,
@@ -23,6 +25,8 @@ import {
IconBrandDiscordFilled,
IconBrandGithubFilled,
IconBrandGoogle,
+ IconCheck,
+ IconClipboardCopy,
IconFileExport,
IconFiles,
IconFilesOff,
@@ -91,6 +95,7 @@ export default function Manage({ oauth_registration, oauth_providers: raw_oauth_
const [file, setFile] = useState(null);
const [fileDataURL, setFileDataURL] = useState(user.avatar ?? null);
const [totpEnabled, setTotpEnabled] = useState(!!user.totpSecret);
+ const [tokenShown, setTokenShown] = useState(false);
const getDataURL = (f: File): Promise => {
return new Promise((res, rej) => {
@@ -367,6 +372,25 @@ export default function Manage({ oauth_registration, oauth_providers: raw_oauth_
the docs for
variables
+
+
+ {({ copied, copy }) => (
+
+ {copied ? : }
+
+ )}
+
+ }
+ // @ts-ignore (this works even though ts doesn't allow for it)
+ component='span'
+ label='Token'
+ onClick={() => setTokenShown(true)}
+ >
+ {tokenShown ? user.token : '[click to reveal]'}
+
+
-
-
+ {show_local_login && }
>
)}
-
+
+
+
+ )}
>
diff --git a/src/pages/view/[id].tsx b/src/pages/view/[id].tsx
index 1f7ed6b..404154a 100644
--- a/src/pages/view/[id].tsx
+++ b/src/pages/view/[id].tsx
@@ -231,7 +231,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
if (file.password) file.password = true;
return {
props: {
- image: file,
+ file,
user,
pass,
prismRender: true,
diff --git a/src/scripts/query-size.ts b/src/scripts/query-size.ts
index 655210d..5649769 100644
--- a/src/scripts/query-size.ts
+++ b/src/scripts/query-size.ts
@@ -29,7 +29,7 @@ async function main() {
for (let i = 0; i !== files.length; ++i) {
const file = files[i];
- if (!datasource.get(file.name)) {
+ if (!(await datasource.get(file.name))) {
if (process.argv.includes('--force-delete')) {
console.log(`File ${file.name} does not exist. Deleting...`);
await prisma.file.delete({