diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/l10n/de.js | 2 | ||||
-rw-r--r-- | lib/l10n/de.json | 2 | ||||
-rw-r--r-- | lib/l10n/de_DE.js | 4 | ||||
-rw-r--r-- | lib/l10n/de_DE.json | 4 | ||||
-rw-r--r-- | lib/l10n/uz.js | 1 | ||||
-rw-r--r-- | lib/l10n/uz.json | 1 | ||||
-rw-r--r-- | lib/private/NavigationManager.php | 19 | ||||
-rw-r--r-- | lib/private/Security/Normalizer/IpAddress.php | 9 | ||||
-rw-r--r-- | lib/private/TaskProcessing/Manager.php | 1 | ||||
-rw-r--r-- | lib/private/Template/JSResourceLocator.php | 2 | ||||
-rw-r--r-- | lib/private/URLGenerator.php | 5 | ||||
-rw-r--r-- | lib/public/TaskProcessing/TaskTypes/TextToSpeech.php | 92 |
14 files changed, 125 insertions, 19 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 3d36f50e950..6264126b028 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -837,6 +837,7 @@ return array( 'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php', 'OCP\\TaskProcessing\\TaskTypes\\GenerateEmoji' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php', 'OCP\\TaskProcessing\\TaskTypes\\TextToImage' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToImage.php', + 'OCP\\TaskProcessing\\TaskTypes\\TextToSpeech' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php', 'OCP\\TaskProcessing\\TaskTypes\\TextToText' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToText.php', 'OCP\\TaskProcessing\\TaskTypes\\TextToTextChangeTone' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextChangeTone.php', 'OCP\\TaskProcessing\\TaskTypes\\TextToTextChat' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextChat.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 7085d0b4a44..5771a621afe 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -878,6 +878,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php', 'OCP\\TaskProcessing\\TaskTypes\\GenerateEmoji' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php', 'OCP\\TaskProcessing\\TaskTypes\\TextToImage' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToImage.php', + 'OCP\\TaskProcessing\\TaskTypes\\TextToSpeech' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php', 'OCP\\TaskProcessing\\TaskTypes\\TextToText' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToText.php', 'OCP\\TaskProcessing\\TaskTypes\\TextToTextChangeTone' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextChangeTone.php', 'OCP\\TaskProcessing\\TaskTypes\\TextToTextChat' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextChat.php', diff --git a/lib/l10n/de.js b/lib/l10n/de.js index 565432632e8..cf3ea1d59ba 100644 --- a/lib/l10n/de.js +++ b/lib/l10n/de.js @@ -101,7 +101,7 @@ OC.L10N.register( "Invalid parent path" : "Ungültiger übergeordneter Pfad", "File already exists" : "Datei bereits vorhanden", "Invalid path" : "Ungültiger Pfad", - "Failed to create file from template" : "Fehler beim Erstellen der Datei aus Vorlage", + "Failed to create file from template" : "Datei konnte nicht aus Vorlage erstellt werden", "Templates" : "Vorlagen", "Storage %s cannot be moved" : "Speicherplatz %s kann nicht verschoben werden", "Moving a share (%s) into a shared folder is not allowed" : "Verschieben einer Freigabe (%s) in einen freigegebenen Ordner ist unzulässig", diff --git a/lib/l10n/de.json b/lib/l10n/de.json index f9b01867ab0..b40c32376cd 100644 --- a/lib/l10n/de.json +++ b/lib/l10n/de.json @@ -99,7 +99,7 @@ "Invalid parent path" : "Ungültiger übergeordneter Pfad", "File already exists" : "Datei bereits vorhanden", "Invalid path" : "Ungültiger Pfad", - "Failed to create file from template" : "Fehler beim Erstellen der Datei aus Vorlage", + "Failed to create file from template" : "Datei konnte nicht aus Vorlage erstellt werden", "Templates" : "Vorlagen", "Storage %s cannot be moved" : "Speicherplatz %s kann nicht verschoben werden", "Moving a share (%s) into a shared folder is not allowed" : "Verschieben einer Freigabe (%s) in einen freigegebenen Ordner ist unzulässig", diff --git a/lib/l10n/de_DE.js b/lib/l10n/de_DE.js index d43d052a549..80b0ee32bd4 100644 --- a/lib/l10n/de_DE.js +++ b/lib/l10n/de_DE.js @@ -101,7 +101,7 @@ OC.L10N.register( "Invalid parent path" : "Ungültiger übergeordneter Pfad", "File already exists" : "Datei bereits vorhanden", "Invalid path" : "Ungültiger Pfad", - "Failed to create file from template" : "Fehler beim Erstellen der Datei aus Vorlage", + "Failed to create file from template" : "Datei konnte nicht aus Vorlage erstellt werden", "Templates" : "Vorlagen", "Storage %s cannot be moved" : "Speicherplatz %s kann nicht verschoben werden", "Moving a share (%s) into a shared folder is not allowed" : "Verschieben einer Freigabe (%s) in einen freigegebenen Ordner ist unzulässig", @@ -313,7 +313,7 @@ OC.L10N.register( "Your data directory is invalid." : "Ihr Datenverzeichnis ist ungültig.", "Ensure there is a file called \"%1$s\" in the root of the data directory. It should have the content: \"%2$s\"" : "Stellen Sie sicher, dass eine Datei \"%1$s\" im Wurzelverzeichnis des Datenverzeichnisses existiert. Sie sollte folgenden Inhalt haben: \"%2$s\"", "Action \"%s\" not supported or implemented." : "Aktion \"%s\" wird nicht unterstützt oder ist nicht implementiert.", - "Authentication failed, wrong token or provider ID given" : "Authentifizierung ist fehlgeschlagen. Falsches Token oder Provider-ID wurde übertragen.", + "Authentication failed, wrong token or provider ID given" : "Authentifizierung fehlgeschlagen, falsches Token oder falsche Provider-ID angegeben", "Parameters missing in order to complete the request. Missing Parameters: \"%s\"" : "Es fehlen Parameter um die Anfrage zu bearbeiten. Fehlende Parameter: \"%s\"", "ID \"%1$s\" already used by cloud federation provider \"%2$s\"" : "ID \"%1$s\" wird bereits von Cloud-Federation-Provider \"%2$s\" verwendet.", "Cloud Federation Provider with ID: \"%s\" does not exist." : "Cloud-Federation-Provider mit ID: \"%s\" ist nicht vorhanden.", diff --git a/lib/l10n/de_DE.json b/lib/l10n/de_DE.json index 9e974ad5fac..9354b0bcdf6 100644 --- a/lib/l10n/de_DE.json +++ b/lib/l10n/de_DE.json @@ -99,7 +99,7 @@ "Invalid parent path" : "Ungültiger übergeordneter Pfad", "File already exists" : "Datei bereits vorhanden", "Invalid path" : "Ungültiger Pfad", - "Failed to create file from template" : "Fehler beim Erstellen der Datei aus Vorlage", + "Failed to create file from template" : "Datei konnte nicht aus Vorlage erstellt werden", "Templates" : "Vorlagen", "Storage %s cannot be moved" : "Speicherplatz %s kann nicht verschoben werden", "Moving a share (%s) into a shared folder is not allowed" : "Verschieben einer Freigabe (%s) in einen freigegebenen Ordner ist unzulässig", @@ -311,7 +311,7 @@ "Your data directory is invalid." : "Ihr Datenverzeichnis ist ungültig.", "Ensure there is a file called \"%1$s\" in the root of the data directory. It should have the content: \"%2$s\"" : "Stellen Sie sicher, dass eine Datei \"%1$s\" im Wurzelverzeichnis des Datenverzeichnisses existiert. Sie sollte folgenden Inhalt haben: \"%2$s\"", "Action \"%s\" not supported or implemented." : "Aktion \"%s\" wird nicht unterstützt oder ist nicht implementiert.", - "Authentication failed, wrong token or provider ID given" : "Authentifizierung ist fehlgeschlagen. Falsches Token oder Provider-ID wurde übertragen.", + "Authentication failed, wrong token or provider ID given" : "Authentifizierung fehlgeschlagen, falsches Token oder falsche Provider-ID angegeben", "Parameters missing in order to complete the request. Missing Parameters: \"%s\"" : "Es fehlen Parameter um die Anfrage zu bearbeiten. Fehlende Parameter: \"%s\"", "ID \"%1$s\" already used by cloud federation provider \"%2$s\"" : "ID \"%1$s\" wird bereits von Cloud-Federation-Provider \"%2$s\" verwendet.", "Cloud Federation Provider with ID: \"%s\" does not exist." : "Cloud-Federation-Provider mit ID: \"%s\" ist nicht vorhanden.", diff --git a/lib/l10n/uz.js b/lib/l10n/uz.js index b3d7be96b38..10dc2ccabf5 100644 --- a/lib/l10n/uz.js +++ b/lib/l10n/uz.js @@ -31,6 +31,7 @@ OC.L10N.register( "Authentication error" : "Authentication error", "Storage is temporarily not available" : "Storage is temporarily not available", "Confirmation" : "Tasdiqlash", + "Text" : "Matn", "Translate" : "Tarjima", "File name is too long" : "File name is too long", "Users" : "Users", diff --git a/lib/l10n/uz.json b/lib/l10n/uz.json index d032d72f931..6a9b2008a78 100644 --- a/lib/l10n/uz.json +++ b/lib/l10n/uz.json @@ -29,6 +29,7 @@ "Authentication error" : "Authentication error", "Storage is temporarily not available" : "Storage is temporarily not available", "Confirmation" : "Tasdiqlash", + "Text" : "Matn", "Translate" : "Tarjima", "File name is too long" : "File name is too long", "Users" : "Users", diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index c2125bc6f8a..fb0795376bb 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -77,7 +77,7 @@ class NavigationManager implements INavigationManager { $this->closureEntries[] = $entry; return; } - $this->init(); + $this->init(false); $id = $entry['id']; @@ -123,10 +123,6 @@ class NavigationManager implements INavigationManager { */ public function getAll(string $type = 'link'): array { $this->init(); - foreach ($this->closureEntries as $c) { - $this->add($c()); - } - $this->closureEntries = []; $result = $this->entries; if ($type !== 'all') { @@ -212,7 +208,13 @@ class NavigationManager implements INavigationManager { return $this->activeEntry; } - private function init() { + private function init(bool $resolveClosures = true): void { + if ($resolveClosures) { + while ($c = array_pop($this->closureEntries)) { + $this->add($c()); + } + } + if ($this->init) { return; } @@ -420,11 +422,6 @@ class NavigationManager implements INavigationManager { public function get(string $id): ?array { $this->init(); - foreach ($this->closureEntries as $c) { - $this->add($c()); - } - $this->closureEntries = []; - return $this->entries[$id]; } diff --git a/lib/private/Security/Normalizer/IpAddress.php b/lib/private/Security/Normalizer/IpAddress.php index b3793685a24..4d33a7bd632 100644 --- a/lib/private/Security/Normalizer/IpAddress.php +++ b/lib/private/Security/Normalizer/IpAddress.php @@ -42,8 +42,15 @@ class IpAddress { $maskSize = min(64, $config->getSystemValueInt('security.ipv6_normalized_subnet_size', 56)); $maskSize = max(32, $maskSize); if (PHP_INT_SIZE === 4) { + if ($maskSize === 64) { + $value = -1; + } elseif ($maskSize === 63) { + $value = PHP_INT_MAX; + } else { + $value = (1 << $maskSize - 32) - 1; + } // as long as we support 32bit PHP we cannot use the `P` pack formatter (and not overflow 32bit integer) - $mask = pack('VVVV', 0xFFFF, $maskSize === 64 ? 0xFFFF : ((1 << $maskSize - 32) - 1), 0, 0); + $mask = pack('VVVV', -1, $value, 0, 0); } else { $mask = pack('VVP', (1 << 32) - 1, (1 << $maskSize - 32) - 1, 0); } diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index a701c23d56f..9992310dbbb 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -584,6 +584,7 @@ class Manager implements IManager { \OCP\TaskProcessing\TaskTypes\TextToTextChatWithTools::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\TextToTextChatWithTools::class), \OCP\TaskProcessing\TaskTypes\ContextAgentInteraction::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\ContextAgentInteraction::class), \OCP\TaskProcessing\TaskTypes\TextToTextProofread::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\TextToTextProofread::class), + \OCP\TaskProcessing\TaskTypes\TextToSpeech::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\TextToSpeech::class), ]; foreach ($context->getTaskProcessingTaskTypes() as $providerServiceRegistration) { diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index aad999f939a..a6d2d13a2ad 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -69,7 +69,7 @@ class JSResourceLocator extends ResourceLocator { || $this->appendScriptIfExist($this->serverroot, "dist/$app-$scriptName") || $this->appendScriptIfExist($appRoot, $script, $appWebRoot) || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script . '.json') - || $this->cacheAndAppendCombineJsonIfExist($appRoot, $script . '.json', $appWebRoot) + || $this->cacheAndAppendCombineJsonIfExist($appRoot, $script . '.json', $app) || $this->appendScriptIfExist($this->serverroot, $theme_dir . 'core/' . $script) || $this->appendScriptIfExist($this->serverroot, 'core/' . $script) || (strpos($scriptName, '/') === -1 && ($this->appendScriptIfExist($this->serverroot, $theme_dir . "dist/core-$scriptName") diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index ad12fae5144..c78ecac0903 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -304,6 +304,11 @@ class URLGenerator implements IURLGenerator { if ($href === '') { throw new \InvalidArgumentException('Default navigation entry is missing href: ' . $entryId); } + + if (str_starts_with($href, $this->getBaseUrl())) { + return $href; + } + if (str_starts_with($href, '/index.php/') && ($this->config->getSystemValueBool('htaccess.IgnoreFrontController', false) || getenv('front_controller_active') === 'true')) { $href = substr($href, 10); } diff --git a/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php b/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php new file mode 100644 index 00000000000..ce35be32a6f --- /dev/null +++ b/lib/public/TaskProcessing/TaskTypes/TextToSpeech.php @@ -0,0 +1,92 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\TaskProcessing\TaskTypes; + +use OCP\IL10N; +use OCP\L10N\IFactory; +use OCP\TaskProcessing\EShapeType; +use OCP\TaskProcessing\ITaskType; +use OCP\TaskProcessing\ShapeDescriptor; + +/** + * This is the task processing task type for speech generation + * @since 32.0.0 + */ +class TextToSpeech implements ITaskType { + /** + * @since 32.0.0 + */ + public const ID = 'core:text2speech'; + + private IL10N $l; + + /** + * @param IFactory $l10nFactory + * @since 32.0.0 + */ + public function __construct( + IFactory $l10nFactory, + ) { + $this->l = $l10nFactory->get('lib'); + } + + + /** + * @inheritDoc + * @since 32.0.0 + */ + public function getName(): string { + return $this->l->t('Generate speech'); + } + + /** + * @inheritDoc + * @since 32.0.0 + */ + public function getDescription(): string { + return $this->l->t('Generate speech from a transcript'); + } + + /** + * @return string + * @since 32.0.0 + */ + public function getId(): string { + return self::ID; + } + + /** + * @return ShapeDescriptor[] + * @since 32.0.0 + */ + public function getInputShape(): array { + return [ + 'input' => new ShapeDescriptor( + $this->l->t('Prompt'), + $this->l->t('Write transcript that you want the assistant to generate speech from'), + EShapeType::Text + ), + ]; + } + + /** + * @return ShapeDescriptor[] + * @since 32.0.0 + */ + public function getOutputShape(): array { + return [ + 'speech' => new ShapeDescriptor( + $this->l->t('Output speech'), + $this->l->t('The generated speech'), + EShapeType::Audio + ), + ]; + } +} |