migrate therinaldos.com data
Build & Deploy to DigitalOcean Space / build (push) Failing after 2m38s

This commit is contained in:
2024-05-05 15:50:45 -04:00
commit ef1ff240d4
23182 changed files with 3801898 additions and 0 deletions
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Julien Veyssier <eneiluj@posteo.net>
*
* @author Julien Veyssier <eneiluj@posteo.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Collaboration\Reference;
use JsonSerializable;
/**
* @since 26.0.0
*/
abstract class ADiscoverableReferenceProvider implements IDiscoverableReferenceProvider, JsonSerializable {
/**
* @since 26.0.0
*/
public function jsonSerialize(): array {
$json = [
'id' => $this->getId(),
'title' => $this->getTitle(),
'icon_url' => $this->getIconUrl(),
'order' => $this->getOrder(),
];
if ($this instanceof ISearchableReferenceProvider) {
$json['search_providers_ids'] = $this->getSupportedSearchProviderIds();
}
return $json;
}
}
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Julien Veyssier <eneiluj@posteo.net>
*
* @author Julien Veyssier <eneiluj@posteo.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Collaboration\Reference;
/**
* @since 26.0.0
*/
interface IDiscoverableReferenceProvider extends IReferenceProvider {
/**
* @return string Unique id that identifies the reference provider
* @since 26.0.0
*/
public function getId(): string;
/**
* @return string User facing title of the widget
* @since 26.0.0
*/
public function getTitle(): string;
/**
* @return int Initial order for reference provider sorting
* @since 26.0.0
*/
public function getOrder(): int;
/**
* @return string url to an icon that can be displayed next to the reference provider title
* @since 26.0.0
*/
public function getIconUrl(): string;
/**
* @return array representation of the provider
* @since 26.0.0
*/
public function jsonSerialize(): array;
}
@@ -0,0 +1,136 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Collaboration\Reference;
use JsonSerializable;
/**
* @since 25.0.0
*/
interface IReference extends JsonSerializable {
/**
* @since 25.0.0
*/
public function getId(): string;
/**
* Accessible flag indicates if the user has access to the provided reference
*
* @since 25.0.0
*/
public function setAccessible(bool $accessible): void;
/**
* Accessible flag indicates if the user has access to the provided reference
*
* @since 25.0.0
*/
public function getAccessible(): bool;
/**
* @since 25.0.0
*/
public function setTitle(string $title): void;
/**
* @since 25.0.0
*/
public function getTitle(): string;
/**
* @since 25.0.0
*/
public function setDescription(?string $description): void;
/**
* @since 25.0.0
*/
public function getDescription(): ?string;
/**
* @since 25.0.0
*/
public function setImageUrl(?string $imageUrl): void;
/**
* @since 25.0.0
*/
public function getImageUrl(): ?string;
/**
* @since 25.0.0
*/
public function setImageContentType(?string $contentType): void;
/**
* @since 25.0.0
*/
public function getImageContentType(): ?string;
/**
* @since 25.0.0
*/
public function setUrl(?string $url): void;
/**
* @since 25.0.0
*/
public function getUrl(): string;
/**
* Set the reference specific rich object representation
*
* @since 25.0.0
*/
public function setRichObject(string $type, ?array $richObject): void;
/**
* Returns the type of the reference specific rich object
*
* @since 25.0.0
*/
public function getRichObjectType(): string;
/**
* Returns the reference specific rich object representation
*
* @since 25.0.0
*/
public function getRichObject(): array;
/**
* Returns the opengraph rich object representation
*
* @since 25.0.0
*/
public function getOpenGraphObject(): array;
/**
* @return array{richObjectType: string, richObject: array<string, mixed>, openGraphObject: array{id: string, name: string, description: ?string, thumb: ?string, link: string}, accessible: bool}
*
* @since 25.0.0
*/
public function jsonSerialize(): array;
}
@@ -0,0 +1,98 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Collaboration\Reference;
/**
* @since 25.0.0
*/
interface IReferenceManager {
/**
* Return all reference identifiers within a string as an array
*
* @return string[] Array of found references (urls)
* @since 25.0.0
*/
public function extractReferences(string $text): array;
/**
* Resolve a given reference id to its metadata with all available providers
*
* This method has a fallback to always provide the open graph metadata,
* but may still return null in case this is disabled or the fetching fails
*
* @since 25.0.0
*/
public function resolveReference(string $referenceId): ?IReference;
/**
* Get a reference by its cache key
*
* @since 25.0.0
*/
public function getReferenceByCacheKey(string $cacheKey): ?IReference;
/**
* Explicitly get a reference from the cache to avoid heavy fetches for cases
* the cache can then be filled with a separate request from the frontend
*
* @since 25.0.0
*/
public function getReferenceFromCache(string $referenceId): ?IReference;
/**
* Invalidate all cache entries with a prefix or just one if the cache key is provided
*
* @since 25.0.0
*/
public function invalidateCache(string $cachePrefix, ?string $cacheKey = null): void;
/**
* Get information on discoverable reference providers (id, title, icon and order)
* If the provider is searchable, also get the list of supported unified search providers
*
* @return IDiscoverableReferenceProvider[]
* @since 26.0.0
*/
public function getDiscoverableProviders(): array;
/**
* Update or set the last used timestamp for a provider
*
* @param string $userId
* @param string $providerId
* @param int|null $timestamp use current timestamp if null
* @return bool
* @since 26.0.0
*/
public function touchProvider(string $userId, string $providerId, ?int $timestamp = null): bool;
/**
* Get all known last used timestamps for reference providers
*
* @return int[]
* @since 26.0.0
*/
public function getUserProviderTimestamps(): array;
}
@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Collaboration\Reference;
/**
* @since 25.0.0
*/
interface IReferenceProvider {
/**
* Validate that a given reference identifier matches the current provider
*
* @since 25.0.0
*/
public function matchReference(string $referenceText): bool;
/**
* Return a reference with its metadata for a given reference identifier
*
* @since 25.0.0
*/
public function resolveReference(string $referenceText): ?IReference;
/**
* Return true if the reference metadata can be globally cached
*
* @since 25.0.0
*/
public function getCachePrefix(string $referenceId): string;
/**
* Return a custom cache key to be used for caching the metadata
* This could be for example the current user id if the reference
* access permissions are different for each user
*
* Should return null, if the cache is only related to the
* reference id and has no further dependency
*
* @since 25.0.0
*/
public function getCacheKey(string $referenceId): ?string;
}
@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Julien Veyssier <eneiluj@posteo.net>
*
* @author Julien Veyssier <eneiluj@posteo.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Collaboration\Reference;
/**
* @since 26.0.0
*/
interface ISearchableReferenceProvider extends IDiscoverableReferenceProvider {
/**
* @return string[] list of search provider IDs that can be used by the vue-richtext picker
* @since 26.0.0
*/
public function getSupportedSearchProviderIds(): array;
}
@@ -0,0 +1,253 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Collaboration\Reference;
/**
* @since 25.0.0
* @psalm-type OpenGraphObject = array{id: string, name: string, description: ?string, thumb: ?string, link: string}
*/
class Reference implements IReference {
protected string $reference;
protected bool $accessible = true;
protected ?string $title = null;
protected ?string $description = null;
protected ?string $imageUrl = null;
protected ?string $contentType = null;
protected ?string $url = null;
protected ?string $richObjectType = null;
protected ?array $richObject = null;
/**
* @since 25.0.0
*/
public function __construct(string $reference) {
$this->reference = $reference;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function getId(): string {
return $this->reference;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function setAccessible(bool $accessible): void {
$this->accessible = $accessible;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function getAccessible(): bool {
return $this->accessible;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function setTitle(string $title): void {
$this->title = $title;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function getTitle(): string {
return $this->title ?? $this->reference;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function setDescription(?string $description): void {
$this->description = $description;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function getDescription(): ?string {
return $this->description;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function setImageUrl(?string $imageUrl): void {
$this->imageUrl = $imageUrl;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function getImageUrl(): ?string {
return $this->imageUrl;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function setImageContentType(?string $contentType): void {
$this->contentType = $contentType;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function getImageContentType(): ?string {
return $this->contentType;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function setUrl(?string $url): void {
$this->url = $url;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function getUrl(): string {
return $this->url ?? $this->reference;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function setRichObject(string $type, ?array $richObject): void {
$this->richObjectType = $type;
$this->richObject = $richObject;
}
/**
* @inheritdoc
* @since 25.0.0
*/
public function getRichObjectType(): string {
if ($this->richObjectType === null) {
return 'open-graph';
}
return $this->richObjectType;
}
/**
* @inheritdoc
* @since 25.0.0
* @return array<string, mixed>
*/
public function getRichObject(): array {
if ($this->richObject === null) {
return $this->getOpenGraphObject();
}
return $this->richObject;
}
/**
* @inheritdoc
* @since 25.0.0
* @return OpenGraphObject
*/
public function getOpenGraphObject(): array {
return [
'id' => $this->getId(),
'name' => $this->getTitle(),
'description' => $this->getDescription(),
'thumb' => $this->getImageUrl(),
'link' => $this->getUrl()
];
}
/**
* @param IReference $reference
* @return array
* @since 25.0.0
*/
public static function toCache(IReference $reference): array {
return [
'id' => $reference->getId(),
'title' => $reference->getTitle(),
'imageUrl' => $reference->getImageUrl(),
'imageContentType' => $reference->getImageContentType(),
'description' => $reference->getDescription(),
'link' => $reference->getUrl(),
'accessible' => $reference->getAccessible(),
'richObjectType' => $reference->getRichObjectType(),
'richObject' => $reference->getRichObject(),
];
}
/**
* @param array $cache
* @return IReference
* @since 25.0.0
*/
public static function fromCache(array $cache): IReference {
$reference = new Reference($cache['id']);
$reference->setTitle($cache['title']);
$reference->setDescription($cache['description']);
$reference->setImageUrl($cache['imageUrl']);
$reference->setImageContentType($cache['imageContentType']);
$reference->setUrl($cache['link']);
$reference->setRichObject($cache['richObjectType'], $cache['richObject']);
$reference->setAccessible($cache['accessible']);
return $reference;
}
/**
* @inheritdoc
* @since 25.0.0
* @return array{richObjectType: string, richObject: array<string, mixed>, openGraphObject: OpenGraphObject, accessible: bool}
*/
public function jsonSerialize(): array {
return [
'richObjectType' => $this->getRichObjectType(),
'richObject' => $this->getRichObject(),
'openGraphObject' => $this->getOpenGraphObject(),
'accessible' => $this->accessible
];
}
}
@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Collaboration\Reference;
use OCP\EventDispatcher\Event;
/**
* Event that apps can emit on their page rendering to trigger loading of aditional
* scripts for reference widget rendering
*
* @since 25.0.0
*/
class RenderReferenceEvent extends Event {
}