From 8c0c4c113c419fbab82c69b21b617f51881f3210 Mon Sep 17 00:00:00 2001 From: MichelleAntunes Date: Mon, 9 Nov 2026 16:25:39 +0100 Subject: [PATCH] feat: add tag-based indexing with allow and deny lists Admins can limit what Context Chat indexes with system tags. The index mode is either "all" (the default, unchanged) or "tag_only". In tag mode the admin picks an allow list and a deny list of tags: - allow list only: index what has an allow tag - deny list only: index everything except what has a deny tag - both: index what has an allow tag and no deny tag A tag on a folder covers everything inside it, and the same tag cannot be in both lists. - TagEligibilityService decides whether a file may be indexed. The queue checks it again when an item is processed, so a stale item is dropped. - Tag and file events keep the index in line: a file that is no longer eligible is removed, one that became eligible is queued. - Switching the mode schedules a full cleanup (to tag mode) or a full indexing run (back to all). When only the lists change, one small job per added or removed tag looks at the files that carry that tag, instead of reading every file again. - occ context_chat:cleanup-untagged runs the cleanup by hand. - IndexCompletionService holds the "initial indexing completed" check, moved out of QueueController so the cleanup can use it too. It keeps the checks of the controller and also waits for cleanup crawl jobs and pending actions. - The admin settings get the mode switch and the two tag selectors. Changes are saved at once and the server explains why it refuses one. - Users get a notification, created by a background job, when the admin switches to tag mode. It goes away when the admin switches back. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AL889gRk3a2UdQAufak8m9 Signed-off-by: MichelleAntunes --- appinfo/info.xml | 1 + lib/AppInfo/Application.php | 7 + lib/BackgroundJobs/TagListChangedJob.php | 79 +++++ lib/BackgroundJobs/TagModeNoticeJob.php | 87 +++++ lib/BackgroundJobs/TagRemovedJob.php | 49 +++ .../UntaggedCleanupCrawlJob.php | 83 +++++ .../UntaggedCleanupSchedulerJob.php | 48 +++ lib/Command/CleanupUntagged.php | 43 +++ lib/Controller/ConfigController.php | 165 ++++++++++ lib/Controller/QueueController.php | 79 +---- lib/Listener/FileListener.php | 2 +- lib/Listener/TagListener.php | 82 +++++ lib/Notification/Notifier.php | 57 ++++ lib/Service/FsEventService.php | 68 +++- lib/Service/IndexCompletionService.php | 117 +++++++ lib/Service/TagEligibilityService.php | 201 ++++++++++++ lib/Settings/AdminSettings.php | 25 ++ package-lock.json | 304 +++++++++--------- package.json | 2 + src/components/ViewAdmin.vue | 126 +++++++- 20 files changed, 1403 insertions(+), 222 deletions(-) create mode 100644 lib/BackgroundJobs/TagListChangedJob.php create mode 100644 lib/BackgroundJobs/TagModeNoticeJob.php create mode 100644 lib/BackgroundJobs/TagRemovedJob.php create mode 100644 lib/BackgroundJobs/UntaggedCleanupCrawlJob.php create mode 100644 lib/BackgroundJobs/UntaggedCleanupSchedulerJob.php create mode 100644 lib/Command/CleanupUntagged.php create mode 100644 lib/Listener/TagListener.php create mode 100644 lib/Notification/Notifier.php create mode 100644 lib/Service/IndexCompletionService.php create mode 100644 lib/Service/TagEligibilityService.php diff --git a/appinfo/info.xml b/appinfo/info.xml index e9d2f223..a2fb8874 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -47,6 +47,7 @@ Refer to the [Context Chat Backend's readme](https://github.com/nextcloud/contex OCA\ContextChat\Command\Search OCA\ContextChat\Command\Statistics OCA\ContextChat\Command\Reindex + OCA\ContextChat\Command\CleanupUntagged OCA\ContextChat\Command\Wipe diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 94e88229..03075af8 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -11,7 +11,9 @@ use OCA\ContextChat\Listener\AppDisableListener; use OCA\ContextChat\Listener\FileListener; use OCA\ContextChat\Listener\ShareListener; +use OCA\ContextChat\Listener\TagListener; use OCA\ContextChat\Listener\UserDeletedListener; +use OCA\ContextChat\Notification\Notifier; use OCP\App\Events\AppDisableEvent; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; @@ -26,6 +28,8 @@ use OCP\Files\Events\NodeRemovedFromCache; use OCP\Share\Events\ShareCreatedEvent; use OCP\Share\Events\ShareDeletedEvent; +use OCP\SystemTag\TagAssignedEvent; +use OCP\SystemTag\TagUnassignedEvent; use OCP\User\Events\UserDeletedEvent; class Application extends App implements IBootstrap { @@ -70,8 +74,11 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(NodeRenamedEvent::class, FileListener::class); $context->registerEventListener(NodeRemovedFromCache::class, FileListener::class); $context->registerEventListener(NodeWrittenEvent::class, FileListener::class); + $context->registerEventListener(TagAssignedEvent::class, TagListener::class); + $context->registerEventListener(TagUnassignedEvent::class, TagListener::class); $context->registerEventListener(AppDisableEvent::class, AppDisableListener::class); $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); + $context->registerNotifierService(Notifier::class); // These events were added mid-way through NC 30, 31 if (class_exists('OCP\Files\Config\Event\UserMountAddedEvent')) { $context->registerEventListener('OCP\Files\Config\Event\UserMountAddedEvent', FileListener::class); diff --git a/lib/BackgroundJobs/TagListChangedJob.php b/lib/BackgroundJobs/TagListChangedJob.php new file mode 100644 index 00000000..fac89146 --- /dev/null +++ b/lib/BackgroundJobs/TagListChangedJob.php @@ -0,0 +1,79 @@ +logger->warning('[TagListChangedJob] Invalid arguments, nothing done'); + return; + } + + try { + $objectIds = $this->tagMapper->getObjectIdsForTags([$tagId], 'files'); + } catch (\Throwable $e) { + // for example the tag was deleted in the meantime + $this->logger->warning('[TagListChangedJob] Cannot list files of tag ' . $tagId . ': ' . $e->getMessage(), ['exception' => $e]); + return; + } + + foreach ($objectIds as $objectId) { + try { + $node = $this->rootFolder->getFirstNodeById((int)$objectId); + if ($node === null) { + continue; + } + if ($action === self::ACTION_INDEX) { + $this->fsEventService->onInsert($node); + } else { + $this->fsEventService->onTagRemoved($node); + } + } catch (\Throwable $e) { + $this->logger->warning('[TagListChangedJob] Failed for file id ' . $objectId . ': ' . $e->getMessage(), ['exception' => $e]); + } + } + } +} diff --git a/lib/BackgroundJobs/TagModeNoticeJob.php b/lib/BackgroundJobs/TagModeNoticeJob.php new file mode 100644 index 00000000..0893fb16 --- /dev/null +++ b/lib/BackgroundJobs/TagModeNoticeJob.php @@ -0,0 +1,87 @@ +logger->warning('[TagModeNoticeJob] Invalid action, nothing done'); + return; + } + + $tagMode = $this->appConfig->getAppValueString('index_mode', 'all', lazy: true) === 'tag_only'; + if (($action === self::ACTION_NOTIFY) !== $tagMode) { + // the mode changed again after this job was queued + return; + } + + $skipUser = $argument['skip_user'] ?? null; + $count = 0; + $this->userManager->callForSeenUsers(function (IUser $user) use ($action, $skipUser, &$count): void { + if (!$user->isEnabled() || $user->getUID() === $skipUser) { + return; + } + + $notification = $this->notificationManager->createNotification(); + $notification->setApp(Application::APP_ID) + ->setUser($user->getUID()) + ->setObject(self::OBJECT_TYPE, self::OBJECT_ID); + // never leave two of them for one user + $this->notificationManager->markProcessed($notification); + + if ($action === self::ACTION_NOTIFY) { + $notification->setDateTime($this->time->getDateTime()) + ->setSubject(Notifier::SUBJECT_TAG_MODE_ENABLED); + $this->notificationManager->notify($notification); + } + $count++; + }); + + $this->logger->info('[TagModeNoticeJob] ' . $action . ' done for ' . $count . ' users'); + } +} diff --git a/lib/BackgroundJobs/TagRemovedJob.php b/lib/BackgroundJobs/TagRemovedJob.php new file mode 100644 index 00000000..9c0ce4bf --- /dev/null +++ b/lib/BackgroundJobs/TagRemovedJob.php @@ -0,0 +1,49 @@ +rootFolder->getFirstNodeById($argument['file_id']); + if ($node === null) { + return; + } + if (($argument['kind'] ?? self::KIND_ALLOW) === self::KIND_DENY) { + $this->fsEventService->onInsert($node); + return; + } + $this->fsEventService->onTagRemoved($node); + } +} diff --git a/lib/BackgroundJobs/UntaggedCleanupCrawlJob.php b/lib/BackgroundJobs/UntaggedCleanupCrawlJob.php new file mode 100644 index 00000000..e3938d1c --- /dev/null +++ b/lib/BackgroundJobs/UntaggedCleanupCrawlJob.php @@ -0,0 +1,83 @@ +jobList->remove(self::class, $argument); + + $mountFilesCount = 0; + $lastFileIdSeen = $lastFileId; + foreach ($this->storageService->getFilesInMount($storageId, $rootId, $lastFileId, self::BATCH_SIZE) as $fileId) { + $lastFileIdSeen = $fileId; + $mountFilesCount++; + + $node = $this->rootFolder->getFirstNodeById($fileId); + if ($node === null) { + continue; + } + + if (!$this->fsEventService->hasAiKnowledgeTag($node)) { + $this->fsEventService->onDelete($node, false); + } + } + + if ($mountFilesCount > 0) { + // Schedule next batch + $this->jobList->scheduleAfter(self::class, $this->time->getTime() + self::JOB_INTERVAL, [ + 'storage_id' => $storageId, + 'root_id' => $rootId, + 'last_file_id' => $lastFileIdSeen, + ]); + } else { + $this->logger->info('[UntaggedCleanupCrawlJob] Finished mount storage_id=' . $storageId . ' root_id=' . $rootId); + $this->indexCompletionService->checkAndMarkComplete(); + } + } +} diff --git a/lib/BackgroundJobs/UntaggedCleanupSchedulerJob.php b/lib/BackgroundJobs/UntaggedCleanupSchedulerJob.php new file mode 100644 index 00000000..04a42bff --- /dev/null +++ b/lib/BackgroundJobs/UntaggedCleanupSchedulerJob.php @@ -0,0 +1,48 @@ +appConfig->setAppValueInt('last_indexed_time', 0, lazy: true); + foreach ($this->storageService->getMounts() as $mount) { + $this->logger->debug('[UntaggedCleanupSchedulerJob] Scheduling cleanup storage_id=' . $mount['storage_id'] . ' root_id=' . $mount['root_id']); + $this->jobList->add(UntaggedCleanupCrawlJob::class, [ + 'storage_id' => $mount['storage_id'], + 'root_id' => $mount['root_id'], + 'last_file_id' => 0, + ]); + } + $this->jobList->remove(self::class); + } +} diff --git a/lib/Command/CleanupUntagged.php b/lib/Command/CleanupUntagged.php new file mode 100644 index 00000000..d83150a8 --- /dev/null +++ b/lib/Command/CleanupUntagged.php @@ -0,0 +1,43 @@ +setName('context_chat:cleanup-untagged') + ->setDescription('Schedule removal from the index of all files that do not have the "AI knowledge" tag.'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int { + if ($this->jobList->has(UntaggedCleanupSchedulerJob::class, null)) { + $output->writeln('A cleanup is already scheduled; nothing to do.'); + return 0; + } + $this->jobList->add(UntaggedCleanupSchedulerJob::class); + $output->writeln('Scheduled removal of untagged files from the index.'); + return 0; + } +} diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 67758d80..d9ada6e4 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -7,19 +7,30 @@ namespace OCA\ContextChat\Controller; +use OCA\ContextChat\BackgroundJobs\SchedulerJob; +use OCA\ContextChat\BackgroundJobs\TagListChangedJob; +use OCA\ContextChat\BackgroundJobs\TagModeNoticeJob; +use OCA\ContextChat\BackgroundJobs\UntaggedCleanupSchedulerJob; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Services\IAppConfig; +use OCP\BackgroundJob\IJobList; +use OCP\IAppConfig as ICoreAppConfig; use OCP\IRequest; use OCP\PreConditionNotMetException; class ConfigController extends Controller { + private const TAG_LIST_KEYS = ['tag_allow_ids', 'tag_deny_ids']; + public function __construct( string $appName, IRequest $request, private IAppConfig $appConfig, + private IJobList $jobList, + private ICoreAppConfig $coreAppConfig, private ?string $userId, ) { parent::__construct($appName, $request); @@ -43,6 +54,151 @@ public function setConfig(array $values): DataResponse { return new DataResponse(1); } + private function handleIndexModeChange(array $values): void { + if (!isset($values['index_mode'])) { + return; + } + $oldMode = $this->appConfig->getAppValueString('index_mode', 'all', lazy: true); + $newMode = $values['index_mode']; + if ($newMode === $oldMode) { + return; + } + if ($newMode === 'tag_only') { + $this->jobList->add(UntaggedCleanupSchedulerJob::class); + $this->jobList->add(TagModeNoticeJob::class, [ + 'action' => TagModeNoticeJob::ACTION_NOTIFY, + 'skip_user' => $this->userId, + ]); + } else { + $this->jobList->add(SchedulerJob::class); + $this->jobList->add(TagModeNoticeJob::class, ['action' => TagModeNoticeJob::ACTION_DISMISS]); + } + } + + /** + * Keeps the index in line with a change of the allow/deny lists, without reading every + * file when that is not needed: + * - the allow list goes from empty to filled: only files without an allow tag can + * change (they must leave), so a full cleanup runs; + * - the allow list goes from filled to empty: only files without tags can change + * (they must enter), so a full indexing run is started; + * - any other change: only files carrying the tag that was added or removed can change, + * so one small job per tag looks at those files. + * Does nothing in mode "all", and when the mode itself changes in the same request + * (handleIndexModeChange already starts a full run then). + * Expects $values after normalizeTagLists and before the new values are stored. + */ + private function handleTagListChange(array $values): void { + $oldMode = $this->appConfig->getAppValueString('index_mode', 'all', lazy: true); + $newMode = $values['index_mode'] ?? $oldMode; + if ($oldMode !== 'tag_only' || $newMode !== 'tag_only') { + return; + } + + $oldAllow = $this->sortedTagIds([], 'tag_allow_ids'); + $newAllow = $this->sortedTagIds($values, 'tag_allow_ids'); + $oldDeny = $this->sortedTagIds([], 'tag_deny_ids'); + $newDeny = $this->sortedTagIds($values, 'tag_deny_ids'); + + $allowStarted = $oldAllow === [] && $newAllow !== []; + $allowEmptied = $oldAllow !== [] && $newAllow === []; + if ($allowStarted) { + $this->jobList->add(UntaggedCleanupSchedulerJob::class); + } + if ($allowEmptied) { + $this->jobList->add(SchedulerJob::class); + } + + if (!$allowStarted) { + foreach (array_diff($newAllow, $oldAllow) as $tagId) { + $this->addTagListChangedJob($tagId, TagListChangedJob::ACTION_INDEX); + } + } + if (!$allowEmptied) { + foreach (array_diff($oldAllow, $newAllow) as $tagId) { + $this->addTagListChangedJob($tagId, TagListChangedJob::ACTION_REMOVE); + } + } + foreach (array_diff($newDeny, $oldDeny) as $tagId) { + $this->addTagListChangedJob($tagId, TagListChangedJob::ACTION_REMOVE); + } + foreach (array_diff($oldDeny, $newDeny) as $tagId) { + $this->addTagListChangedJob($tagId, TagListChangedJob::ACTION_INDEX); + } + } + + private function addTagListChangedJob(int $tagId, string $action): void { + $this->jobList->add(TagListChangedJob::class, ['tag_id' => $tagId, 'action' => $action]); + } + + /** + * @return int[] unique, sorted + */ + private function sortedTagIds(array $values, string $key): array { + $ids = array_unique($this->tagIds($values, $key)); + sort($ids); + return array_values($ids); + } + + /** + * Turns the allow/deny tag lists of a request into a JSON list of unique, sorted + * tag ids, which is how they are stored. Accepts an array or a JSON string. + * + * @throws \InvalidArgumentException if a list is not a list of tag ids + */ + private function normalizeTagLists(array $values): array { + foreach (self::TAG_LIST_KEYS as $key) { + if (!array_key_exists($key, $values)) { + continue; + } + $raw = $values[$key]; + if (is_string($raw)) { + $raw = $raw === '' ? [] : json_decode($raw, true); + } + if (!is_array($raw)) { + throw new \InvalidArgumentException("The value of $key must be a list of tag ids."); + } + $ids = []; + foreach ($raw as $id) { + if (!is_int($id) && !(is_string($id) && ctype_digit($id))) { + throw new \InvalidArgumentException("The value of $key must be a list of tag ids."); + } + $ids[(int)$id] = (int)$id; + } + sort($ids); + $values[$key] = json_encode(array_values($ids)); + } + return $values; + } + + /** + * Checks the settings as they will be after saving: what is already stored plus + * what arrived in the request. + * + * @throws \InvalidArgumentException + */ + private function validateTagConfig(array $values): void { + $allow = $this->tagIds($values, 'tag_allow_ids'); + $deny = $this->tagIds($values, 'tag_deny_ids'); + $mode = $values['index_mode'] ?? $this->appConfig->getAppValueString('index_mode', 'all', lazy: true); + + if (array_intersect($allow, $deny) !== []) { + throw new \InvalidArgumentException('The same tag cannot be in both the allow list and the deny list.'); + } + if ($mode === 'tag_only' && $allow === [] && $deny === []) { + throw new \InvalidArgumentException('Select at least one allow or deny tag before indexing by tags.'); + } + } + + /** + * @return int[] + */ + private function tagIds(array $values, string $key): array { + $raw = $values[$key] ?? $this->appConfig->getAppValueString($key, '[]', lazy: true); + $decoded = json_decode((string)$raw, true); + return is_array($decoded) ? array_map('intval', $decoded) : []; + } + /** * Set admin config values * @@ -50,9 +206,18 @@ public function setConfig(array $values): DataResponse { * @return DataResponse */ public function setAdminConfig(array $values): DataResponse { + try { + $values = $this->normalizeTagLists($values); + $this->validateTagConfig($values); + } catch (\InvalidArgumentException $e) { + return new DataResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST); + } + $this->handleIndexModeChange($values); + $this->handleTagListChange($values); foreach ($values as $key => $value) { $this->appConfig->setAppValueString($key, $value, lazy: true); } + $this->coreAppConfig->clearCache(); return new DataResponse(1); } } diff --git a/lib/Controller/QueueController.php b/lib/Controller/QueueController.php index 9d9e24dc..07b3657f 100644 --- a/lib/Controller/QueueController.php +++ b/lib/Controller/QueueController.php @@ -10,13 +10,14 @@ namespace OCA\ContextChat\Controller; use OC\User\NoUserException; -use OCA\ContextChat\BackgroundJobs\StorageCrawlJob; use OCA\ContextChat\Db\QueueActionMapper; use OCA\ContextChat\Db\QueueContentItem; use OCA\ContextChat\Db\QueueContentItemMapper; use OCA\ContextChat\Db\QueueFile; use OCA\ContextChat\Db\QueueMapper; use OCA\ContextChat\Service\FetchGuard; +use OCA\ContextChat\Service\FsEventService; +use OCA\ContextChat\Service\IndexCompletionService; use OCA\ContextChat\Service\ProviderConfigService; use OCA\ContextChat\Type\Source; use OCP\AppFramework\Http; @@ -47,6 +48,8 @@ public function __construct( private IJobList $jobList, private ITimeFactory $timeFactory, private QueueMapper $queueMapper, + private FsEventService $fsEventService, + private IndexCompletionService $indexCompletionService, private FetchGuard $fetchGuard, string $corsMethods = 'PUT, POST, GET, DELETE, PATCH', string $corsAllowedHeaders = 'Authorization, Content-Type, Accept, OCS-APIRequest', @@ -118,6 +121,7 @@ public function getDocumentsQueueItems( } try { + $this->indexCompletionService->checkAndMarkComplete(); $filesKey = ProviderConfigService::getDefaultProviderKey(); $files = []; // a wipe of the files holds back the files only @@ -207,7 +211,7 @@ public function deleteDocumentsQueueItems(IDBConnection $db, QueueMapper $queueM } try { - $this->setInitialIndexCompletion(); + $this->indexCompletionService->checkAndMarkComplete(); } catch (\Throwable $e) { $this->logger->warning('Could not check for initial index completion', ['exception' => $e]); } @@ -345,6 +349,9 @@ private function getFileSource(QueueFile $document, IRootFolder $rootFolder, IUs if ($file === null) { throw new \Exception('File ' . $document->getFileId() . ' not found or not a file (tried users: ' . implode(', ', $userIds) . ')'); } + if (!$this->fsEventService->hasAiKnowledgeTag($file)) { + throw new \Exception('File does not have the required tag for indexing'); + } return new Source( $userIds, @@ -371,72 +378,4 @@ private function getContentItemSource(QueueContentItem $document) : Source { strlen($document->getContent()), ); } - - /** - * @template T of \OCP\BackgroundJob\Job - * @psalm-param T::class $jobClass - */ - public function getJobCount(string $jobClass): int { - $countByClass = array_values(array_filter($this->jobList->countByClass(), fn ($row) => $row['class'] == $jobClass)); - $jobCount = count($countByClass) > 0 ? $countByClass[0]['count'] : 0; - return $jobCount; - } - - private function setInitialIndexCompletion(): void { - if ($this->appConfig->getAppValueInt('last_indexed_time', 0, lazy: true) !== 0) { - return; - } - - try { - $crawlJobCount = $this->getJobCount(StorageCrawlJob::class); - if ($crawlJobCount > 0) { - $this->logger->debug('StorageCrawlJob\'s still scheduled for execution, intial indexing has not completed.'); - return; - } - } catch (\Exception $e) { - $this->logger->warning('Could not get count of scheduled StorageCrawlJob jobs', ['exception' => $e]); - return; - } - - try { - $lastEnqueuedDbId = $this->appConfig->getAppValueInt('last_enqueued_db_id', -1, lazy: true); - if ($lastEnqueuedDbId === -1) { - // Instances that completed their crawl before this value was introduced never got - // it set, and the migration only backfills it while the referenced file is still - // queued. Seed it from the queue instead of falling through to counting every file - // in the file cache on every single request. - $maxQueuedDbId = $this->queueMapper->getMaxId(); - if ($maxQueuedDbId === null) { - // no crawl jobs left and nothing queued, so everything has been indexed once - $this->logger->info('Initial index completion detected, setting last indexed time'); - $this->appConfig->setAppValueInt('last_indexed_time', $this->timeFactory->getTime(), lazy: true); - return; - } - $this->appConfig->setAppValueInt('last_enqueued_db_id', $maxQueuedDbId, lazy: true); - $lastEnqueuedDbId = $maxQueuedDbId; - } - - $initiallyQueuedFilesExist = $this->queueMapper->existsQueueItemsUpToDbId($lastEnqueuedDbId); - if ($initiallyQueuedFilesExist) { - $this->logger->debug('Initially queued files still in the queue, intial indexing has not completed.'); - return; - } - $this->logger->info('Initial index completion detected, setting last indexed time'); - $this->appConfig->setAppValueInt('last_indexed_time', $this->timeFactory->getTime(), lazy: true); - return; - } catch (\Exception $e) { - $this->logger->warning('Could not get last enqueued file\'s DB id', ['exception' => $e]); - } - - // last enqueued file's ID could not be retrieved, fall back to checking whether the queue is - // empty. With no crawl jobs left, nothing more will be queued for the initial index. - try { - if ($this->queueMapper->getMaxId() === null) { - $this->logger->info('Initial index completion detected, setting last indexed time'); - $this->appConfig->setAppValueInt('last_indexed_time', $this->timeFactory->getTime(), lazy: true); - } - } catch (\Exception $e) { - $this->logger->warning('Could not check whether the queue is empty', ['exception' => $e]); - } - } } diff --git a/lib/Listener/FileListener.php b/lib/Listener/FileListener.php index b4b08cac..e2ec221f 100644 --- a/lib/Listener/FileListener.php +++ b/lib/Listener/FileListener.php @@ -67,7 +67,7 @@ public function handle(Event $event): void { // Folders need to be handled here too since cache entry is not removed when file is // initially deleted (moved to trashbin) so NodeRemovedFromCache is not fired and not // handled but we need to remove the file from the CCB index. - $this->fsEventService->onDelete($event->getNode()); + $this->fsEventService->onDelete($event->getNode(), true, true); return; } diff --git a/lib/Listener/TagListener.php b/lib/Listener/TagListener.php new file mode 100644 index 00000000..42726f02 --- /dev/null +++ b/lib/Listener/TagListener.php @@ -0,0 +1,82 @@ + + */ +class TagListener implements IEventListener { + public function __construct( + private TagEligibilityService $tagEligibility, + private IRootFolder $rootFolder, + private FsEventService $fsEventService, + private IJobList $jobList, + ) { + } + + public function handle(Event $event): void { + if (!($event instanceof TagAssignedEvent) && !($event instanceof TagUnassignedEvent)) { + return; + } + + if ($event->getObjectType() !== 'files') { + return; + } + + // In the "index everything" mode the tags are ignored. + if (!$this->tagEligibility->usesTags()) { + return; + } + + $eventTags = array_map('strval', $event->getTags()); + $allowHit = array_intersect($this->tagEligibility->getAllowTagIds(), $eventTags) !== []; + $denyHit = array_intersect($this->tagEligibility->getDenyTagIds(), $eventTags) !== []; + if (!$allowHit && !$denyHit) { + return; + } + + foreach ($event->getObjectIds() as $objectId) { + if ($event instanceof TagUnassignedEvent) { + // The tag mapper emits this event while it is still rewriting the tag + // rows, so a tag on a parent folder cannot be seen yet. Decide later. + if ($allowHit) { + $this->jobList->add(TagRemovedJob::class, ['file_id' => (int)$objectId, 'kind' => TagRemovedJob::KIND_ALLOW]); + } + if ($denyHit) { + $this->jobList->add(TagRemovedJob::class, ['file_id' => (int)$objectId, 'kind' => TagRemovedJob::KIND_DENY]); + } + continue; + } + + $node = $this->rootFolder->getFirstNodeById((int)$objectId); + if ($node === null) { + continue; + } + if ($allowHit) { + // An allow tag was added: index what is now eligible. + $this->fsEventService->onInsert($node); + } + if ($denyHit) { + // A deny tag was added: take out of the index what is no longer eligible. + $this->fsEventService->onTagRemoved($node); + } + } + } +} diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php new file mode 100644 index 00000000..97cb8031 --- /dev/null +++ b/lib/Notification/Notifier.php @@ -0,0 +1,57 @@ +l10nFactory->get(Application::APP_ID)->t('Context Chat'); + } + + /** + * @throws UnknownNotificationException when the notification is not from this app + */ + public function prepare(INotification $notification, string $languageCode): INotification { + if ($notification->getApp() !== Application::APP_ID) { + throw new UnknownNotificationException(); + } + + $l = $this->l10nFactory->get(Application::APP_ID, $languageCode); + switch ($notification->getSubject()) { + case self::SUBJECT_TAG_MODE_ENABLED: + $notification->setParsedSubject($l->t('Context Chat indexing changed')); + $notification->setParsedMessage($l->t('Context Chat now indexes only documents selected with tags. Documents that do not match the tag rules are no longer used as context. Contact your administrator if you have questions.')); + return $notification; + + default: + throw new UnknownNotificationException(); + } + } +} diff --git a/lib/Service/FsEventService.php b/lib/Service/FsEventService.php index 58adb0f0..e6706b93 100644 --- a/lib/Service/FsEventService.php +++ b/lib/Service/FsEventService.php @@ -25,6 +25,7 @@ public function __construct( private ActionScheduler $actionService, private StorageService $storageService, private IRootFolder $rootFolder, + private TagEligibilityService $tagEligibility, ) { } @@ -64,16 +65,26 @@ public function onAccessUpdateDecl(Node $node, bool $recurse = true): void { } } - public function onDelete(Node $node, bool $recurse = true): void { + /** + * @param bool $onlyEligible only remove files that may be in the index under the current + * tag rules. Only safe where the tags of the node are still in place (before the node + * is deleted). Callers that clean up files that are no longer eligible must leave it off. + */ + public function onDelete(Node $node, bool $recurse = true, bool $onlyEligible = false): void { if ($node instanceof Folder) { if (!$recurse) { return; } - $fileIds = $this->storageService->getAllFilesInFolder($node); + $fileIds = $onlyEligible + ? $this->tagEligibility->eligibleFileIds($node) + : $this->storageService->getAllFilesInFolder($node); } else { if (!$this->allowedMimeType($node)) { return; } + if ($onlyEligible && !$this->tagEligibility->isEligible($node)) { + return; + } try { $fileIds = [$node->getId()]; } catch (InvalidPathException|NotFoundException $e) { @@ -103,11 +114,15 @@ public function onInsert(Node $node, bool $recurse = true, bool $update = false) if (!$recurse) { return; } - $fileIds = $this->storageService->getAllFilesInFolder($node); + // only the files inside that pass the allow/deny tag rules + $fileIds = $this->tagEligibility->eligibleFileIds($node); } else { if (!$this->allowedMimeType($node)) { return; } + if (!$this->tagEligibility->isEligible($node)) { + return; + } try { $fileIds = [$node->getId()]; } catch (InvalidPathException|NotFoundException $e) { @@ -132,6 +147,53 @@ public function onInsert(Node $node, bool $recurse = true, bool $update = false) } } + /** + * Kept under its old name so other callers keep working: is this node + * eligible for indexing under the current mode and allow/deny tag rules? + */ + public function hasAiKnowledgeTag(Node $node): bool { + return $this->tagEligibility->isEligible($node); + } + + /** + * Called after a listed (allow) tag was removed from a node, or a deny tag was + * added: removes from the index what is no longer eligible. + */ + public function onTagRemoved(Node $node): void { + if (!($node instanceof Folder)) { + if (!$this->tagEligibility->isEligible($node)) { + $this->deleteFileIds([$node->getId()]); + } + return; + } + + $keep = array_flip($this->tagEligibility->eligibleFileIds($node)); + $remove = []; + foreach ($this->storageService->getAllFilesInFolder($node) as $fileId) { + if (!isset($keep[$fileId])) { + $remove[] = $fileId; + } + } + $this->deleteFileIds($remove); + } + + /** + * @param int[] $fileIds + */ + private function deleteFileIds(array $fileIds): void { + $fileRefs = []; + foreach ($fileIds as $fileId) { + try { + $fileRefs[] = ProviderConfigService::getSourceId($fileId); + } catch (InvalidPathException|NotFoundException|Exception $e) { + $this->logger->warning($e->getMessage(), ['exception' => $e]); + } + } + foreach (array_chunk($fileRefs, ActionScheduler::BATCH_SIZE) as $batch) { + $this->actionService->deleteSources($batch); + } + } + private function allowedMimeType(Node $file): bool { $mimeType = $file->getMimeType(); return in_array($mimeType, Application::MIMETYPES, true); diff --git a/lib/Service/IndexCompletionService.php b/lib/Service/IndexCompletionService.php new file mode 100644 index 00000000..91dca7be --- /dev/null +++ b/lib/Service/IndexCompletionService.php @@ -0,0 +1,117 @@ +jobList->countByClass(), fn ($row) => $row['class'] == $jobClass)); + return count($countByClass) > 0 ? $countByClass[0]['count'] : 0; + } + + public function checkAndMarkComplete(): void { + if ($this->appConfig->getAppValueInt('last_indexed_time', 0, lazy: true) !== 0) { + return; + } + + try { + $crawlJobCount = $this->getJobCount(StorageCrawlJob::class) + $this->getJobCount(UntaggedCleanupCrawlJob::class); + if ($crawlJobCount > 0) { + $this->logger->debug('A crawl job (indexing or tag cleanup) is still scheduled for execution, intial indexing has not completed.'); + return; + } + } catch (\Exception $e) { + $this->logger->warning('Could not get count of scheduled crawl jobs', ['exception' => $e]); + return; + } + + try { + $pendingActionsCount = $this->queueActionMapper->count(); + if ($pendingActionsCount > 0) { + $this->logger->debug('Actions still pending (e.g. tag-based deletions), intial indexing has not completed.', ['count' => $pendingActionsCount]); + return; + } + } catch (\Exception $e) { + $this->logger->warning('Could not count pending queue actions', ['exception' => $e]); + return; + } + + try { + $lastEnqueuedDbId = $this->appConfig->getAppValueInt('last_enqueued_db_id', -1, lazy: true); + if ($lastEnqueuedDbId === -1) { + // Instances that completed their crawl before this value was introduced never got + // it set, and the migration only backfills it while the referenced file is still + // queued. Seed it from the queue instead of falling through to counting every file + // in the file cache on every single request. + $maxQueuedDbId = $this->queueMapper->getMaxId(); + if ($maxQueuedDbId === null) { + // no crawl jobs left and nothing queued, so everything has been indexed once + $this->logger->info('Initial index completion detected, setting last indexed time'); + $this->appConfig->setAppValueInt('last_indexed_time', $this->timeFactory->getTime(), lazy: true); + return; + } + $this->appConfig->setAppValueInt('last_enqueued_db_id', $maxQueuedDbId, lazy: true); + $lastEnqueuedDbId = $maxQueuedDbId; + } + + $initiallyQueuedFilesExist = $this->queueMapper->existsQueueItemsUpToDbId($lastEnqueuedDbId); + if ($initiallyQueuedFilesExist) { + $this->logger->debug('Initially queued files still in the queue, intial indexing has not completed.'); + return; + } + $this->logger->info('Initial index completion detected, setting last indexed time'); + $this->appConfig->setAppValueInt('last_indexed_time', $this->timeFactory->getTime(), lazy: true); + return; + } catch (\Exception $e) { + $this->logger->warning('Could not get last enqueued file\'s DB id', ['exception' => $e]); + } + + // last enqueued file's ID could not be retrieved, fall back to checking whether the queue is + // empty. With no crawl jobs left, nothing more will be queued for the initial index. + try { + if ($this->queueMapper->getMaxId() === null) { + $this->logger->info('Initial index completion detected, setting last indexed time'); + $this->appConfig->setAppValueInt('last_indexed_time', $this->timeFactory->getTime(), lazy: true); + } + } catch (\Exception $e) { + $this->logger->warning('Could not check whether the queue is empty', ['exception' => $e]); + } + } +} diff --git a/lib/Service/TagEligibilityService.php b/lib/Service/TagEligibilityService.php new file mode 100644 index 00000000..e5b385e2 --- /dev/null +++ b/lib/Service/TagEligibilityService.php @@ -0,0 +1,201 @@ +readIds('tag_allow_ids'); + } + + /** @return string[] */ + public function getDenyTagIds(): array { + return $this->readIds('tag_deny_ids'); + } + + public function usesTags(): bool { + $mode = $this->appConfig->getAppValueString('index_mode', 'all', lazy: true); + if ($mode !== 'tag_only') { + return false; + } + return $this->getAllowTagIds() !== [] || $this->getDenyTagIds() !== []; + } + + /** + * Is this single node (file or folder) eligible for indexing? + */ + public function isEligible(Node $node): bool { + if (!$this->usesTags()) { + return true; + } + try { + $tags = $this->tagsOnNodeAndAncestors($node); + } catch (\Throwable $e) { + return false; + } + return $this->decide( + $this->getAllowTagIds(), + $this->getDenyTagIds(), + $this->hasAny($tags, $this->getAllowTagIds()), + $this->hasAny($tags, $this->getDenyTagIds()), + ); + } + + /** + * Ids of all files inside $folder that are eligible for indexing. + * + * @return int[] + */ + public function eligibleFileIds(Folder $folder): array { + $fileIds = $this->storageService->getAllFilesInFolder($folder); + if (!$this->usesTags()) { + return $fileIds; + } + + $allow = $this->getAllowTagIds(); + $deny = $this->getDenyTagIds(); + + try { + $tagsAbove = $this->tagsOnNodeAndAncestors($folder); + } catch (\Throwable $e) { + return []; + } + $allowAbove = $allow === [] || $this->hasAny($tagsAbove, $allow); + $denyAbove = $deny !== [] && $this->hasAny($tagsAbove, $deny); + if ($denyAbove) { + return []; + } + + // null means "covered everywhere inside the folder" + $allowCovered = $allowAbove ? null : $this->filesCoveredByTags($folder, $allow); + $denyCovered = $deny === [] ? [] : $this->filesCoveredByTags($folder, $deny); + + $result = []; + foreach ($fileIds as $fileId) { + if (isset($denyCovered[$fileId])) { + continue; + } + if ($allowCovered !== null && !isset($allowCovered[$fileId])) { + continue; + } + $result[] = $fileId; + } + return $result; + } + + private function decide(array $allow, array $deny, bool $hasAllow, bool $hasDeny): bool { + $allowOk = $allow === [] || $hasAllow; + $denyOk = $deny === [] || !$hasDeny; + return $allowOk && $denyOk; + } + + /** + * Tag ids on the node itself and on every parent folder, with one DB call. + * + * @return string[] + */ + private function tagsOnNodeAndAncestors(Node $node): array { + $ids = []; + $current = $node; + $depth = 0; + while ($current !== null && $depth < self::MAX_DEPTH) { + $ids[] = (string)$current->getId(); + if ($current->getPath() === '/' || $current->getInternalPath() === '') { + break; + } + try { + $current = $current->getParent(); + } catch (\Throwable $e) { + break; + } + $depth++; + } + + $tags = []; + foreach ($this->tagMapper->getTagIdsForObjects($ids, 'files') as $tagIds) { + foreach ($tagIds as $tagId) { + $tags[(string)$tagId] = true; + } + } + return array_keys($tags); + } + + /** + * Files inside $folder covered by any of the given tags (tagged file itself, + * or file inside a tagged sub folder). + * + * @param string[] $tagIds + * @return array + */ + private function filesCoveredByTags(Folder $folder, array $tagIds): array { + $covered = []; + foreach ($tagIds as $tagId) { + foreach ($this->tagMapper->getObjectIdsForTags([$tagId], 'files') as $objectId) { + $node = $folder->getFirstNodeById((int)$objectId); + if ($node === null) { + continue; + } + if ($node instanceof Folder) { + foreach ($this->storageService->getAllFilesInFolder($node) as $fileId) { + $covered[$fileId] = true; + } + } else { + $covered[$node->getId()] = true; + } + } + } + return $covered; + } + + /** + * @param string[] $tags + * @param string[] $wanted + */ + private function hasAny(array $tags, array $wanted): bool { + return array_intersect($wanted, $tags) !== []; + } + + /** @return string[] */ + private function readIds(string $key): array { + $raw = $this->appConfig->getAppValueString($key, '[]', lazy: true); + $decoded = json_decode($raw, true); + if (!is_array($decoded)) { + return []; + } + return array_values(array_unique(array_map('strval', $decoded))); + } +} diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index 018725ec..919d1ce9 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -8,14 +8,20 @@ namespace OCA\ContextChat\Settings; use OCA\ContextChat\Service\StatisticsService; +use OCA\ContextChat\Service\TagEligibilityService; use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Services\IInitialState; use OCP\Settings\ISettings; +use OCP\SystemTag\ISystemTagManager; class AdminSettings implements ISettings { public function __construct( private IInitialState $initialState, private StatisticsService $statisticsService, + private IAppConfig $appConfig, + private ISystemTagManager $tagManager, + private TagEligibilityService $tagEligibility, ) { } @@ -25,9 +31,28 @@ public function __construct( public function getForm(): TemplateResponse { $stats = $this->statisticsService->getStatistics(); $this->initialState->provideInitialState('stats', $stats); + $indexMode = $this->appConfig->getAppValueString('index_mode', 'all', lazy: true); + $this->initialState->provideInitialState('index_mode', $indexMode); + $this->initialState->provideInitialState('tag_allow_ids', array_map('intval', $this->tagEligibility->getAllowTagIds())); + $this->initialState->provideInitialState('tag_deny_ids', array_map('intval', $this->tagEligibility->getDenyTagIds())); + $this->initialState->provideInitialState('system_tags', $this->getSystemTags()); return new TemplateResponse('context_chat', 'admin'); } + /** + * All system tags, sorted by name, for the allow and deny tag selectors. + * + * @return list + */ + private function getSystemTags(): array { + $tags = []; + foreach ($this->tagManager->getAllTags() as $tag) { + $tags[] = ['id' => (int)$tag->getId(), 'label' => $tag->getName()]; + } + usort($tags, static fn (array $a, array $b): int => strcasecmp($a['label'], $b['label'])); + return $tags; + } + /** * @return string the section ID, e.g. 'sharing' */ diff --git a/package-lock.json b/package-lock.json index 1a24a118..a296fe0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,8 @@ "version": "1.0.0", "license": "AGPL-3.0-or-later", "dependencies": { + "@nextcloud/axios": "^2.6.0", + "@nextcloud/dialogs": "^8.0.0", "@nextcloud/initial-state": "^2.2.0", "@nextcloud/router": "^3.2.0", "@nextcloud/vue": "^9.14.1", @@ -1691,7 +1693,6 @@ "resolved": "https://registry.npmjs.org/@buttercup/fetch/-/fetch-0.2.1.tgz", "integrity": "sha512-sCgECOx8wiqY8NN1xN22BqqKzXYIG2AicNLlakOAI4f0WgyLVUbAigMf8CZhBtJxdudTcB1gD5lciqi44jwJvg==", "license": "MIT", - "optional": true, "optionalDependencies": { "node-fetch": "^3.3.0" } @@ -1931,6 +1932,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1947,6 +1949,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1963,6 +1966,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1979,6 +1983,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1995,6 +2000,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2011,6 +2017,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2027,6 +2034,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2043,6 +2051,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2059,6 +2068,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2075,6 +2085,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2091,6 +2102,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2107,6 +2119,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2123,6 +2136,7 @@ "cpu": [ "mips64el" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2139,6 +2153,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2155,6 +2170,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2171,6 +2187,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2187,6 +2204,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2203,6 +2221,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2219,6 +2238,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2235,6 +2255,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2251,6 +2272,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2267,6 +2289,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2283,6 +2306,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2299,6 +2323,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2315,6 +2340,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2331,6 +2357,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2602,6 +2629,12 @@ "license": "MIT", "peer": true }, + "node_modules/@mdi/js": { + "version": "7.4.47", + "resolved": "https://registry.npmjs.org/@mdi/js/-/js-7.4.47.tgz", + "integrity": "sha512-KPnNOtm5i2pMabqZxpUz7iQf+mfrYZyKCZ8QNz85czgEt7cuHcGorWfdzUMWYA0SD+a6Hn4FmJ+YhzzzjkTZrQ==", + "license": "Apache-2.0" + }, "node_modules/@microsoft/api-extractor": { "version": "7.60.1", "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.60.1.tgz", @@ -2841,6 +2874,43 @@ "node": "^20.0.0 || ^22.0.0 || ^24.0.0" } }, + "node_modules/@nextcloud/dialogs": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-8.0.0.tgz", + "integrity": "sha512-8uN59XKOMk7MVCh0Nxdd8hvZmZQxlVIRv8s1GrhC5+Ub0hD6yJ/8XyruF54lrkmGmBqh048/i/ZER93vwfRpDg==", + "license": "AGPL-3.0-or-later", + "dependencies": { + "@mdi/js": "^7.4.47", + "@nextcloud/auth": "^2.6.0", + "@nextcloud/axios": "^2.6.0", + "@nextcloud/browser-storage": "^0.5.0", + "@nextcloud/capabilities": "^1.2.1", + "@nextcloud/event-bus": "^3.3.3", + "@nextcloud/files": "^4.0.0", + "@nextcloud/initial-state": "^3.0.0", + "@nextcloud/l10n": "^3.4.1", + "@nextcloud/paths": "^3.1.0", + "@nextcloud/router": "^3.2.0", + "@nextcloud/sharing": "^0.4.0", + "@nextcloud/vue": "^9.13.1", + "@vueuse/core": "^15.0.0", + "p-queue": "^10.0.0", + "vue": "^3.5.44", + "webdav": "^5.11.0" + }, + "engines": { + "node": "^22.18 || ^24 || >=26" + } + }, + "node_modules/@nextcloud/dialogs/node_modules/@nextcloud/initial-state": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@nextcloud/initial-state/-/initial-state-3.0.0.tgz", + "integrity": "sha512-cV+HBdkQJGm8FxkBI5rFT/FbMNWNBvpbj6OPrg4Ae4YOOsQ15CL8InPOAw1t4XkOkQK2NEdUGQLVUz/19wXbdQ==", + "license": "GPL-3.0-or-later", + "engines": { + "node": "^20.0.0 || ^22.0.0 || ^24.0.0" + } + }, "node_modules/@nextcloud/eslint-config": { "version": "8.4.2", "resolved": "https://registry.npmjs.org/@nextcloud/eslint-config/-/eslint-config-8.4.2.tgz", @@ -2933,7 +3003,6 @@ "resolved": "https://registry.npmjs.org/@nextcloud/files/-/files-4.1.1.tgz", "integrity": "sha512-3fvaBNObXFjVgFm0FvPXr+rtYh2CUGAc0+98dhIP0AC7Q+UCVYIwyB3tsSBGP29HnqGWqGRY7nZaj7gI7NzbvQ==", "license": "AGPL-3.0-or-later", - "optional": true, "dependencies": { "@nextcloud/auth": "^2.6.0", "@nextcloud/axios": "^2.6.0", @@ -2958,7 +3027,6 @@ "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.5.tgz", "integrity": "sha512-Lki/zhXFVmDhesBUn/yHRLW9Bte7mE7xoFHzTR8sIomV7a2z+LxYAPkGvdfidNiu4fKSfjtawixxSHcZci5QcQ==", "license": "MIT", - "optional": true, "dependencies": { "eventemitter3": "^5.0.4", "p-timeout": "^7.0.0" @@ -3013,7 +3081,6 @@ "resolved": "https://registry.npmjs.org/@nextcloud/paths/-/paths-3.1.0.tgz", "integrity": "sha512-vtFYA/kthaUDzu6KejTOL1OwnOy7/yynq5zdB/UBpYacAWjUX5Ddh4OMWx3rEavkBJ9/QGhrFryNJLjNfe8OQA==", "license": "GPL-3.0-or-later", - "optional": true, "engines": { "node": "^20.0.0 || ^22.0.0 || ^24.0.0" } @@ -3223,8 +3290,7 @@ "url": "https://github.com/sponsors/nodable" } ], - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -3282,6 +3348,7 @@ "version": "2.6.0", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.6.0.tgz", "integrity": "sha512-7FNeNl8NCE7aINx7WXiKQrPYZWC/hvrTsmk6zmxbI7LTXE7hVek/n8AfVgpe2y82zl3w0HvCHN0bVKMBoJcC0w==", + "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -3321,6 +3388,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3342,6 +3410,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3363,6 +3432,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3384,6 +3454,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3405,9 +3476,7 @@ "cpu": [ "arm" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3429,9 +3498,7 @@ "cpu": [ "arm" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3453,9 +3520,7 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3477,9 +3542,7 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3501,9 +3564,7 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3525,9 +3586,7 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3549,6 +3608,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3570,6 +3630,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3665,6 +3726,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3679,6 +3741,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3693,6 +3756,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3707,6 +3771,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3721,6 +3786,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3735,6 +3801,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3749,6 +3816,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3763,9 +3831,7 @@ "cpu": [ "arm" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3780,9 +3846,7 @@ "cpu": [ "arm" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3797,9 +3861,7 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3814,9 +3876,7 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3831,9 +3891,7 @@ "cpu": [ "loong64" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3848,9 +3906,7 @@ "cpu": [ "loong64" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3865,9 +3921,7 @@ "cpu": [ "ppc64" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3882,9 +3936,7 @@ "cpu": [ "ppc64" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3899,9 +3951,7 @@ "cpu": [ "riscv64" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3916,9 +3966,7 @@ "cpu": [ "riscv64" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3933,9 +3981,7 @@ "cpu": [ "s390x" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3950,9 +3996,7 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3967,9 +4011,7 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3984,6 +4026,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -3998,6 +4041,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4012,6 +4056,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4026,6 +4071,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4040,6 +4086,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4054,6 +4101,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4738,9 +4786,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -4756,9 +4801,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -4774,9 +4816,6 @@ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -4792,9 +4831,6 @@ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -4810,9 +4846,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -4828,9 +4861,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -4846,9 +4876,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -4864,9 +4891,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -4882,9 +4906,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -4900,9 +4921,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -5490,8 +5508,7 @@ "url": "https://github.com/sponsors/NaturalIntelligence" } ], - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/are-docs-informative": { "version": "0.0.2", @@ -5860,7 +5877,6 @@ "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-4.5.0.tgz", "integrity": "sha512-aR99oXhpEDGo0UuAlYcn2iGRds30k366Zfa05XWScR9QaQD4JYiP3/1Qt1u7YlefUOK+cn0CcwoL1oefavQUlQ==", "license": "Apache-2.0", - "optional": true, "dependencies": { "is-retry-allowed": "^2.2.0" }, @@ -5927,15 +5943,13 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "devOptional": true, "license": "MIT" }, "node_modules/base-64": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/base64-js": { "version": "1.5.1", @@ -6005,7 +6019,6 @@ "version": "2.1.7", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", - "devOptional": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" @@ -6310,8 +6323,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/byte-length/-/byte-length-1.0.2.tgz", "integrity": "sha512-ovBpjmsgd/teRmgcPh23d4gJvxDoXtAzEL9xTfMU8Yc2kqCDb7L9jAG0XHl1nzuGl+h3ebCIF1i62UFyA9V/2Q==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/cacheable": { "version": "2.5.0", @@ -6493,7 +6505,6 @@ "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", "license": "BSD-3-Clause", - "optional": true, "engines": { "node": "*" } @@ -6790,7 +6801,6 @@ "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", "license": "BSD-3-Clause", - "optional": true, "engines": { "node": "*" } @@ -6859,7 +6869,6 @@ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", "license": "MIT", - "optional": true, "engines": { "node": ">= 12" } @@ -7057,6 +7066,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, "license": "Apache-2.0", "optional": true, "peer": true, @@ -8318,8 +8328,7 @@ "version": "5.0.4", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/events": { "version": "3.3.0", @@ -8437,7 +8446,6 @@ } ], "license": "MIT", - "optional": true, "dependencies": { "path-expression-matcher": "^1.6.2", "xml-naming": "^0.3.0" @@ -8517,7 +8525,6 @@ } ], "license": "MIT", - "optional": true, "dependencies": { "node-domexception": "^1.0.0", "web-streams-polyfill": "^3.0.3" @@ -8679,7 +8686,6 @@ "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", "license": "MIT", - "optional": true, "dependencies": { "fetch-blob": "^3.1.2" }, @@ -8714,6 +8720,7 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -9320,8 +9327,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/hot-patcher/-/hot-patcher-2.0.1.tgz", "integrity": "sha512-ECg1JFG0YzehicQaogenlcs2qg6WsXQsxtnbr1i696u5tLUjtJdQAh0u2g0Q5YV45f263Ta1GnUJsc8WIfJf4Q==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/html-tags": { "version": "5.1.0", @@ -9423,7 +9429,7 @@ "version": "5.1.10", "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.10.tgz", "integrity": "sha512-Uu72qZXUtm+n98uML3Xr6pVFHl4xnmeCuAsrm0VqFlQim/Ib6NrPSJLpx6CrZ/G6DnoGaCUgtx8gY+o+ovxnCw==", - "devOptional": true, + "dev": true, "license": "MIT", "peer": true }, @@ -9668,8 +9674,7 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/is-builtin-module": { "version": "3.2.1", @@ -9810,7 +9815,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "devOptional": true, + "dev": true, "license": "MIT", "peer": true, "engines": { @@ -9869,7 +9874,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "devOptional": true, + "dev": true, "license": "MIT", "peer": true, "dependencies": { @@ -10021,7 +10026,6 @@ "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz", "integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==", "license": "MIT", - "optional": true, "engines": { "node": ">=10" }, @@ -10138,8 +10142,7 @@ "url": "https://github.com/sponsors/NaturalIntelligence" } ], - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/is-weakmap": { "version": "2.0.2", @@ -10379,8 +10382,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/layerr/-/layerr-3.0.0.tgz", "integrity": "sha512-tv754Ki2dXpPVApOrjTyRo4/QegVb9eVFq4mjqp4+NM5NaX7syQvN5BBNfV/ZpAHCEHV24XdUVrBAoka4jt3pA==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/levn": { "version": "0.4.1", @@ -10559,7 +10561,6 @@ "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", "license": "BSD-3-Clause", - "optional": true, "dependencies": { "charenc": "0.0.2", "crypt": "0.0.2", @@ -11373,7 +11374,6 @@ "version": "9.0.9", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", - "devOptional": true, "license": "ISC", "dependencies": { "brace-expansion": "^2.0.2" @@ -11495,13 +11495,13 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/nested-property/-/nested-property-4.0.0.tgz", "integrity": "sha512-yFehXNWRs4cM0+dz7QxCd06hTbWbSkV0ISsqBfkntU6TOY4Qm3Q88fRRLOddkGh2Qq6dZvnKVAahfhjcUvLnyA==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/node-addon-api": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "dev": true, "license": "MIT", "optional": true, "peer": true @@ -11522,7 +11522,6 @@ } ], "license": "MIT", - "optional": true, "engines": { "node": ">=10.5.0" } @@ -11552,7 +11551,6 @@ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", "license": "MIT", - "optional": true, "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", @@ -11893,7 +11891,6 @@ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.2.tgz", "integrity": "sha512-prbX4Z3YszrFNgH+MW5Zoeq3baXrMtP/MQnFeET90UB/GtGcGDQ5Usg9OCy6ETjTTntOw1SL2z9fMPUppN3Guw==", "license": "MIT", - "optional": true, "engines": { "node": ">=20" }, @@ -12025,7 +12022,6 @@ } ], "license": "MIT", - "optional": true, "engines": { "node": ">=14.0.0" } @@ -12063,8 +12059,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/path-posix/-/path-posix-1.0.0.tgz", "integrity": "sha512-1gJ0WpNIiYcQydgg3Ed8KzvIqTsDpNwq+cjBCssvBtuTWjEqY1AW+i+OepiEMqDCzyro9B2sLAe4RBPajMYFiA==", - "license": "ISC", - "optional": true + "license": "ISC" }, "node_modules/path-type": { "version": "4.0.0", @@ -12444,8 +12439,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/queue-microtask": { "version": "1.2.3", @@ -12761,8 +12755,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/resolve": { "version": "1.22.14", @@ -13171,7 +13164,7 @@ "version": "1.108.1", "resolved": "https://registry.npmjs.org/sass/-/sass-1.108.1.tgz", "integrity": "sha512-sIYgSvOPeD9wABwDS/ofNjHASSck+7h3jLkk7wG1NPFL3XeS6vOQjBlAFSmRV09kZr1yt/Tuayt6kKtBbLjHNQ==", - "devOptional": true, + "dev": true, "license": "MIT", "peer": true, "dependencies": { @@ -14694,8 +14687,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/typescript-event-target/-/typescript-event-target-1.1.2.tgz", "integrity": "sha512-TvkrTUpv7gCPlcnSoEwUVUBwsdheKm+HF5u2tPAKubkIGMfovdSizCTaZRY/NhR8+Ijy8iZZUapbVQAsNrkFrw==", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/ufo": { "version": "1.6.4", @@ -15068,7 +15060,6 @@ "resolved": "https://registry.npmjs.org/url-join/-/url-join-5.2.0.tgz", "integrity": "sha512-/tMVQdp/2eE90fGb6npbd2nLHH8jamzLLeZhLEKTz4Rc38wO5AeEuIhoWroWWfQJS50ZzL4Xod9JER/pJWTTEQ==", "license": "MIT", - "optional": true, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } @@ -15078,7 +15069,6 @@ "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "license": "MIT", - "optional": true, "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -15372,6 +15362,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15389,6 +15380,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15406,6 +15398,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15423,6 +15416,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15440,6 +15434,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15457,6 +15452,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15474,6 +15470,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15491,6 +15488,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15508,6 +15506,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15525,6 +15524,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15542,6 +15542,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15559,6 +15560,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15576,6 +15578,7 @@ "cpu": [ "mips64el" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15593,6 +15596,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15610,6 +15614,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15627,6 +15632,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15644,6 +15650,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15661,6 +15668,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15678,6 +15686,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15695,6 +15704,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15712,6 +15722,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15729,6 +15740,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15746,6 +15758,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15763,6 +15776,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15780,6 +15794,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -15797,6 +15812,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -16065,7 +16081,6 @@ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", "license": "MIT", - "optional": true, "engines": { "node": ">= 8" } @@ -16075,7 +16090,6 @@ "resolved": "https://registry.npmjs.org/webdav/-/webdav-5.11.0.tgz", "integrity": "sha512-DbUS8rHvWse55EiHM0q5q1z3eVRCLWW7Va7mUqA2/JJdQHIew4Op2HTglHkBJDOAVrQeQf0I+REUJkIrYqtL+w==", "license": "MIT", - "optional": true, "dependencies": { "@buttercup/fetch": "^0.2.1", "@nodable/entities": "^3.0.0", @@ -16102,7 +16116,6 @@ "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", "license": "BSD-2-Clause", - "optional": true, "engines": { "node": ">=0.12" }, @@ -16121,7 +16134,6 @@ } ], "license": "MIT", - "optional": true, "dependencies": { "@nodable/entities": "^3.1.0", "fast-xml-builder": "^1.3.1", @@ -16145,7 +16157,6 @@ } ], "license": "MIT", - "optional": true, "dependencies": { "anynum": "^1.0.1" } @@ -16320,7 +16331,6 @@ } ], "license": "MIT", - "optional": true, "engines": { "node": ">=16.0.0" } diff --git a/package.json b/package.json index 5e134c13..f11f3154 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,8 @@ }, "type": "module", "dependencies": { + "@nextcloud/axios": "^2.6.0", + "@nextcloud/dialogs": "^8.0.0", "@nextcloud/initial-state": "^2.2.0", "@nextcloud/router": "^3.2.0", "@nextcloud/vue": "^9.14.1", diff --git a/src/components/ViewAdmin.vue b/src/components/ViewAdmin.vue index c9e4ec95..311b3233 100644 --- a/src/components/ViewAdmin.vue +++ b/src/components/ViewAdmin.vue @@ -66,6 +66,58 @@ SPDX-License-Identifier: AGPL-3.0-or-later

{{ t('context_chat', 'Queued content update actions: {count}', {count: stats.queued_actions_count}) }}

{{ t('context_chat', 'Locked queue content update actions: {count}', {count: stats.queued_actions_locked_count}) }}

{{ t('context_chat', 'Queued file system events: {count}', {count: stats.queued_fs_events_count}) }}

+ +

{{ t('context_chat', 'Indexing mode') }}

+ + {{ t('context_chat', 'Index all documents') }} + + + {{ t('context_chat', 'Index considering tags (allow and deny lists)') }} + + + {{ t('context_chat', "When 'Index considering tags' is selected, only documents that pass the tag rules below are indexed, and any previously indexed documents that do not are removed from the index. A tag on a folder applies to everything inside it, and a deny tag always wins over an allow tag.") }} + + +

{{ t('context_chat', 'Tags') }}

+ + {{ t('context_chat', "The selected tags are ignored while 'Index all documents' is selected.") }} + + +

{{ t('context_chat', 'How the tags are applied:') }}

+
    +
  • {{ t('context_chat', 'Only allow tags selected: only documents that have at least one of them are indexed.') }}
  • +
  • {{ t('context_chat', 'Only deny tags selected: all documents are indexed, except those that have at least one of them.') }}
  • +
  • {{ t('context_chat', 'Both selected: documents that have an allow tag are indexed, except those that also have a deny tag.') }}
  • +
+
+ +

 

+ +

{{ t('context_chat', 'Download Logs') }}

@@ -85,27 +137,52 @@ SPDX-License-Identifier: AGPL-3.0-or-later @@ -172,4 +290,10 @@ figure[class^='icon-'] { display: flex; gap: 10px; } + +.tag-rules { + list-style: disc; + margin: 4px 0 0; + padding-inline-start: 20px; +}