mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 10:15:17 -04:00

* Added config property for image proxies * Added API call and image url replacing * Added comment explaining why a local function is needed inside the useEffect * Added CHANGELOG entry * Changed wording of the CHANGELOG sentence * Changed CHANGELOG entry Co-Authored-By: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * Removed fallback to original src * Removed unnecessary API call for empty src URLs * Simplify image url fetching * Refactored imageframe to avoid rerendering of images Co-Authored-By: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * Renamed config property to useImageProxy Co-authored-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { Reducer } from 'redux'
|
|
import { BackendConfig } from '../../api/backend-config/types'
|
|
import { BackendConfigActions, BackendConfigActionType, SetBackendConfigAction } from './types'
|
|
|
|
export const initialState: BackendConfig = {
|
|
allowAnonymous: true,
|
|
authProviders: {
|
|
facebook: false,
|
|
github: false,
|
|
twitter: false,
|
|
gitlab: false,
|
|
dropbox: false,
|
|
ldap: false,
|
|
google: false,
|
|
saml: false,
|
|
oauth2: false,
|
|
email: false,
|
|
openid: false
|
|
},
|
|
branding: {
|
|
name: '',
|
|
logo: ''
|
|
},
|
|
banner: {
|
|
text: '',
|
|
timestamp: ''
|
|
},
|
|
customAuthNames: {
|
|
ldap: '',
|
|
oauth2: '',
|
|
saml: ''
|
|
},
|
|
useImageProxy: false,
|
|
specialLinks: {
|
|
privacy: '',
|
|
termsOfUse: '',
|
|
imprint: ''
|
|
},
|
|
version: {
|
|
version: '',
|
|
sourceCodeUrl: '',
|
|
issueTrackerUrl: ''
|
|
}
|
|
}
|
|
|
|
export const BackendConfigReducer: Reducer<(BackendConfig), BackendConfigActions> = (state: (BackendConfig) = initialState, action: BackendConfigActions) => {
|
|
switch (action.type) {
|
|
case BackendConfigActionType.SET_BACKEND_CONFIG:
|
|
return (action as SetBackendConfigAction).state
|
|
default:
|
|
return state
|
|
}
|
|
}
|