mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 21:54:09 +00:00
feat: cuesheet sharing
feat: locked presets refactor: simplify locked param refactor: create share links
This commit is contained in:
committed by
Carlos Valente
parent
1695b4dc68
commit
6c6f5c2c0f
@@ -16,16 +16,17 @@ export function parseUrlPresets(data: Partial<DatabaseModel>, emitError?: ErrorE
|
||||
const newPresets: URLPreset[] = [];
|
||||
|
||||
for (const preset of data.urlPresets) {
|
||||
if (!preset.alias || !preset.search || !preset.target) {
|
||||
if (!preset.alias || !preset.target) {
|
||||
emitError?.(`Invalid URL preset: ${JSON.stringify(preset)}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const newPreset = {
|
||||
const newPreset: URLPreset = {
|
||||
enabled: preset.enabled ?? false,
|
||||
alias: preset.alias,
|
||||
target: preset.target,
|
||||
search: preset.search,
|
||||
search: preset.search ?? '',
|
||||
options: preset?.options,
|
||||
};
|
||||
newPresets.push(newPreset);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ router.post('/', validateNewPreset, async (req: Request, res: Response<URLPreset
|
||||
alias: req.body.alias,
|
||||
target: req.body.target,
|
||||
search: req.body.search,
|
||||
options: req.body.options,
|
||||
};
|
||||
|
||||
const currentPresets = getDataProvider().getUrlPresets();
|
||||
@@ -50,7 +51,7 @@ router.put('/:alias', validateUpdatePreset, async (req: Request, res: Response<U
|
||||
};
|
||||
|
||||
if (alias !== updatedPreset.alias) {
|
||||
throw new Error(`Changing alias is not permitted`);
|
||||
throw new Error('Changing alias is not permitted');
|
||||
}
|
||||
|
||||
const currentPresets = getDataProvider().getUrlPresets();
|
||||
|
||||
@@ -14,6 +14,10 @@ export const validateNewPreset = [
|
||||
body('target').isString().trim().notEmpty().isIn(Object.values(OntimeView)),
|
||||
body('search').isString().trim(),
|
||||
|
||||
// options are currently only provided for cuesheet presets
|
||||
body('options').optional().isObject(),
|
||||
body('options.*').isString().trim(),
|
||||
|
||||
requestValidationFunction,
|
||||
];
|
||||
|
||||
@@ -25,6 +29,10 @@ export const validateUpdatePreset = [
|
||||
body('target').isString().trim().notEmpty().isIn(Object.values(OntimeView)),
|
||||
body('search').isString().trim(),
|
||||
|
||||
// options are currently only provided for cuesheet presets
|
||||
body('options').optional().isObject(),
|
||||
body('options.*').isString().trim(),
|
||||
|
||||
requestValidationFunction,
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user