refactor: convert config variables to upper case
This commit is contained in:
@@ -49,7 +49,7 @@ const SignInForm = () => {
|
||||
>
|
||||
Welcome back
|
||||
</Title>
|
||||
{config.get("allowRegistration") && (
|
||||
{config.get("ALLOW_REGISTRATION") && (
|
||||
<Text color="dimmed" size="sm" align="center" mt={5}>
|
||||
You don't have an account yet?{" "}
|
||||
<Anchor component={Link} href={"signUp"} size="sm">
|
||||
@@ -65,6 +65,7 @@ const SignInForm = () => {
|
||||
>
|
||||
<TextInput
|
||||
label="Email or username"
|
||||
type="email"
|
||||
placeholder="you@email.com"
|
||||
{...form.getInputProps("emailOrUsername")}
|
||||
/>
|
||||
|
||||
@@ -57,7 +57,7 @@ const SignUpForm = () => {
|
||||
>
|
||||
Sign up
|
||||
</Title>
|
||||
{config.get("allowRegistration") && (
|
||||
{config.get("ALLOW_REGISTRATION") && (
|
||||
<Text color="dimmed" size="sm" align="center" mt={5}>
|
||||
You have an account already?{" "}
|
||||
<Anchor component={Link} href={"signIn"} size="sm">
|
||||
@@ -78,6 +78,7 @@ const SignUpForm = () => {
|
||||
/>
|
||||
<TextInput
|
||||
label="Email"
|
||||
type="email"
|
||||
placeholder="you@email.com"
|
||||
mt="md"
|
||||
{...form.getInputProps("email")}
|
||||
|
||||
@@ -130,7 +130,7 @@ const NavBar = () => {
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (config.get("showHomePage"))
|
||||
if (config.get("SHOW_HOME_PAGE"))
|
||||
setUnauthenticatedLinks((array) => [
|
||||
{
|
||||
link: "/",
|
||||
@@ -139,7 +139,7 @@ const NavBar = () => {
|
||||
...array,
|
||||
]);
|
||||
|
||||
if (config.get("allowRegistration"))
|
||||
if (config.get("ALLOW_REGISTRATION"))
|
||||
setUnauthenticatedLinks((array) => [
|
||||
...array,
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ const Dropzone = ({
|
||||
return (
|
||||
<div className={classes.wrapper}>
|
||||
<MantineDropzone
|
||||
maxSize={parseInt(config.get("maxFileSize"))}
|
||||
maxSize={parseInt(config.get("MAX_FILE_SIZE"))}
|
||||
onReject={(e) => {
|
||||
toast.error(e[0].errors[0].message);
|
||||
}}
|
||||
@@ -75,7 +75,7 @@ const Dropzone = ({
|
||||
<Text align="center" size="sm" mt="xs" color="dimmed">
|
||||
Drag'n'drop files here to start your share. We can accept
|
||||
only files that are less than{" "}
|
||||
{byteStringToHumanSizeString(config.get("maxFileSize"))} in size.
|
||||
{byteStringToHumanSizeString(config.get("MAX_FILE_SIZE"))} in size.
|
||||
</Text>
|
||||
</div>
|
||||
</MantineDropzone>
|
||||
|
||||
@@ -29,8 +29,8 @@ const showCreateUploadModal = (
|
||||
modals: ModalsContextProps,
|
||||
options: {
|
||||
isUserSignedIn: boolean;
|
||||
allowUnauthenticatedShares: boolean;
|
||||
emailRecipientsEnabled: boolean;
|
||||
ALLOW_UNAUTHENTICATED_SHARES: boolean;
|
||||
ENABLE_EMAIL_RECIPIENTS: boolean;
|
||||
},
|
||||
uploadCallback: (
|
||||
id: string,
|
||||
@@ -62,14 +62,14 @@ const CreateUploadModalBody = ({
|
||||
) => void;
|
||||
options: {
|
||||
isUserSignedIn: boolean;
|
||||
allowUnauthenticatedShares: boolean;
|
||||
emailRecipientsEnabled: boolean;
|
||||
ALLOW_UNAUTHENTICATED_SHARES: boolean;
|
||||
ENABLE_EMAIL_RECIPIENTS: boolean;
|
||||
};
|
||||
}) => {
|
||||
const modals = useModals();
|
||||
|
||||
const [showNotSignedInAlert, setShowNotSignedInAlert] = useState(
|
||||
options.emailRecipientsEnabled
|
||||
options.ENABLE_EMAIL_RECIPIENTS
|
||||
);
|
||||
|
||||
const validationSchema = yup.object().shape({
|
||||
@@ -230,7 +230,7 @@ const CreateUploadModalBody = ({
|
||||
{ExpirationPreview({ form })}
|
||||
</Text>
|
||||
<Accordion>
|
||||
{options.emailRecipientsEnabled && (
|
||||
{options.ENABLE_EMAIL_RECIPIENTS && (
|
||||
<Accordion.Item value="recipients" sx={{ borderBottom: "none" }}>
|
||||
<Accordion.Control>Email recipients</Accordion.Control>
|
||||
<Accordion.Panel>
|
||||
|
||||
@@ -17,7 +17,7 @@ const Setup = () => {
|
||||
if (!user) {
|
||||
router.push("/auth/signUp");
|
||||
return;
|
||||
} else if (config.get("setupFinished")) {
|
||||
} else if (config.get("SETUP_FINISHED")) {
|
||||
router.push("/");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const SignUp = () => {
|
||||
const router = useRouter();
|
||||
if (user) {
|
||||
router.replace("/");
|
||||
} else if (config.get("allowRegistration") == "false") {
|
||||
} else if (config.get("ALLOW_REGISTRATION") == "false") {
|
||||
router.replace("/auth/signIn");
|
||||
} else {
|
||||
return (
|
||||
|
||||
@@ -74,9 +74,9 @@ export default function Home() {
|
||||
|
||||
const { classes } = useStyles();
|
||||
const router = useRouter();
|
||||
if (user || config.get("allowUnauthenticatedShares")) {
|
||||
if (user || config.get("ALLOW_UNAUTHENTICATED_SHARES")) {
|
||||
router.replace("/upload");
|
||||
} else if (!config.get("showHomePage")) {
|
||||
} else if (!config.get("SHOW_HOME_PAGE")) {
|
||||
router.replace("/auth/signIn");
|
||||
} else {
|
||||
return (
|
||||
|
||||
@@ -95,7 +95,7 @@ const Upload = () => {
|
||||
}
|
||||
}
|
||||
}, [files]);
|
||||
if (!user && !config.get("allowUnauthenticatedShares")) {
|
||||
if (!user && !config.get("ALLOW_UNAUTHENTICATED_SHARES")) {
|
||||
router.replace("/");
|
||||
} else {
|
||||
return (
|
||||
@@ -110,10 +110,12 @@ const Upload = () => {
|
||||
modals,
|
||||
{
|
||||
isUserSignedIn: user ? true : false,
|
||||
allowUnauthenticatedShares: config.get(
|
||||
"allowUnauthenticatedShares"
|
||||
ALLOW_UNAUTHENTICATED_SHARES: config.get(
|
||||
"ALLOW_UNAUTHENTICATED_SHARES"
|
||||
),
|
||||
ENABLE_EMAIL_RECIPIENTS: config.get(
|
||||
"ENABLE_EMAIL_RECIPIENTS"
|
||||
),
|
||||
emailRecipientsEnabled: config.get("emailRecipientsEnabled"),
|
||||
},
|
||||
uploadFiles
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user