diff --git a/Core/API/LanguageAPI.class.php b/Core/API/LanguageAPI.class.php index 74a98a6..5c65c31 100644 --- a/Core/API/LanguageAPI.class.php +++ b/Core/API/LanguageAPI.class.php @@ -115,7 +115,8 @@ namespace Core\API\Language { public function __construct(Context $context, bool $externalCall = false) { parent::__construct($context, $externalCall, [ "code" => new StringType("code", 5, true, NULL), - "modules" => new ArrayType("modules", Parameter::TYPE_STRING, true, false) + "modules" => new ArrayType("modules", Parameter::TYPE_STRING, true, false), + "compression" => new StringType("compression", -1, true, NULL, ["gzip", "zlib"]) ]); $this->loginRequired = false; $this->csrfTokenRequired = false; @@ -156,7 +157,23 @@ namespace Core\API\Language { } $this->result["code"] = $code; - $this->result["entries"] = $entries; + + $compression = $this->getParam("compression"); + if ($compression) { + switch ($compression) { + case "gzip": + $this->result["compressed"] = base64_encode(gzencode(json_encode($entries), 9)); + break; + case "zlib": + $this->result["compressed"] = base64_encode(gzcompress(json_encode($entries), 9, ZLIB_ENCODING_DEFLATE)); + break; + default: + http_response_code(400); + return $this->createError("Invalid compression method: $compression"); + } + } else { + $this->result["entries"] = $entries; + } return true; } } diff --git a/Core/Localization/de_DE/general.php b/Core/Localization/de_DE/general.php index b276317..13496ff 100644 --- a/Core/Localization/de_DE/general.php +++ b/Core/Localization/de_DE/general.php @@ -19,6 +19,7 @@ return [ "cancel" => "Abbrechen", "confirm" => "Bestätigen", "add" => "Hinzufügen", + "select" => "Auswählen", "ok" => "OK", "id" => "ID", "user" => "Benutzer", diff --git a/Core/Localization/de_DE/permissions.php b/Core/Localization/de_DE/permissions.php new file mode 100644 index 0000000..5d513ad --- /dev/null +++ b/Core/Localization/de_DE/permissions.php @@ -0,0 +1,20 @@ + "Berechtigungen", + "title_short" => "ACL", + "query" => "Suchanfrage", + "add_permission" => "Berechtigung hinzufügen", + "permission" => "Berechtigung", + "everyone" => "Alle", + "method" => "Methode", + "description" => "Beschreibung", + + # dialog + "delete_permission_confirm" => "Diese Berechtigung wirklich löschen?", + "edit_permission" => "Berechtigung bearbeiten", + "update_permission_error" => "Fehler beim Aktualisieren der Berechtigung", + "delete_permission_error" => "Fehler beim Löschen der Berechtigung", + "fetch_permission_error" => "Fehler beim Holen der Berechtigungen", + "fetch_group_error" => "Fehler beim Holen der Gruppen", +]; \ No newline at end of file diff --git a/Core/Localization/de_DE/routes.php b/Core/Localization/de_DE/routes.php new file mode 100644 index 0000000..1e70975 --- /dev/null +++ b/Core/Localization/de_DE/routes.php @@ -0,0 +1,41 @@ + "Routen", + "regenerating_cache" => "Lade Cache neu", + "regenerate_cache" => "Cache neuladen", + + # table + "route" => "Route", + "type" => "Typ", + "target" => "Ziel", + "extra" => "Extra", + "active" => "Aktiv", + "exact" => "Exakt", + + # form + "edit_route_title" => "Route bearbeiten", + "create_route_title" => "Neue Route erstellen", + "pattern" => "Pattern", + "arguments" => "Argumente", + "status_code" => "Status Code", + "json_ok" => "JSON ok!", + "json_err" => "Ungültiger JSON-string!", + "json_not_object" => "Das JSON muss ein Array oder Objekt sein!", + "validate_route" => "Route validieren", + "validate_route_placeholder" => "Einen Pfad eingeben um die Route zu testen", + + # data + "type_dynamic" => "Dynamisch", + "type_static" => "Statisch", + "type_redirect_permanently" => "Dauerhaft weiterleiten", + "type_redirect_temporary" => "Temporär weiterleiten", + + # dialogs + "fetch_routes_error" => "Fehler beim Holen der Routen", + "enable_route_error" => "Fehler beim Aktivieren der Route", + "disable_route_error" => "Fehler beim Deaktivieren der Route", + "remove_route_error" => "Fehler beim Entfernen der Route", + "regenerate_router_cache_error" => "Fehler beim Erzeugen des Router Caches", + "regenerate_router_cache_success" => "Router Cache erfolgreich erzeugt", +]; \ No newline at end of file diff --git a/Core/Localization/en_US/general.php b/Core/Localization/en_US/general.php index 2508a67..3da41ec 100644 --- a/Core/Localization/en_US/general.php +++ b/Core/Localization/en_US/general.php @@ -30,6 +30,7 @@ return [ "cancel" => "Cancel", "confirm" => "Confirm", "add" => "Add", + "select" => "Select", "close" => "Close", "ok" => "OK", "id" => "ID", diff --git a/Core/Localization/en_US/permissions.php b/Core/Localization/en_US/permissions.php new file mode 100644 index 0000000..fc1ab82 --- /dev/null +++ b/Core/Localization/en_US/permissions.php @@ -0,0 +1,20 @@ + "Permissions", + "title_short" => "ACL", + "query" => "Search query", + "add_permission" => "Add permission", + "permission" => "Permission", + "everyone" => "Everyone", + "method" => "Method", + "description" => "Description", + + # dialog + "delete_permission_confirm" => "Do you really want to delete this permission?", + "edit_permission" => "Edit Permission", + "update_permission_error" => "Error updating permission", + "delete_permission_error" => "Error deleting permission", + "fetch_permission_error" => "Error fetching permissions", + "fetch_group_error" => "Error fetching groups", +]; \ No newline at end of file diff --git a/Core/Localization/en_US/routes.php b/Core/Localization/en_US/routes.php new file mode 100644 index 0000000..7622dd1 --- /dev/null +++ b/Core/Localization/en_US/routes.php @@ -0,0 +1,41 @@ + "Routes", + "regenerating_cache" => "Regenerating Cache", + "regenerate_cache" => "Regenerate Cache", + + # table + "route" => "Route", + "type" => "Type", + "target" => "Target", + "extra" => "Extra", + "active" => "Active", + "exact" => "Exact", + + # form + "edit_route_title" => "Edit Route", + "create_route_title" => "Create new Route", + "pattern" => "Pattern", + "arguments" => "Arguments", + "status_code" => "Status Code", + "json_ok" => "JSON ok!", + "json_err" => "Invalid JSON-string!", + "json_not_object" => "JSON must be Array or Object!", + "validate_route" => "Validate Route", + "validate_route_placeholder" => "Enter a path to test the route", + + # data + "type_dynamic" => "Dynamic", + "type_static" => "Static", + "type_redirect_permanently" => "Redirect permanently", + "type_redirect_temporary" => "Redirect temporary", + + # dialogs + "fetch_routes_error" => "Error fetching routes", + "enable_route_error" => "Error enabling route", + "disable_route_error" => "Error disabling route", + "remove_route_error" => "Error removing route", + "regenerate_router_cache_error" => "Error regenerating router cache", + "regenerate_router_cache_success" => "Router cache successfully regenerated", +]; \ No newline at end of file diff --git a/react/admin-panel/src/views/access-control-list.js b/react/admin-panel/src/views/access-control-list.js index 4a74b6e..6733709 100644 --- a/react/admin-panel/src/views/access-control-list.js +++ b/react/admin-panel/src/views/access-control-list.js @@ -45,13 +45,13 @@ export default function AccessControlList(props) { setFetchACL(false); props.api.fetchGroups().then(res => { if (!res.success) { - props.showDialog(res.msg, "Error fetching groups"); + props.showDialog(res.msg, L("permissions.fetch_group_error")); navigate("/admin/dashboard"); } else { setGroups(res.groups); props.api.fetchPermissions().then(res => { if (!res.success) { - props.showDialog(res.msg, "Error fetching permissions"); + props.showDialog(res.msg, L("permissions.fetch_permission_error")); navigate("/admin/dashboard"); } else { setACL(res.permissions); @@ -67,7 +67,7 @@ export default function AccessControlList(props) { }, []); useEffect(() => { - requestModules(props.api, ["general"], currentLocale).then(data => { + requestModules(props.api, ["general", "permissions"], currentLocale).then(data => { if (!data.success) { props.showDialog("Error fetching translations: " + data.msg); } @@ -103,7 +103,7 @@ export default function AccessControlList(props) { setACL(newACL); props.api.fetchUser(); } else { - props.showDialog("Error updating permission: " + data.msg); + props.showDialog(data.msg, L("permissions.update_permission_error")); } }); } @@ -116,7 +116,7 @@ export default function AccessControlList(props) { setACL(newACL); props.api.fetchUser(); } else { - props.showDialog("Error deleting permission: " + data.msg); + props.showDialog(data.msg, L("permissions.delete_permission_error")); } }) }, [acl]); @@ -130,7 +130,7 @@ export default function AccessControlList(props) { setACL(newACL); props.api.fetchUser(); } else { - props.showDialog("Error updating permission: " + data.msg); + props.showDialog(data.msg, L("permissions.update_permission_error")); } }) }, [acl]); @@ -162,11 +162,11 @@ export default function AccessControlList(props) { disabled={isRestricted(permission.method)} onClick={() => setDialogData({ open: true, - title: L("Edit permission"), + title: L("permissions.edit_permission"), inputs: [ - { type: "label", value: L("general.method") + ":" }, + { type: "label", value: L("permissions.method") + ":" }, { type: "text", name: "method", value: permission.method, disabled: true }, - { type: "label", value: L("general.description") + ":" }, + { type: "label", value: L("permissions.description") + ":" }, { type: "text", name: "description", value: permission.description, maxLength: 128 } ], onOption: (option, inputData) => option === 0 && onUpdatePermission(inputData, permission.groups) @@ -177,8 +177,8 @@ export default function AccessControlList(props) { disabled={isRestricted(permission.method)} onClick={() => setDialogData({ open: true, - title: L("Do you really want to delete this permission?"), - message: "Method: " + permission.method, + title: L("permissions.delete_permission_confirm"), + message: L("permissions.method") + ": " + permission.method, onOption: (option) => option === 0 && onDeletePermission(permission.method) })} > @@ -212,12 +212,12 @@ export default function AccessControlList(props) {
-

Access Control List

+

{L("permissions.title")}

  1. Home
  2. -
  3. ACL
  4. +
  5. {L("permissions.title_short")}
@@ -226,10 +226,10 @@ export default function AccessControlList(props) {
- + setQuery(e.target.value)} variant={"outlined"} @@ -245,7 +245,7 @@ export default function AccessControlList(props) {