[task-343] [int]
This commit is contained in:
parent
e298a43f65
commit
af7f65c29c
17
data/localization/de.json
Normal file
17
data/localization/de.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"meta": {
|
||||||
|
"identifier": "de",
|
||||||
|
"name": "Deutsch"
|
||||||
|
},
|
||||||
|
"tree": {
|
||||||
|
"event": "Termin",
|
||||||
|
"events": "Termine",
|
||||||
|
"reminder": "Erinnerung",
|
||||||
|
"title_long": "Titel",
|
||||||
|
"title_short": "was",
|
||||||
|
"time_long": "Datum und Uhrzeit",
|
||||||
|
"time_short": "wann",
|
||||||
|
"location_long": "Ort",
|
||||||
|
"location_short": "wo"
|
||||||
|
}
|
||||||
|
}
|
17
data/localization/en.json
Normal file
17
data/localization/en.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"meta": {
|
||||||
|
"identifier": "en",
|
||||||
|
"name": "English"
|
||||||
|
},
|
||||||
|
"tree": {
|
||||||
|
"event": "event",
|
||||||
|
"events": "events",
|
||||||
|
"reminder": "reminder",
|
||||||
|
"title_long": "title",
|
||||||
|
"title_short": "what",
|
||||||
|
"time_long": "date and time",
|
||||||
|
"time_short": "when",
|
||||||
|
"location_long": "location",
|
||||||
|
"location_short": "where"
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@
|
||||||
"file",
|
"file",
|
||||||
"conf",
|
"conf",
|
||||||
"log",
|
"log",
|
||||||
|
"translate",
|
||||||
"args"
|
"args"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
214
source/conf.ts
214
source/conf.ts
|
@ -315,11 +315,69 @@ namespace _munin.conf
|
||||||
events : string;
|
events : string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export type type_conf = type_conf_v5;
|
type type_conf_v6 = {
|
||||||
|
sources : Array<
|
||||||
|
(
|
||||||
|
{
|
||||||
|
kind : "ical_feed";
|
||||||
|
data : {
|
||||||
|
url : string;
|
||||||
|
filtration : {
|
||||||
|
category_whitelist : (null | Array<string>);
|
||||||
|
category_blacklist : (null | Array<string>);
|
||||||
|
title_whitelist : (null | Array<string>);
|
||||||
|
title_blacklist : (null | Array<string>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
>;
|
||||||
|
targets : Array<
|
||||||
|
(
|
||||||
|
{
|
||||||
|
kind : "email";
|
||||||
|
data : {
|
||||||
|
smtp_host : string;
|
||||||
|
smtp_port : int;
|
||||||
|
smtp_username : string;
|
||||||
|
smtp_password : string;
|
||||||
|
sender : string;
|
||||||
|
receivers : Array<string>;
|
||||||
|
hide_tags : boolean;
|
||||||
|
/**
|
||||||
|
* in hours
|
||||||
|
*/
|
||||||
|
reminders : Array<type_reminder_raw>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
{
|
||||||
|
kind : "telegram_bot";
|
||||||
|
data : {
|
||||||
|
bot_token : string;
|
||||||
|
chat_id : int;
|
||||||
|
hide_tags : boolean;
|
||||||
|
/**
|
||||||
|
* in hours
|
||||||
|
*/
|
||||||
|
reminders : Array<type_reminder_raw>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
>;
|
||||||
|
settings : {
|
||||||
|
interval : float;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export type type_conf = type_conf_v6;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -538,6 +596,25 @@ namespace _munin.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
function convert_from_v5(
|
||||||
|
conf_v5 : type_conf_v5
|
||||||
|
) : type_conf_v6
|
||||||
|
{
|
||||||
|
lib_plankton.log._notice(
|
||||||
|
"munin.conf.dropping_labels",
|
||||||
|
{
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
"source": conf_v5.sources,
|
||||||
|
"targets": conf_v5.targets,
|
||||||
|
"settings": conf_v5.settings,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function schema_source_kalender_digital(
|
function schema_source_kalender_digital(
|
||||||
|
@ -695,7 +772,8 @@ namespace _munin.conf
|
||||||
) : lib_plankton.conf.type_schema
|
) : lib_plankton.conf.type_schema
|
||||||
{
|
{
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case "1": {
|
case "1":
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
@ -709,7 +787,8 @@ namespace _munin.conf
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
case "2": {
|
case "2":
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
@ -743,7 +822,6 @@ namespace _munin.conf
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case "5":
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
|
@ -802,7 +880,6 @@ namespace _munin.conf
|
||||||
{
|
{
|
||||||
return [24];
|
return [24];
|
||||||
}
|
}
|
||||||
case "5":
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -915,27 +992,54 @@ namespace _munin.conf
|
||||||
"data": {
|
"data": {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": Object.assign(
|
||||||
"bot_token": {
|
{
|
||||||
"nullable": false,
|
"bot_token": {
|
||||||
"type": "string",
|
"nullable": false,
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
"chat_id": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "integer",
|
||||||
|
},
|
||||||
|
"hide_tags": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
},
|
||||||
|
"reminders": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "array",
|
||||||
|
"items": schema_reminder(version),
|
||||||
|
"default": default_reminder(version),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"chat_id": {
|
(() => {
|
||||||
"nullable": false,
|
switch (version)
|
||||||
"type": "integer",
|
{
|
||||||
},
|
case "1":
|
||||||
"hide_tags": {
|
case "2":
|
||||||
"nullable": false,
|
case "3":
|
||||||
"type": "boolean",
|
case "4":
|
||||||
"default": false,
|
case "5":
|
||||||
},
|
{
|
||||||
"reminders": {
|
return {};
|
||||||
"nullable": false,
|
break;
|
||||||
"type": "array",
|
}
|
||||||
"items": schema_reminder(version),
|
default:
|
||||||
"default": default_reminder(version),
|
{
|
||||||
},
|
return {
|
||||||
},
|
"language": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "string",
|
||||||
|
"default": "de"
|
||||||
|
},
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) ()
|
||||||
|
),
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": [
|
"required": [
|
||||||
"bot_token",
|
"bot_token",
|
||||||
|
@ -973,8 +1077,6 @@ namespace _munin.conf
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "4":
|
|
||||||
case "5":
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -1015,54 +1117,10 @@ namespace _munin.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function schema_labels(
|
|
||||||
version : string
|
|
||||||
) : lib_plankton.conf.type_schema
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"head": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
"default": "Termin-Erinnerung"
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
"default": "was"
|
|
||||||
},
|
|
||||||
"time": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
"default": "wann"
|
|
||||||
},
|
|
||||||
"location": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
"default": "wo"
|
|
||||||
},
|
|
||||||
"events": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
"default": "Termine"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"additionalProperties": false,
|
|
||||||
"required": [
|
|
||||||
],
|
|
||||||
"default": {}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function schema(
|
export function schema(
|
||||||
version : string = "5"
|
version : string = "6"
|
||||||
) : lib_plankton.conf.type_schema
|
) : lib_plankton.conf.type_schema
|
||||||
{
|
{
|
||||||
switch (version) {
|
switch (version) {
|
||||||
|
@ -1088,10 +1146,7 @@ namespace _munin.conf
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "2":
|
default:
|
||||||
case "3":
|
|
||||||
case "4":
|
|
||||||
case "5":
|
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
|
@ -1128,7 +1183,8 @@ namespace _munin.conf
|
||||||
"2": {"target": "3", "function": convert_from_v2},
|
"2": {"target": "3", "function": convert_from_v2},
|
||||||
"3": {"target": "4", "function": convert_from_v3},
|
"3": {"target": "4", "function": convert_from_v3},
|
||||||
"4": {"target": "5", "function": convert_from_v4},
|
"4": {"target": "5", "function": convert_from_v4},
|
||||||
"5": null,
|
"5": {"target": "6", "function": convert_from_v5},
|
||||||
|
"6": null,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1166,7 +1222,7 @@ namespace _munin.conf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return (conf_raw.content as type_conf_v5);
|
return (conf_raw.content as type_conf_v6);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,17 @@ namespace _munin
|
||||||
args_raw.join(" ")
|
args_raw.join(" ")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await lib_plankton.translate.initialize(
|
||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
lib_plankton.json.decode(
|
||||||
|
await lib_plankton.file.read("localization/de.json"),
|
||||||
|
await lib_plankton.file.read("localization/en.json"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (args.help) {
|
if (args.help) {
|
||||||
process.stdout.write(
|
process.stdout.write(
|
||||||
arg_handler.generate_help(
|
arg_handler.generate_help(
|
||||||
|
|
|
@ -30,17 +30,6 @@ namespace _munin
|
||||||
monthly = "monthly",
|
monthly = "monthly",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export type type_labels = {
|
|
||||||
head : string;
|
|
||||||
title : string;
|
|
||||||
time : string;
|
|
||||||
location : string;
|
|
||||||
events : string;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue