diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-08-03 12:54:37 +0200 |
---|---|---|
committer | npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com> | 2020-08-03 11:26:03 +0000 |
commit | 1a1b3e20e470a945dd9f5fab1d99174b10cbb141 (patch) | |
tree | aacff8872bcfd47685e9a9fb3e5e3a423e498f59 /core/src/services | |
parent | 4987fe9a51f0b889d2b99428c967014d95bb13ae (diff) | |
download | nextcloud-server-1a1b3e20e470a945dd9f5fab1d99174b10cbb141.tar.gz nextcloud-server-1a1b3e20e470a945dd9f5fab1d99174b10cbb141.zip |
Fix unified search
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'core/src/services')
-rw-r--r-- | core/src/services/UnifiedSearchService.js | 52 | ||||
-rw-r--r-- | core/src/services/WebAuthnAuthenticationService.js | 37 |
2 files changed, 89 insertions, 0 deletions
diff --git a/core/src/services/UnifiedSearchService.js b/core/src/services/UnifiedSearchService.js new file mode 100644 index 00000000000..2e63f19767d --- /dev/null +++ b/core/src/services/UnifiedSearchService.js @@ -0,0 +1,52 @@ +/** + * @copyright 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/>. + */ + +import { generateUrl } from '@nextcloud/router' +import { loadState } from '@nextcloud/initial-state' +import axios from '@nextcloud/axios' + +export const defaultLimit = loadState('unified-search', 'limit-default') + +/** + * Get the list of available search providers + */ +export async function getTypes() { + try { + const { data } = await axios.get(generateUrl('/search/providers')) + if (Array.isArray(data) && data.length > 0) { + return data + } + } catch (error) { + console.error(error) + } + return [] +} + +/** + * Get the list of available search providers + * + * @param {string} type the type to search + * @param {string} query the search + * @returns {Promise} + */ +export function search(type, query) { + return axios.get(generateUrl(`/search/providers/${type}/search?term=${query}`)) +} diff --git a/core/src/services/WebAuthnAuthenticationService.js b/core/src/services/WebAuthnAuthenticationService.js new file mode 100644 index 00000000000..91f19177066 --- /dev/null +++ b/core/src/services/WebAuthnAuthenticationService.js @@ -0,0 +1,37 @@ +/** + * @copyright 2020, Roeland Jago Douma <roeland@famdouma.nl> + * + * @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/>. + */ + +import Axios from '@nextcloud/axios' +import { generateUrl } from '@nextcloud/router' + +export function startAuthentication(loginName) { + const url = generateUrl('/login/webauthn/start') + + return Axios.post(url, { loginName }) + .then(resp => resp.data) +} + +export function finishAuthentication(data) { + const url = generateUrl('/login/webauthn/finish') + + return Axios.post(url, { data }) + .then(resp => resp.data) +} |