diff --git a/api/src/auth_routes.ts b/api/src/auth_routes.ts index c1ec31fc5..d26675b3f 100644 --- a/api/src/auth_routes.ts +++ b/api/src/auth_routes.ts @@ -47,12 +47,6 @@ const AVAILABLE_AUTH_PROVIDER_DISPLAY_INFO: {[name: string]: any} = { }, }; -const HANDLER_OPTIONS: {[name: string]: any} = { - google: { - prompt: 'select_account', - }, -}; - passport.serializeUser((user: Express.User, done: DoneFunction) => { done(null, user.user_id); }); diff --git a/api/src/couchdb/notebooks.ts b/api/src/couchdb/notebooks.ts index 98ce11132..9ce299f03 100644 --- a/api/src/couchdb/notebooks.ts +++ b/api/src/couchdb/notebooks.ts @@ -763,7 +763,6 @@ export const streamNotebookRecordsAsCSV = async ( while (!done) { // record might be null if there was an invalid db entry if (record) { - const hrid = getRecordHRID(record); const row = [ hrid, diff --git a/api/src/index.ts b/api/src/index.ts index 8db71e786..6ff2cf003 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -22,7 +22,11 @@ import PouchDB from 'pouchdb'; import PouchDBFind from 'pouchdb-find'; -import {CONDUCTOR_INTERNAL_PORT, CONDUCTOR_PUBLIC_URL, COUCHDB_INTERNAL_URL} from './buildconfig'; +import { + CONDUCTOR_INTERNAL_PORT, + CONDUCTOR_PUBLIC_URL, + COUCHDB_INTERNAL_URL, +} from './buildconfig'; import {app} from './routes'; diff --git a/app/src/App.tsx b/app/src/App.tsx index 709576b00..3629aa7a1 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -43,7 +43,7 @@ import {AuthReturn} from './gui/components/authentication/auth_return'; import CreateNewSurvey from './gui/components/workspace/CreateNewSurvey'; import NotFound404 from './gui/pages/404'; import {AppUrlListener} from './native_hooks'; -import { NotificationProvider } from './context/popup'; +import {NotificationProvider} from './context/popup'; // type AppProps = {}; diff --git a/app/src/buildconfig.ts b/app/src/buildconfig.ts index ea7498123..5896e02a0 100644 --- a/app/src/buildconfig.ts +++ b/app/src/buildconfig.ts @@ -56,28 +56,6 @@ function commit_version(): string { } } -function prod_build(): boolean { - const productionBuild = import.meta.env.VITE_PRODUCTION_BUILD; - if ( - productionBuild === '' || - productionBuild === undefined || - TRUTHY_STRINGS.includes(productionBuild.toLowerCase()) - ) { - return true; - } else if (FALSEY_STRINGS.includes(productionBuild.toLowerCase())) { - return false; - } else { - logError('VITE_PRODUCTION_BUILD badly defined, assuming false'); - return false; - } -} -/* - * This isn't exported, instead to help reduce the number of environment - * variables to set to get a production build for real users. Can be used in the - * rest of the configuration. - */ -const PROD_BUILD = prod_build(); - function include_pouchdb_debugging(): boolean { const debug_pouch = import.meta.env.VITE_DEBUG_POUCHDB; if (debug_pouch === '' || debug_pouch === undefined) { @@ -215,32 +193,6 @@ function cluster_admin_group_name(): string { return name; } -function disable_signin_redirect(): boolean { - const disable_signin = import.meta.env.VITE_DISABLE_SIGNIN_REDIRECT; - if (disable_signin === '' || disable_signin === undefined) { - return false; - } - if (FALSEY_STRINGS.includes(disable_signin.toLowerCase())) { - return false; - } else if (TRUTHY_STRINGS.includes(disable_signin.toLowerCase())) { - return true; - } else { - logError('VITE_DISABLE_SIGNIN_REDIRECT badly defined, assuming false'); - return false; - } -} - -function get_login_token(): string | undefined { - const login_token = import.meta.env.VITE_LOGIN_TOKEN; - if (login_token === '' || login_token === undefined) { - return undefined; - } - if (PROD_BUILD) { - logError('Production builds should not set login token, except under test'); - } - return login_token; -} - // If VITE_BUGSNAG_KEY is not defined then we don't use Bugsnag function get_bugsnag_key(): string | false { const bugsnag_key = import.meta.env.VITE_BUGSNAG_KEY; @@ -394,8 +346,6 @@ export const CLUSTER_ADMIN_GROUP_NAME = cluster_admin_group_name(); export const SHOW_MINIFAUXTON = show_minifauxton(); export const SHOW_WIPE = show_wipe(); export const SHOW_NEW_NOTEBOOK = show_new_notebook(); -export const DISABLE_SIGNIN_REDIRECT = disable_signin_redirect(); -export const BUILT_LOGIN_TOKEN = get_login_token(); export const BUGSNAG_KEY = get_bugsnag_key(); export const NOTEBOOK_LIST_TYPE = get_notebook_list_type(); export const NOTEBOOK_NAME = get_notebook_name(); diff --git a/app/src/constants/privateRouter.tsx b/app/src/constants/privateRouter.tsx index 934b541d4..8a9fdd9a2 100644 --- a/app/src/constants/privateRouter.tsx +++ b/app/src/constants/privateRouter.tsx @@ -1,6 +1,5 @@ import {Navigate} from 'react-router-dom'; -import {DISABLE_SIGNIN_REDIRECT} from '../buildconfig'; import * as ROUTES from './routes'; import {useGetAnyToken} from '../utils/tokenHooks'; import LoadingApp from '../gui/components/loadingApp'; @@ -20,17 +19,11 @@ export const PrivateRoute = (props: PrivateRouteProps): React.ReactElement => { // Get a default token - this is the first listing's token // TODO use a context provider for listings instead of getting first entry const anyToken = useGetAnyToken(); - console.log(`Found token ${anyToken.data ?? 'UNDEFINED/loading'}`); - // The token is being retrieved if (anyToken.isFetching) { return ; } - const {children} = props; - return !!anyToken.data?.token || DISABLE_SIGNIN_REDIRECT ? ( - children - ) : ( - - ); + if (anyToken.data?.token) return props.children; + else return ; }; diff --git a/app/src/context/functions.tsx b/app/src/context/functions.tsx index d1d19bc12..77fdb08e5 100644 --- a/app/src/context/functions.tsx +++ b/app/src/context/functions.tsx @@ -61,7 +61,6 @@ export const getDefaultToken = async (): Promise => { export const getAnyToken = async (): Promise => { // Get listings const listings = await getListings(); - console.log(listings); // If there is an entry, use first for (const listing of listings) { diff --git a/app/src/gui/components/authentication/appbarAuth.tsx b/app/src/gui/components/authentication/appbarAuth.tsx index 4c2565fd1..d73946a72 100644 --- a/app/src/gui/components/authentication/appbarAuth.tsx +++ b/app/src/gui/components/authentication/appbarAuth.tsx @@ -26,11 +26,9 @@ import {checkToken} from '../../../utils/helpers'; import {Person} from '@mui/icons-material'; import {theme} from '../../themes'; -interface SignInButtonComponentProps {} -const SignInButtonComponent = (props: SignInButtonComponentProps) => { +const SignInButtonComponent = () => { /** Component: SignInButtonComponent - */ return (