Skip to content
This repository was archived by the owner on Jun 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions backend/prisma/seed/config.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ export const configVariables = {
defaultValue: "",
secret: false,
},
companySharingPolicy: {
type: "text",
defaultValue: "",
secret: false,
},
},
} satisfies ConfigVariables;

Expand Down
2 changes: 2 additions & 0 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ legal:
privacyPolicyText: ""
#If you already have a privacy policy page you can link it here instead of using the text field.
privacyPolicyUrl: ""
#The text which should be shown in the company sharing policy. Supports Markdown.
companySharingPolicy: ""
#This configuration is used to create the initial user when the application is started for the first time.
#Make sure to change at least the password as soon as you log in!
initUser:
Expand Down
64 changes: 63 additions & 1 deletion frontend/src/components/upload/Dropzone.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button, Center, createStyles, Group, Text } from "@mantine/core";
import { Anchor, Button, Center, createStyles, Group, Paper, Text, useMantineTheme } from "@mantine/core";
import Markdown from "markdown-to-jsx";
import { Dropzone as MantineDropzone } from "@mantine/dropzone";
import { ForwardedRef, useRef } from "react";
import { TbCloudUpload, TbUpload } from "react-icons/tb";
Expand All @@ -7,6 +8,7 @@ import useTranslate from "../../hooks/useTranslate.hook";
import { FileUpload } from "../../types/File.type";
import { byteToHumanSizeString } from "../../utils/fileSize.util";
import toast from "../../utils/toast.util";
import useConfig from "../../hooks/config.hook";

const useStyles = createStyles((theme) => ({
wrapper: {
Expand All @@ -30,6 +32,23 @@ const useStyles = createStyles((theme) => ({
position: "absolute",
bottom: -20,
},

companysharingpolicy: {
marginTop: 50,
border: '1px dashed',
borderWidth: 1,
borderColor: theme.colorScheme === "dark"
? theme.colors.dark[3]
: theme.colors.gray[3],
borderRadius: 10,
backgroundColor: theme.colorScheme === "dark"
? theme.colors.dark[4]
: theme.colors.gray[1],
fontSize: 'small',
textAlign: 'center',
padding: 20,
}

}));

const Dropzone = ({
Expand All @@ -44,6 +63,12 @@ const Dropzone = ({
onFilesChanged: (files: FileUpload[]) => void;
}) => {
const t = useTranslate();
const config = useConfig();
const { colorScheme } = useMantineTheme();
const hasCompanySharingPolicy = !!(
config.get("legal.companySharingPolicy")
);
const companySharingPolicy = config.get("legal.companySharingPolicy");

const { classes } = useStyles();
const openRef = useRef<() => void>();
Expand Down Expand Up @@ -88,6 +113,43 @@ const Dropzone = ({
values={{ maxSize: byteToHumanSizeString(maxShareSize) }}
/>
</Text>
{hasCompanySharingPolicy && (
<Group className={classes.companysharingpolicy}>
<Markdown
options={{
forceBlock: true,
overrides: {
pre: {
props: {
style: {
backgroundColor:
colorScheme == "dark"
? "rgba(50, 50, 50, 0.5)"
: "rgba(220, 220, 220, 0.5)",
padding: "0.75em",
whiteSpace: "pre-wrap",
},
},
},
table: {
props: {
className: "md",
},
},
a: {
props: {
target: "_blank",
rel: "noreferrer",
},
component: Anchor,
},
},
}}
>
{companySharingPolicy}
</Markdown>
</Group>
)}
</div>
</MantineDropzone>
<Center>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/i18n/translations/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ export default {
"admin.config.legal.privacy-policy-url": "Privacy policy URL",
"admin.config.legal.privacy-policy-url.description":
"If you already have a privacy policy page you can link it here instead of using the text field.",
"admin.config.legal.company-sharing-policy": "Sharing policy ",
"admin.config.legal.company-sharing-policy.description":
"A notice to be displayed to users on the upload page. This is to remind users what should and shouldn't be shared externally.",

// 404
"404.description": "Oops this page doesn't exist.",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export async function middleware(request: NextRequest) {
) {
routes.disabled.routes.push("/privacy");
}
if (
!getConfig("legal.companySharingPolicy")
) {
routes.disabled.routes.push("/sharing_policy");
}
}

// prettier-ignore
Expand Down