-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow for avatar downloads from social networks
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
- Loading branch information
1 parent
b8f4a67
commit a9232db
Showing
36 changed files
with
1,413 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @author John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @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/>. | ||
* | ||
*/ | ||
|
||
use OCA\Contacts\AppInfo\Application; | ||
|
||
$app = \OC::$server->query(Application::class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# social network icons: | ||
* “facebook (fab)” by fontawesome.com is licensed under CC BY 4.0. (https://fontawesome.com/icons/facebook?style=brands) | ||
* “instagram (fab)” by fontawesome.com is licensed under CC BY 4.0. (https://fontawesome.com/icons/instagram?style=brands) | ||
* “mastodon (fab)” by fontawesome.com is licensed under CC BY 4.0. (https://fontawesome.com/icons/mastodon?style=brands) | ||
* “tumblr (fab)” by fontawesome.com is licensed under CC BY 4.0. (https://fontawesome.com/icons/tumblr?style=brands) | ||
* “twitter (fab)” by fontawesome.com is licensed under CC BY 4.0. (https://fontawesome.com/icons/twitter?style=brands) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @author John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @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 OCA\Contacts\AppInfo; | ||
|
||
use OCP\AppFramework\App; | ||
|
||
class Application extends App { | ||
public const APP_ID = 'contacts'; | ||
|
||
public function __construct() { | ||
parent::__construct(self::APP_ID); | ||
} | ||
|
||
public const AVAIL_SETTINGS = [ | ||
'allowSocialSync' => 'yes', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2020 Matthias Heinisch <nextcloud@matthiasheinisch.de> | ||
* | ||
* @author Matthias Heinisch <nextcloud@matthiasheinisch.de> | ||
* | ||
* @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 OCA\Contacts\Controller; | ||
|
||
use OCA\Contacts\AppInfo\Application; | ||
use OCA\Contacts\Service\SocialApiService; | ||
use OCP\AppFramework\ApiController; | ||
use OCP\AppFramework\Http; | ||
use OCP\AppFramework\Http\JSONResponse; | ||
use OCP\IConfig; | ||
use OCP\IRequest; | ||
|
||
class SocialApiController extends ApiController { | ||
|
||
/** @var IConfig */ | ||
private $config; | ||
|
||
/** @var SocialApiService */ | ||
private $socialApiService; | ||
|
||
public function __construct(IRequest $request, | ||
IConfig $config, | ||
SocialApiService $socialApiService) { | ||
parent::__construct(Application::APP_ID, $request); | ||
|
||
$this->config = $config; | ||
$this->socialApiService = $socialApiService; | ||
} | ||
|
||
|
||
/** | ||
* update appconfig (admin setting) | ||
* | ||
* @param {String} key the identifier to change | ||
* @param {String} allow the value to set | ||
* | ||
* @returns {JSONResponse} an empty JSONResponse with respective http status code | ||
*/ | ||
public function setAppConfig($key, $allow) { | ||
$permittedKeys = ['allowSocialSync']; | ||
if (!in_array($key, $permittedKeys)) { | ||
return new JSONResponse([], Http::STATUS_FORBIDDEN); | ||
} | ||
$this->config->setAppValue(Application::APP_ID, $key, $allow); | ||
return new JSONResponse([], Http::STATUS_OK); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
* | ||
* returns an array of supported social networks | ||
* | ||
* @returns {array} array of the supported social networks | ||
*/ | ||
public function getSupportedNetworks() : array { | ||
return $this->socialApiService->getSupportedNetworks(); | ||
} | ||
|
||
|
||
/** | ||
* @NoAdminRequired | ||
* | ||
* Retrieves social profile data for a contact and updates the entry | ||
* | ||
* @param {String} addressbookId the addressbook identifier | ||
* @param {String} contactId the contact identifier | ||
* @param {String} network the social network to use (if unkown: take first match) | ||
* | ||
* @returns {JSONResponse} an empty JSONResponse with respective http status code | ||
*/ | ||
public function updateContact(string $addressbookId, string $contactId, string $network) : JSONResponse { | ||
return $this->socialApiService->updateContact($addressbookId, $contactId, $network); | ||
} | ||
} |
Oops, something went wrong.