[mod] date formatting [mod] caldav resource integration

This commit is contained in:
Fenris Wolf 2024-11-01 13:34:44 +01:00
parent cde912392c
commit c9b882edbe
7 changed files with 42 additions and 22 deletions

View file

@ -33,6 +33,7 @@ namespace _zeitbild.api
data : { data : {
url : string; url : string;
read_only : boolean; read_only : boolean;
from_fucked_up_wordpress : boolean;
}; };
} }
); );
@ -79,6 +80,7 @@ namespace _zeitbild.api
"data": { "data": {
"url": stuff.input.resource.data.url, "url": stuff.input.resource.data.url,
"read_only": stuff.input.resource.data.read_only, "read_only": stuff.input.resource.data.read_only,
"from_fucked_up_wordpress": stuff.input.resource.data.from_fucked_up_wordpress,
} }
}; };
break; break;

View file

@ -168,7 +168,8 @@ namespace _zeitbild.api
user_id user_id
) )
.then( .then(
(data) => Promise.resolve({ (data) => Promise.resolve(
{
"status_code": 200, "status_code": 200,
"data": ( "data": (
data data
@ -182,13 +183,16 @@ namespace _zeitbild.api
}) })
) )
), ),
}) }
)
) )
.catch( .catch(
(reason) => Promise.resolve({ (reason) => Promise.resolve(
{
"status_code": 403, "status_code": 403,
"data": String(reason), "data": String(reason),
}) }
)
) )
); );
} }

View file

@ -5,7 +5,7 @@ namespace _zeitbild.database
/** /**
*/ */
const _compatible_revisions : Array<string> = [ const _compatible_revisions : Array<string> = [
"r3", "r4",
]; ];

View file

@ -40,6 +40,7 @@ type type_data = {
data : { data : {
url : string; url : string;
read_only : boolean; read_only : boolean;
from_fucked_up_wordpress ?: boolean;
}; };
} }
); );
@ -109,6 +110,7 @@ async function data_init(
"data": { "data": {
"url": calendar_raw.resource.data.url, "url": calendar_raw.resource.data.url,
"read_only": calendar_raw.resource.data.read_only, "read_only": calendar_raw.resource.data.read_only,
"from_fucked_up_wordpress": (calendar_raw.resource.data.from_fucked_up_wordpress ?? false),
} }
}; };
resource_id = await _zeitbild.service.resource.add( resource_id = await _zeitbild.service.resource.add(

View file

@ -366,6 +366,7 @@ namespace _zeitbild.repository.resource
"data": { "data": {
"url": dataset_extra_caldav["url"], "url": dataset_extra_caldav["url"],
"read_only": dataset_extra_caldav["read_only"], "read_only": dataset_extra_caldav["read_only"],
"from_fucked_up_wordpress": dataset_extra_caldav["from_fucked_up_wordpress"],
} }
} }
); );
@ -409,6 +410,7 @@ namespace _zeitbild.repository.resource
{ {
"url": resource_object.data.url, "url": resource_object.data.url,
"read_only": resource_object.data.read_only, "read_only": resource_object.data.read_only,
"from_fucked_up_wordpress": resource_object.data.from_fucked_up_wordpress,
} }
); );
const resource_id : _zeitbild.type_resource_id = await get_resource_core_store().create( const resource_id : _zeitbild.type_resource_id = await get_resource_core_store().create(

View file

@ -348,11 +348,20 @@ namespace _zeitbild.service.calendar
{ {
} }
); );
const vcalendar : lib_plankton.ical.type_vcalendar = lib_plankton.ical.ics_decode( const ics_raw : string = http_response.body.toString();
http_response.body.toString(), const vcalendar_list : Array<lib_plankton.ical.type_vcalendar> = lib_plankton.ical.ics_decode_multi(
ics_raw,
{ {
"ignore_unhandled_instruction_keys": resource_object.data.from_fucked_up_wordpress,
"from_fucked_up_wordpress": resource_object.data.from_fucked_up_wordpress,
} }
); );
const vcalendar : lib_plankton.ical.type_vcalendar = {
// required
"version": vcalendar_list[0].version,
"prodid": vcalendar_list[0].prodid,
"vevents": vcalendar_list.map(x => x.vevents).reduce((x, y) => x.concat(y), []),
};
return Promise.resolve( return Promise.resolve(
vcalendar.vevents vcalendar.vevents
.map( .map(

View file

@ -86,6 +86,7 @@ namespace _zeitbild
data : { data : {
url : string; url : string;
read_only : boolean; read_only : boolean;
from_fucked_up_wordpress : boolean;
}; };
} }
); );