mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-20 01:55:26 -05:00
Add dev
This commit is contained in:
@@ -67,7 +67,7 @@ export const Config = {
|
||||
/** Whether to show the LUTI navigation item. */
|
||||
showLutiNavItem: values.VITE_SHOW_LUTI_NAV_ITEM,
|
||||
fuseEnabled: values.VITE_FUSE_ENABLED,
|
||||
/** Whether the scanner is available to everyone. While false only the admin can use the scanner page and its ingest endpoint. */
|
||||
/** Whether the scanner is available to everyone. While false only the admin and devs can use the scanner page and its ingest endpoint. */
|
||||
scannerEnabled: values.VITE_SCANNER_ENABLED,
|
||||
/** Google Form URL for league registration, if configured. */
|
||||
leagueGoogleFormUrl: values.VITE_LEAGUE_GOOGLE_FORM_URL,
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { ActionFunction } from "react-router";
|
||||
import { Config } from "~/config";
|
||||
import { requireUser } from "~/features/auth/core/user.server";
|
||||
import type { ScannerMatch } from "~/features/scanner/core/scanner-match";
|
||||
import { isAdmin } from "~/modules/permissions/utils";
|
||||
import { isAdmin, isDev } from "~/modules/permissions/utils";
|
||||
import { dateToDatabaseTimestamp } from "~/utils/dates";
|
||||
import { logger } from "~/utils/logger";
|
||||
import { forbidden, parseBody } from "~/utils/remix.server";
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
export const action: ActionFunction = async ({ request }) => {
|
||||
const user = requireUser();
|
||||
|
||||
if (!Config.scannerEnabled && !isAdmin(user)) {
|
||||
if (!Config.scannerEnabled && !isAdmin(user) && !isDev(user)) {
|
||||
forbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,9 @@ const ScannerApp = lazy(() =>
|
||||
export default function ScannerPage() {
|
||||
const isHydrated = useHydrated();
|
||||
const isAdmin = useHasRole("ADMIN");
|
||||
const isDev = useHasRole("DEV");
|
||||
|
||||
if (!Config.scannerEnabled && !isAdmin) {
|
||||
if (!Config.scannerEnabled && !isAdmin && !isDev) {
|
||||
return <Redirect to="/" />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user