Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions lib/private/OCM/Model/OCMProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
class OCMProvider implements IOCMProvider {
private bool $enabled = false;
private bool $removePublicKey = false;
private bool $removeVersion = false;
private string $apiVersion = '';
private string $inviteAcceptDialog = '';
private array $capabilities = [];
Expand Down Expand Up @@ -326,6 +328,22 @@ private function looksValid(): bool {
return ($this->getApiVersion() !== '' && $this->getEndPoint() !== '');
}

/**
* @since 35.0.0
*/
#[\Override]
public function removePublicKey(): void {
$this->removePublicKey = true;
}

/**
* @since 35.0.0
*/
#[\Override]
public function removeVersion(): void {
$this->removeVersion = true;
}

/**
* @since 28.0.0
*/
Expand All @@ -346,6 +364,15 @@ public function jsonSerialize(): array {
'resourceTypes' => $resourceTypes
];

if ($this->removeVersion) {
$response['apiVersion'] = $this->getApiVersion();
unset($response['version']);
}

if ($this->removePublicKey) {
unset($response['publicKey']);
}

if ($this->capabilities !== []) {
$response['capabilities'] = $this->capabilities;
}
Expand Down
30 changes: 30 additions & 0 deletions lib/public/OCM/Events/LocalOCMDiscoveryEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,34 @@ public function registerResourceType(string $name, array $shareTypes, array $pro
->setProtocols($protocols);
$this->provider->addResourceType($resourceType);
}

/**
* Remove the non-standard publicKey field from OCM discovery
*
* @since 35.0.0
*/
public function removePublicKey(): void {
$this->provider->removePublicKey();
}

/**
* Remove the non-standard version field from OCM discovery
*
* @since 35.0.0
*/
public function removeVersion(): void {
$this->provider->removeVersion();
}

/**
* Set the apiVersion
*
* @param string $version
*
* @since 35.0.0
*/
public function setApiVersion(string $version): void {
$this->provider->setApiVersion($version);
}

}
18 changes: 16 additions & 2 deletions lib/public/OCM/IOCMProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ public function setApiVersion(string $apiVersion): static;
*/
public function getApiVersion(): string;

/**
* Remove the non-standard publicKey field from OCM discovery
*
* @since 35.0.0
*/
public function removePublicKey(): void;

/**
* Remove the non-standard version field from OCM discovery
*
* @since 35.0.0
*/
public function removeVersion(): void;

/**
* configure endpoint
*
Expand Down Expand Up @@ -219,7 +233,7 @@ public function import(array $data): static;
/**
* @return array{
* enabled: bool,
* apiVersion: '1.0-proposal1',
* apiVersion: string,
* endPoint: string,
* publicKey?: array{
* keyId: string,
Expand All @@ -230,7 +244,7 @@ public function import(array $data): static;
* shareTypes: list<string>,
* protocols: array<string, string>
* }>,
* version: string
* version?: string
* }
* @since 28.0.0
*/
Expand Down
Loading