Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: readonly externally configured locations

Ilian Sapundshiev6fa765631a1c
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index 8150328b2..8c8aa3483 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -75,8 +75,6 @@ import DirectoryTreeView from '-/components/DirectoryTreeView';
import LoadingLazy from '-/components/LoadingLazy';
import { FileSystemEntry } from '-/services/utils-io';
-const isLocationsReadOnly = window.ExtLocationsReadOnly;
-
const CreateLocationDialog = React.lazy(() =>
import(
/* webpackChunkName: "CreateLocationDialog" */ './dialogs/CreateLocationDialog'
@@ -569,7 +567,7 @@ class LocationManager extends React.Component<Props, State> {
</div>
</TargetMoveFileBox>
)}
- {!isLocationsReadOnly && (
+ {!AppConfig.locationsReadOnly && (
<ListItemSecondaryAction>
<IconButton
aria-label={i18n.t('core:options')}
@@ -642,7 +640,7 @@ class LocationManager extends React.Component<Props, State> {
onClose={this.handleCloseLocationManagerMenu}
openURLExternally={this.props.openURLExternally}
/>
- {!isLocationsReadOnly && (
+ {!AppConfig.locationsReadOnly && (
<div style={{ width: '100%', textAlign: 'center', marginBottom: 10 }}>
<Button
data-tid="createNewLocation"
diff --git a/app/config.ts b/app/config.ts
index a10907789..35ec917e2 100644
--- a/app/config.ts
+++ b/app/config.ts
@@ -99,25 +99,24 @@ export const AppConfig = {
isCordovaAndroid,
isCordova: isCordovaiOS || isCordovaAndroid,
isMobile: isCordovaiOS || isCordovaAndroid || isIOS || isAndroid,
- customLogo: (window as any).ExtLogoURL || false,
+ customLogo: window.ExtLogoURL || false,
showAdvancedSearch:
- (window as any).ExtShowAdvancedSearch !== undefined
- ? (window as any).ExtShowAdvancedSearch
+ window.ExtShowAdvancedSearch !== undefined
+ ? window.ExtShowAdvancedSearch
: true,
showSmartTags:
- (window as any).ExtShowSmartTags !== undefined
- ? (window as any).ExtShowSmartTags
- : true,
+ window.ExtShowSmartTags !== undefined ? window.ExtShowSmartTags : true,
showWelcomePanel:
- (window as any).ExtShowWelcomePanel !== undefined
- ? (window as any).ExtShowWelcomePanel
+ window.ExtShowWelcomePanel !== undefined
+ ? window.ExtShowWelcomePanel
: true,
- sidebarColor: (window as any).ExtSidebarColor || '#2C001E', // '#00D1A1' // #008023
- sidebarSelectionColor: (window as any).ExtSidebarSelectionColor || '#880E4F',
- lightThemeLightColor: (window as any).ExtLightThemeLightColor || '#dcf3ec',
- lightThemeMainColor: (window as any).ExtLightThemeMainColor || '#1dd19f',
- darkThemeLightColor: (window as any).ExtDarkThemeLightColor || '#56454e',
- darkThemeMainColor: (window as any).ExtDarkThemeMainColor || '#ff9abe',
+ locationsReadOnly: window.ExtLocations !== undefined,
+ sidebarColor: window.ExtSidebarColor || '#2C001E', // '#00D1A1' // #008023
+ sidebarSelectionColor: window.ExtSidebarSelectionColor || '#880E4F',
+ lightThemeLightColor: window.ExtLightThemeLightColor || '#dcf3ec',
+ lightThemeMainColor: window.ExtLightThemeMainColor || '#1dd19f',
+ darkThemeLightColor: window.ExtDarkThemeLightColor || '#56454e',
+ darkThemeMainColor: window.ExtDarkThemeMainColor || '#ff9abe',
dirSeparator:
navigator.appVersion.includes('Win') && !document.URL.startsWith('http')
? '\\'
diff --git a/app/tagspaces.d.ts b/app/tagspaces.d.ts
index dbaf6ae60..fb89eb062 100644
--- a/app/tagspaces.d.ts
+++ b/app/tagspaces.d.ts
@@ -32,12 +32,20 @@ declare interface Window {
ExtDefaultVerticalPanel?: string;
ExtDisplayMode?: string;
ExtDefaultPerspective?: string;
- ExtLocationsReadOnly?: string;
ExtTagLibrary?: Array<any>;
ExtLocations?: Array<any>;
ExtTheme?: string;
ExtIsFirstRun?: boolean;
ExtDefaultVerticalPanel?: string;
+ ExtSidebarColor?: string;
+ ExtSidebarSelectionColor?: string;
+ ExtLightThemeLightColor?: string;
+ ExtLightThemeMainColor?: string;
+ ExtDarkThemeLightColor?: string;
+ ExtDarkThemeMainColor?: string;
+ ExtShowWelcomePanel?: string;
+ ExtShowSmartTags?: string;
+ ExtShowAdvancedSearch?: string;
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: any;
plugins?: any; // needed for Cordova
resolveLocalFileSystemURL?: any; // needed for Cordova