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,58 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\OCS;
use OCP\Capabilities\ICapability;
use OCP\IConfig;
use OCP\IURLGenerator;
/**
* Class Capabilities
*
* @package OC\OCS
*/
class CoreCapabilities implements ICapability {
/** @var IConfig */
private $config;
/**
* @param IConfig $config
*/
public function __construct(IConfig $config) {
$this->config = $config;
}
/**
* Return this classes capabilities
*/
public function getCapabilities() {
return [
'core' => [
'pollinterval' => $this->config->getSystemValue('pollinterval', 60),
'webdav-root' => $this->config->getSystemValue('webdav-root', 'remote.php/webdav'),
'reference-api' => true,
'reference-regex' => IURLGenerator::URL_REGEX_NO_MODIFIERS,
],
];
}
}
@@ -0,0 +1,133 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
*
* @author Bjoern Schiessle <bjoern@schiessle.org>
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Roeland Jago Douma <roeland@famdouma.nl>
*
* @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 OC\OCS;
use OCP\AppFramework\Http;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\OCS\IDiscoveryService;
class DiscoveryService implements IDiscoveryService {
/** @var ICache */
private $cache;
/** @var IClient */
private $client;
/**
* @param ICacheFactory $cacheFactory
* @param IClientService $clientService
*/
public function __construct(ICacheFactory $cacheFactory,
IClientService $clientService
) {
$this->cache = $cacheFactory->createDistributed('ocs-discovery');
$this->client = $clientService->newClient();
}
/**
* Discover OCS end-points
*
* If no valid discovery data is found the defaults are returned
*
* @param string $remote
* @param string $service the service you want to discover
* @param bool $skipCache We won't check if the data is in the cache. This is useful if a background job is updating the status
* @return array
*/
public function discover(string $remote, string $service, bool $skipCache = false): array {
// Check the cache first
if ($skipCache === false) {
$cacheData = $this->cache->get($remote . '#' . $service);
if ($cacheData) {
$data = json_decode($cacheData, true);
if (\is_array($data)) {
return $data;
}
}
}
$discoveredServices = [];
// query the remote server for available services
try {
$response = $this->client->get($remote . '/ocs-provider/', [
'timeout' => 10,
'connect_timeout' => 10,
]);
if ($response->getStatusCode() === Http::STATUS_OK) {
$decodedServices = json_decode($response->getBody(), true);
if (\is_array($decodedServices)) {
$discoveredServices = $this->getEndpoints($decodedServices, $service);
}
}
} catch (\Exception $e) {
// if we couldn't discover the service or any end-points we return a empty array
}
// Write into cache
$this->cache->set($remote . '#' . $service, json_encode($discoveredServices), 60 * 60 * 24);
return $discoveredServices;
}
/**
* get requested end-points from the requested service
*
* @param array $decodedServices
* @param string $service
* @return array
*/
protected function getEndpoints(array $decodedServices, string $service): array {
$discoveredServices = [];
if (isset($decodedServices['services'][$service]['endpoints'])) {
foreach ($decodedServices['services'][$service]['endpoints'] as $endpoint => $url) {
if ($this->isSafeUrl($url)) {
$discoveredServices[$endpoint] = $url;
}
}
}
return $discoveredServices;
}
/**
* Returns whether the specified URL includes only safe characters, if not
* returns false
*
* @param string $url
* @return bool
*/
protected function isSafeUrl(string $url): bool {
return (bool)preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url);
}
}
@@ -0,0 +1,37 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\OCS;
class Exception extends \Exception {
/** @var Result */
private $result;
public function __construct(Result $result) {
parent::__construct();
$this->result = $result;
}
public function getResult() {
return $this->result;
}
}
+116
View File
@@ -0,0 +1,116 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Bjoern Schiessle <bjoern@schiessle.org>
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Joas Schilling <coding@schilljs.com>
* @author Lukas Reschke <lukas@statuscode.ch>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\OCS;
class Provider extends \OCP\AppFramework\Controller {
/** @var \OCP\App\IAppManager */
private $appManager;
/**
* @param string $appName
* @param \OCP\IRequest $request
* @param \OCP\App\IAppManager $appManager
*/
public function __construct($appName,
\OCP\IRequest $request,
\OCP\App\IAppManager $appManager) {
parent::__construct($appName, $request);
$this->appManager = $appManager;
}
/**
* @return \OCP\AppFramework\Http\JSONResponse
*/
public function buildProviderList() {
$services = [
'PRIVATE_DATA' => [
'version' => 1,
'endpoints' => [
'store' => '/ocs/v2.php/privatedata/setattribute',
'read' => '/ocs/v2.php/privatedata/getattribute',
'delete' => '/ocs/v2.php/privatedata/deleteattribute',
],
],
];
if ($this->appManager->isEnabledForUser('files_sharing')) {
$services['SHARING'] = [
'version' => 1,
'endpoints' => [
'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
],
];
$services['FEDERATED_SHARING'] = [
'version' => 1,
'endpoints' => [
'share' => '/ocs/v2.php/cloud/shares',
'webdav' => '/public.php/webdav/',
],
];
}
if ($this->appManager->isEnabledForUser('federation')) {
if (isset($services['FEDERATED_SHARING'])) {
$services['FEDERATED_SHARING']['endpoints']['shared-secret'] = '/ocs/v2.php/cloud/shared-secret';
$services['FEDERATED_SHARING']['endpoints']['system-address-book'] = '/remote.php/dav/addressbooks/system/system/system';
$services['FEDERATED_SHARING']['endpoints']['carddav-user'] = 'system';
} else {
$services['FEDERATED_SHARING'] = [
'version' => 1,
'endpoints' => [
'shared-secret' => '/ocs/v2.php/cloud/shared-secret',
'system-address-book' => '/remote.php/dav/addressbooks/system/system/system',
'carddav-user' => 'system'
],
];
}
}
if ($this->appManager->isEnabledForUser('activity')) {
$services['ACTIVITY'] = [
'version' => 1,
'endpoints' => [
'list' => '/ocs/v2.php/cloud/activity',
],
];
}
if ($this->appManager->isEnabledForUser('provisioning_api')) {
$services['PROVISIONING'] = [
'version' => 1,
'endpoints' => [
'user' => '/ocs/v2.php/cloud/users',
'groups' => '/ocs/v2.php/cloud/groups',
'apps' => '/ocs/v2.php/cloud/apps',
],
];
}
return new \OCP\AppFramework\Http\JSONResponse([
'version' => 2,
'services' => $services,
]);
}
}
+157
View File
@@ -0,0 +1,157 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Bart Visscher <bartv@thisnet.nl>
* @author Björn Schießle <bjoern@schiessle.org>
* @author Christopher Schäpers <kondou@ts.unde.re>
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Lukas Reschke <lukas@statuscode.ch>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin McCorkell <robin@mccorkell.me.uk>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Tom Needham <tom@owncloud.com>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\OCS;
class Result {
/** @var array */
protected $data;
/** @var null|string */
protected $message;
/** @var int */
protected $statusCode;
/** @var integer */
protected $items;
/** @var integer */
protected $perPage;
/** @var array */
private $headers = [];
/**
* create the OCS_Result object
* @param mixed $data the data to return
* @param int $code
* @param null|string $message
* @param array $headers
*/
public function __construct($data = null, $code = 100, $message = null, $headers = []) {
if ($data === null) {
$this->data = [];
} elseif (!is_array($data)) {
$this->data = [$this->data];
} else {
$this->data = $data;
}
$this->statusCode = $code;
$this->message = $message;
$this->headers = $headers;
}
/**
* optionally set the total number of items available
* @param int $items
*/
public function setTotalItems($items) {
$this->items = $items;
}
/**
* optionally set the the number of items per page
* @param int $items
*/
public function setItemsPerPage($items) {
$this->perPage = $items;
}
/**
* get the status code
* @return int
*/
public function getStatusCode() {
return $this->statusCode;
}
/**
* get the meta data for the result
* @return array
*/
public function getMeta() {
$meta = [];
$meta['status'] = $this->succeeded() ? 'ok' : 'failure';
$meta['statuscode'] = $this->statusCode;
$meta['message'] = $this->message;
if ($this->items !== null) {
$meta['totalitems'] = $this->items;
}
if ($this->perPage !== null) {
$meta['itemsperpage'] = $this->perPage;
}
return $meta;
}
/**
* get the result data
* @return array
*/
public function getData() {
return $this->data;
}
/**
* return bool Whether the method succeeded
* @return bool
*/
public function succeeded() {
return ($this->statusCode == 100);
}
/**
* Adds a new header to the response
* @param string $name The name of the HTTP header
* @param string $value The value, null will delete it
* @return $this
*/
public function addHeader($name, $value) {
$name = trim($name); // always remove leading and trailing whitespace
// to be able to reliably check for security
// headers
if (is_null($value)) {
unset($this->headers[$name]);
} else {
$this->headers[$name] = $value;
}
return $this;
}
/**
* Returns the set headers
* @return array the headers
*/
public function getHeaders() {
return $this->headers;
}
}