-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for extension config loading (issue #847) #884
Closed
+14
−1
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixes for extension config loading (issue #847)
* Actually add/remove extensions from `Config.Extensions.extensions` * Fix the file path where `ExtensionConfigTemplateLoader` looks for extensions * Prevent the first `loadSync()` call from creating a `config.json` file Works around bpatrik/typeconfig#27
commit b04dc6046abc86a0eca6898fc2961095af9cbc76
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unchanged files with check annotations Beta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
); | ||
} | ||
export type LoggerArgs = (string | number | (() => string) | Record<any, unknown> | Error); | ||
export type LoggerFunction = (...args: LoggerArgs[]) => void; | ||
export interface ILogger { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {TAGS} from '../../../common/config/public/ClientConfig'; | ||
import {ObjectManagers} from '../../model/ObjectManagers'; | ||
import {ExtensionConfigWrapper} from '../../model/extension/ExtensionConfigWrapper'; | ||
import {Logger} from '../../Logger'; | ||
const LOG_TAG = '[SettingsMWs]'; | ||
export class SettingsMWs { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthenticationMWs.authorise(minRole)] : []; | ||
} | ||
public jsonResponse(paths: string[], minRole: UserRoles, cb: (params?: ParamsDictionary, body?: any, user?: UserDTO) => Promise<unknown> | unknown) { | ||
const fullPaths = paths.map(p => (Utils.concatUrls('/' + this.name + '/' + p))); | ||
this.router[this.func](fullPaths, | ||
...(this.getAuthMWs(minRole).concat([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ServerExtensionsEntryConfig} from '../../../common/config/private/subconfigs/ServerExtensionsConfig'; | ||
const LOG_TAG = '[ExtensionConfigTemplateLoader]'; | ||
/** | ||
* This class decouples the extension management and the config. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* @param cb function callback | ||
* @return newly added REST api path | ||
*/ | ||
jsonResponse(paths: string[], minRole: UserRoles, cb: (params?: ParamsDictionary, body?: any, user?: UserDTO) => Promise<unknown> | unknown): string; | ||
/** | ||
* Exposes a standard expressjs middleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (const sidecarPath of sidecarPaths) { | ||
if (fs.existsSync(sidecarPath)) { | ||
const sidecarData: any = await exifr.sidecar(sidecarPath); | ||
if (sidecarData !== undefined) { | ||
MetadataLoader.mapMetadata(metadata, sidecarData); | ||
} | ||
for (const sidecarPath of sidecarPaths) { | ||
if (fs.existsSync(sidecarPath)) { | ||
const sidecarData: any = await exifr.sidecar(sidecarPath, exifrOptions); | ||
if (sidecarData !== undefined) { | ||
MetadataLoader.mapMetadata(metadata, sidecarData); | ||
} | ||
return metadata; | ||
} | ||
private static mapMetadata(metadata: PhotoMetadata, exif: any) { | ||
//replace adobe xap-section with xmp to reuse parsing | ||
if (Object.hasOwn(exif, 'xap')) { | ||
exif['xmp'] = exif['xap']; | ||
} | ||
} | ||
private static getOrientation(exif: any): number { | ||
let orientation = 1; //Orientation 1 is normal | ||
if (exif.ifd0?.Orientation != undefined) { | ||
orientation = parseInt(exif.ifd0.Orientation as any, 10) as number; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wanted to avoid this. (i.e.: I removed this laoding here on porpuse.)
I would like to have a single place that is responsible loading extension config (even if they do not exists, then its an empty config).
That is why I moved all code to the extension config loader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a closer look at the extension config loader. I didn't see anywhere else that
Config.Extensions.extensions.push(new ServerExtensionsEntryConfig(ep)));
happened, so the extension configs never actually got loaded intoConfig
.