Release 0.5.1
This commit is contained in:
1 parent
5a9d7735d4
commit
fb24d171ae
36 files changed
+5099
-263
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
duplicatePiece,
|
||||
getPiece,
|
||||
getTaxonomy,
|
||||
loadPiecePresentationMetadata,
|
||||
savePiece,
|
||||
setPieceArchived,
|
||||
uploadPieceImage,
|
||||
@@ -65,6 +66,20 @@ function pieceInput(data: FormData): PieceInput {
|
||||
moderationNotes: text(data, 'moderationNotes'),
|
||||
transitionText: text(data, 'transitionText'),
|
||||
presentationText: text(data, 'presentationText'),
|
||||
presentationMode: text(data, 'presentationMode') as PieceInput['presentationMode'],
|
||||
presentationSourcePosition: text(data, 'presentationSourcePosition')
|
||||
? Number(data.get('presentationSourcePosition'))
|
||||
: null,
|
||||
presentationTitle: text(data, 'presentationTitle'),
|
||||
presentationDescription: text(data, 'presentationDescription'),
|
||||
presentationImageUrl: text(data, 'presentationImageUrl'),
|
||||
presentationSiteName: text(data, 'presentationSiteName'),
|
||||
presentationProvider: text(data, 'presentationProvider'),
|
||||
presentationProviderId: text(data, 'presentationProviderId'),
|
||||
presentationTitleManual: text(data, 'presentationTitleManual') === '1',
|
||||
presentationDescriptionManual: text(data, 'presentationDescriptionManual') === '1',
|
||||
presentationImageManual: text(data, 'presentationImageManual') === '1',
|
||||
presentationMetadataFetchedAtUtc: text(data, 'presentationMetadataFetchedAtUtc') || null,
|
||||
topicIds: data.getAll('topicIds').map(String),
|
||||
categoryIds: data.getAll('categoryIds').map(String),
|
||||
sources
|
||||
@@ -87,6 +102,11 @@ function saveError(cause: unknown) {
|
||||
status: 400,
|
||||
error: 'Quellen benötigen einen Namen und eine vollständige HTTP- oder HTTPS-Adresse.'
|
||||
};
|
||||
if (code === 'INVALID_PRESENTATION')
|
||||
return {
|
||||
status: 400,
|
||||
error: 'Für Linkvorschau und Video muss eine vorhandene gültige Quelle ausgewählt sein.'
|
||||
};
|
||||
if (code.startsWith('INVALID_'))
|
||||
return { status: 400, error: 'Mindestens ein Feld ist ungültig oder zu lang.' };
|
||||
return {
|
||||
@@ -116,6 +136,31 @@ export const actions = {
|
||||
return fail(problem.status, { intent: 'save', ...problem });
|
||||
}
|
||||
},
|
||||
loadPreview: async ({ locals, params, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
try {
|
||||
await loadPiecePresentationMetadata(params.id, Number(data.get('revision')));
|
||||
} catch (cause) {
|
||||
const code = cause instanceof Error ? cause.message : '';
|
||||
if (code === 'FETCH_BLOCKED') {
|
||||
return fail(400, {
|
||||
intent: 'loadPreview',
|
||||
error: 'Interne oder private Netzwerkziele dürfen nicht abgerufen werden.'
|
||||
});
|
||||
}
|
||||
if (code.startsWith('FETCH_')) {
|
||||
return fail(400, {
|
||||
intent: 'loadPreview',
|
||||
error:
|
||||
'Die Vorschau konnte nicht sicher geladen werden. Die manuellen Angaben bleiben erhalten.'
|
||||
});
|
||||
}
|
||||
const problem = saveError(cause);
|
||||
return fail(problem.status, { intent: 'loadPreview', ...problem });
|
||||
}
|
||||
redirect(303, `/fundus/${params.id}`);
|
||||
},
|
||||
upload: async ({ locals, params, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
|
||||
Reference in new issue
Block a user