Skip to content
Merged
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
11 changes: 9 additions & 2 deletions lib/Search/SubredditSearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\Search\IProvider;
use OCP\Search\IExternalProvider;
use OCP\Search\ISearchQuery;
use OCP\Search\SearchResult;
use OCP\Search\SearchResultEntry;
use OCP\Security\ICrypto;

class SubredditSearchProvider implements IProvider {
class SubredditSearchProvider implements IExternalProvider {

public function __construct(
private IAppManager $appManager,
Expand All @@ -47,6 +47,13 @@ public function getName(): string {
return $this->l10n->t('Subreddits');
}

/**
* @inheritDoc
*/
public function isExternalProvider(): bool {
return true;
}

/**
* @inheritDoc
*/
Expand Down
11,888 changes: 6,332 additions & 5,556 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,23 @@
"dependencies": {
"@nextcloud/auth": "^2.4.0",
"@nextcloud/axios": "^2.4.0",
"@nextcloud/dialogs": "^5.1.2",
"@nextcloud/initial-state": "^2.1.0",
"@nextcloud/l10n": "^2.2.0",
"@nextcloud/dialogs": "^7.2.0",
"@nextcloud/initial-state": "^3.0.0",
"@nextcloud/l10n": "^3.4.1",
"@nextcloud/moment": "^1.3.1",
"@nextcloud/password-confirmation": "^6.0.2",
"@nextcloud/router": "^3.0.0",
"@nextcloud/vue": "^8.27.0",
"@nextcloud/vue-dashboard": "^2.0.1",
"vue": "^2.7.16",
"vue-material-design-icons": "^5.3.0",
"@nextcloud/password-confirmation": "^5.1.1"
"@nextcloud/vue": "^9.3.1",
"vue": "^3.5.26",
"vue-material-design-icons": "^5.3.0"
},
"devDependencies": {
"@nextcloud/babel-config": "^1.0.0",
"@nextcloud/browserslist-config": "^3.0.0",
"@nextcloud/eslint-config": "^8.3.0",
"@nextcloud/stylelint-config": "^2.3.1",
"@nextcloud/webpack-vue-config": "^6.0.1",
"eslint-webpack-plugin": "^4.0.1",
"stylelint-webpack-plugin": "^4.1.1"
"@nextcloud/stylelint-config": "^3.1.1",
"@nextcloud/webpack-vue-config": "^7.0.2",
"eslint-webpack-plugin": "^5.0.2",
"stylelint-webpack-plugin": "^5.0.1"
}
}
15 changes: 4 additions & 11 deletions src/adminSettings.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
/* jshint esversion: 6 */

/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import Vue from 'vue'
import './bootstrap.js'
import { createApp } from 'vue'
import AdminSettings from './components/AdminSettings.vue'

// eslint-disable-next-line
'use strict'
const app = createApp(AdminSettings)

// eslint-disable-next-line
new Vue({
el: '#reddit_prefs',
render: h => h(AdminSettings),
})
app.mixin({ methods: { t, n } })
app.mount('#reddit_prefs')
12 changes: 0 additions & 12 deletions src/bootstrap.js

This file was deleted.

140 changes: 60 additions & 80 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,64 @@
<RedditIcon class="icon" />
{{ t('integration_reddit', 'Reddit integration') }}
</h2>
<p class="settings-hint">
{{ t('integration_reddit', 'There are 3 ways to allow your Nextcloud users to use OAuth to authenticate to Reddit:') }}
</p>
<p class="settings-hint">
1. {{ t('integration_reddit', 'Leave all fields empty to use default Nextcloud Reddit OAuth app.') }}
</p>
<p class="settings-hint">
2. {{ t('integration_reddit', 'Create your own Reddit "web application" in Reddit preferences and put the application ID and secret below.') }}
</p>
<a href="https://www.reddit.com/prefs/apps" target="_blank" class="external">{{ t('integration_reddit', 'Reddit app settings') }}</a>
<br><br>
<p class="settings-hint">
<InformationOutlineIcon :size="20" class="icon" />
{{ t('integration_reddit', 'Make sure you set the "Redirection URI" to') }}
</p>
<strong>{{ redirect_uri }}</strong>
<br><br>
<p class="settings-hint">
3. {{ t('integration_reddit', 'Create your own Reddit "mobile application" in Reddit preferences and put the application ID below. Leave the "Application secret" field empty.') }}
</p>
<a href="https://www.reddit.com/prefs/apps" target="_blank" class="external">{{ t('integration_reddit', 'Reddit app settings') }}</a>
<br><br>
<p class="settings-hint">
<InformationOutlineIcon :size="20" class="icon" />
{{ t('integration_reddit', 'Make sure you set the "Redirection URI" to') }}
</p>
<strong>{{ redirect_uri_protocol }}</strong>
<br><br>
<div id="reddit-content">
<div class="line">
<label for="reddit-client-id">
<KeyIcon :size="20" class="icon" />
{{ t('integration_reddit', 'Application ID') }}
</label>
<input id="reddit-client-id"
v-model="state.client_id"
type="password"
:readonly="readonly"
:placeholder="t('integration_reddit', 'Client ID of your Reddit application')"
@input="onInput"
@focus="readonly = false">
</div>
<div class="line">
<label for="reddit-client-secret">
<KeyIcon :size="20" class="icon" />
{{ t('integration_reddit', 'Application secret') }}
</label>
<input id="reddit-client-secret"
v-model="state.client_secret"
type="password"
:readonly="readonly"
:placeholder="t('integration_reddit', 'Client secret of your Reddit application')"
@input="onInput"
@focus="readonly = false">
</div>
<NcNoteCard type="info">
{{ t('integration_reddit', 'There are 3 ways to allow your Nextcloud users to use OAuth to authenticate to Reddit:') }}
<br><br>
1. {{ t('integration_reddit', 'Leave all fields empty to use default Nextcloud Reddit OAuth app.') }}
<br><br>
2. {{ t('integration_reddit', 'Create your own Reddit "web application" in Reddit preferences and put the application ID and secret below.') }}
<a href="https://www.reddit.com/prefs/apps" target="_blank" class="external">{{ t('integration_reddit', 'Reddit app settings') }}</a>
<br>
{{ t('integration_reddit', 'Make sure you set the "Redirection URI" to') }}
<strong>{{ redirect_uri }}</strong>
<br><br>
3. {{ t('integration_reddit', 'Create your own Reddit "mobile application" in Reddit preferences and put the application ID below. Leave the "Application secret" field empty.') }}
<a href="https://www.reddit.com/prefs/apps" target="_blank" class="external">{{ t('integration_reddit', 'Reddit app settings') }}</a>
<br>
{{ t('integration_reddit', 'Make sure you set the "Redirection URI" to') }}
<strong>{{ redirect_uri_protocol }}</strong>
</NcNoteCard>
<NcTextField
v-model="state.client_id"
type="password"
:label="t('integration_reddit', 'Application ID')"
:placeholder="t('integration_reddit', 'Client ID of your Reddit application')"
:readonly="readonly"
:show-trailing-button="!!state.client_id"
@trailing-button-click="state.client_id = ''; onInput()"
@focus="readonly = false"
@update:model-value="onInput">
<template #icon>
<KeyOutlineIcon :size="20" />
</template>
</NcTextField>
<NcTextField
v-model="state.client_secret"
type="password"
:label="t('integration_reddit', 'Application secret')"
:placeholder="t('integration_reddit', 'Client secret of your Reddit application')"
:readonly="readonly"
:show-trailing-button="!!state.client_secret"
@trailing-button-click="state.client_secret = ''; onInput()"
@focus="readonly = false"
@update:model-value="onInput">
<template #icon>
<KeyOutlineIcon :size="20" />
</template>
</NcTextField>
</div>
</div>
</template>

<script>
import InformationOutlineIcon from 'vue-material-design-icons/InformationOutline.vue'
import KeyIcon from 'vue-material-design-icons/Key.vue'
import KeyOutlineIcon from 'vue-material-design-icons/KeyOutline.vue'

import RedditIcon from './icons/RedditIcon.vue'

import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
import NcTextField from '@nextcloud/vue/components/NcTextField'

import { loadState } from '@nextcloud/initial-state'
import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
Expand All @@ -86,8 +79,9 @@ export default {

components: {
RedditIcon,
KeyIcon,
InformationOutlineIcon,
KeyOutlineIcon,
NcNoteCard,
NcTextField,
},

props: [],
Expand Down Expand Up @@ -137,7 +131,7 @@ export default {
.catch((error) => {
showError(
t('integration_reddit', 'Failed to save Reddit admin options')
+ ': ' + error.response?.request?.responseText
+ ': ' + error.response?.request?.responseText,
)
console.debug(error)
})
Expand All @@ -152,31 +146,17 @@ export default {
#reddit_prefs {
#reddit-content{
margin-left: 40px;
max-width: 800px;
display: flex;
flex-direction: column;
gap: 4px;
}

h2,
.line,
.settings-hint {
h2 {
display: flex;
align-items: center;
.icon {
margin-right: 4px;
}
}

h2 .icon {
margin-right: 8px;
}

.line {
> label {
width: 300px;
display: flex;
align-items: center;
}
> input {
width: 300px;
}
justify-content: start;
gap: 8px;
}
}
</style>
Loading