parent
68b21d706c
commit
b43bf42efc
|
@ -46,7 +46,7 @@ logging.config.dictConfig(
|
||||||
},
|
},
|
||||||
"loggers": {
|
"loggers": {
|
||||||
"funkwhale_api": {
|
"funkwhale_api": {
|
||||||
"level": logging.getLevelName("LOGLEVEL"),
|
"level": LOGLEVEL,
|
||||||
"handlers": ["console"],
|
"handlers": ["console"],
|
||||||
# required to avoid double logging with root logger
|
# required to avoid double logging with root logger
|
||||||
"propagate": False,
|
"propagate": False,
|
||||||
|
|
|
@ -237,20 +237,10 @@ class ManageUploadFilterSet(filters.FilterSet):
|
||||||
|
|
||||||
class ManageDomainFilterSet(filters.FilterSet):
|
class ManageDomainFilterSet(filters.FilterSet):
|
||||||
q = fields.SearchFilter(search_fields=["name"])
|
q = fields.SearchFilter(search_fields=["name"])
|
||||||
allowed = filters.BooleanFilter()
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = federation_models.Domain
|
model = federation_models.Domain
|
||||||
fields = ["name", "allowed"]
|
fields = ["name"]
|
||||||
|
|
||||||
def filter_allowed(self, qs, value):
|
|
||||||
"""
|
|
||||||
If value=false, we want to include object with value=null as well
|
|
||||||
"""
|
|
||||||
if value:
|
|
||||||
return qs.filter(allowed=True)
|
|
||||||
else:
|
|
||||||
return qs.filter(allowed__in=[False, None])
|
|
||||||
|
|
||||||
|
|
||||||
class ManageActorFilterSet(filters.FilterSet):
|
class ManageActorFilterSet(filters.FilterSet):
|
||||||
|
|
|
@ -19,8 +19,8 @@ class AllowListPublic(types.BooleanPreference):
|
||||||
name = "allow_list_public"
|
name = "allow_list_public"
|
||||||
verbose_name = "Publish your allowed-domains list"
|
verbose_name = "Publish your allowed-domains list"
|
||||||
help_text = (
|
help_text = (
|
||||||
"If enabled, everyone will be able to retrieve the list of domains you allowed. "
|
"If enabled, everyone will be able to retrieve the list of domains you allowed. ",
|
||||||
"This is useful on open setups, to help people decide if they want to join your pod, or to "
|
"This is useful on open setups, to help people decide if they want to join your pod, or to "
|
||||||
"make your moderation policy public."
|
"make your moderation policy public.",
|
||||||
)
|
)
|
||||||
default = False
|
default = False
|
||||||
|
|
|
@ -6,14 +6,6 @@
|
||||||
<label><translate translate-context="Content/Search/Input.Label/Noun">Search</translate></label>
|
<label><translate translate-context="Content/Search/Input.Label/Noun">Search</translate></label>
|
||||||
<input name="search" type="text" v-model="search" :placeholder="labels.searchPlaceholder" />
|
<input name="search" type="text" v-model="search" :placeholder="labels.searchPlaceholder" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
|
||||||
<label><translate translate-context="Content/Moderation/*/Adjective">Is present on allow-list</translate></label>
|
|
||||||
<select class="ui dropdown" v-model="allowed">
|
|
||||||
<option :value="null"><translate translate-context="*/*/*">All</translate></option>
|
|
||||||
<option :value="true"><translate translate-context="*/*/*">Yes</translate></option>
|
|
||||||
<option :value="false"><translate translate-context="*/*/*">No</translate></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label><translate translate-context="Content/Search/Dropdown.Label/Noun">Ordering</translate></label>
|
<label><translate translate-context="Content/Search/Dropdown.Label/Noun">Ordering</translate></label>
|
||||||
<select class="ui dropdown" v-model="ordering">
|
<select class="ui dropdown" v-model="ordering">
|
||||||
|
@ -101,8 +93,7 @@ import TranslationsMixin from '@/components/mixins/Translations'
|
||||||
export default {
|
export default {
|
||||||
mixins: [OrderingMixin, TranslationsMixin],
|
mixins: [OrderingMixin, TranslationsMixin],
|
||||||
props: {
|
props: {
|
||||||
filters: {type: Object, required: false},
|
filters: {type: Object, required: false}
|
||||||
allowListEnabled: {type: Boolean, default: false},
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Pagination,
|
Pagination,
|
||||||
|
@ -117,7 +108,6 @@ export default {
|
||||||
page: 1,
|
page: 1,
|
||||||
paginateBy: 50,
|
paginateBy: 50,
|
||||||
search: '',
|
search: '',
|
||||||
allowed: null,
|
|
||||||
orderingDirection: defaultOrdering.direction || '+',
|
orderingDirection: defaultOrdering.direction || '+',
|
||||||
ordering: defaultOrdering.field,
|
ordering: defaultOrdering.field,
|
||||||
orderingOptions: [
|
orderingOptions: [
|
||||||
|
@ -134,16 +124,12 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchData () {
|
fetchData () {
|
||||||
let baseFilters = {
|
let params = _.merge({
|
||||||
'page': this.page,
|
'page': this.page,
|
||||||
'page_size': this.paginateBy,
|
'page_size': this.paginateBy,
|
||||||
'q': this.search,
|
'q': this.search,
|
||||||
'ordering': this.getOrderingAsString(),
|
'ordering': this.getOrderingAsString()
|
||||||
}
|
}, this.filters)
|
||||||
if (this.allowed !== null) {
|
|
||||||
baseFilters.allowed = this.allowed
|
|
||||||
}
|
|
||||||
let params = _.merge(baseFilters, this.filters)
|
|
||||||
let self = this
|
let self = this
|
||||||
self.isLoading = true
|
self.isLoading = true
|
||||||
self.checked = []
|
self.checked = []
|
||||||
|
@ -193,9 +179,6 @@ export default {
|
||||||
page () {
|
page () {
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
allowed () {
|
|
||||||
this.fetchData()
|
|
||||||
},
|
|
||||||
ordering () {
|
ordering () {
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
|
|
@ -82,7 +82,6 @@ export default {
|
||||||
let musicLabel = this.$pgettext('*/*/*/Noun', 'Music')
|
let musicLabel = this.$pgettext('*/*/*/Noun', 'Music')
|
||||||
let playlistsLabel = this.$pgettext('*/*/*', 'Playlists')
|
let playlistsLabel = this.$pgettext('*/*/*', 'Playlists')
|
||||||
let federationLabel = this.$pgettext('Content/Admin/Menu', 'Federation')
|
let federationLabel = this.$pgettext('Content/Admin/Menu', 'Federation')
|
||||||
let moderationLabel = this.$pgettext('Content/Admin/Menu', 'Moderation')
|
|
||||||
let subsonicLabel = this.$pgettext('Content/Admin/Menu', 'Subsonic')
|
let subsonicLabel = this.$pgettext('Content/Admin/Menu', 'Subsonic')
|
||||||
let statisticsLabel = this.$pgettext('Content/Admin/Menu', 'Statistics')
|
let statisticsLabel = this.$pgettext('Content/Admin/Menu', 'Statistics')
|
||||||
let errorLabel = this.$pgettext('Content/Admin/Menu', 'Error reporting')
|
let errorLabel = this.$pgettext('Content/Admin/Menu', 'Error reporting')
|
||||||
|
@ -119,14 +118,6 @@ export default {
|
||||||
id: "playlists",
|
id: "playlists",
|
||||||
settings: ["playlists__max_tracks"]
|
settings: ["playlists__max_tracks"]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: moderationLabel,
|
|
||||||
id: "moderation",
|
|
||||||
settings: [
|
|
||||||
"moderation__allow_list_enabled",
|
|
||||||
"moderation__allow_list_public",
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: federationLabel,
|
label: federationLabel,
|
||||||
id: "federation",
|
id: "federation",
|
||||||
|
|
|
@ -9,31 +9,12 @@
|
||||||
:to="{name: 'manage.moderation.accounts.list'}"><translate translate-context="*/Moderation/Title">Accounts</translate></router-link>
|
:to="{name: 'manage.moderation.accounts.list'}"><translate translate-context="*/Moderation/Title">Accounts</translate></router-link>
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
<router-view :allow-list-enabled="allowListEnabled" :key="$route.fullPath"></router-view>
|
<router-view :key="$route.fullPath"></router-view>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import _ from '@/lodash'
|
|
||||||
import axios from 'axios'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
allowListEnabled: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
this.fetchNodeInfo()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchNodeInfo () {
|
|
||||||
let self = this
|
|
||||||
axios.get('instance/nodeinfo/2.0/').then(response => {
|
|
||||||
self.allowListEnabled = _.get(response.data, 'metadata.allowList.enabled', false)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
labels() {
|
labels() {
|
||||||
return {
|
return {
|
||||||
|
@ -41,6 +22,6 @@ export default {
|
||||||
secondaryMenu: this.$pgettext('Menu/*/Hidden text', "Secondary menu")
|
secondaryMenu: this.$pgettext('Menu/*/Hidden text', "Secondary menu")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -20,34 +20,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="header-buttons">
|
|
||||||
<div class="ui icon buttons">
|
|
||||||
<a
|
|
||||||
v-if="$store.state.auth.profile.is_superuser"
|
|
||||||
class="ui labeled icon button"
|
|
||||||
:href="$store.getters['instance/absoluteUrl'](`/api/admin/federation/domain/${object.name}`)"
|
|
||||||
target="_blank" rel="noopener noreferrer">
|
|
||||||
<i class="wrench icon"></i>
|
|
||||||
<translate translate-context="Content/Moderation/Link/Verb">View in Django's admin</translate>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div v-if="allowListEnabled" class="ui icon buttons">
|
|
||||||
<button
|
|
||||||
v-if="object.allowed"
|
|
||||||
@click.prevent="setAllowList(false)"
|
|
||||||
:class="['ui', 'labeled', {loading: isLoadingAllowList}, 'icon', 'button']">
|
|
||||||
<i class="x icon"></i>
|
|
||||||
<translate translate-context="Content/Moderation/Link/Verb">Remove from allow-list</translate>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
v-else
|
|
||||||
@click.prevent="setAllowList(true)"
|
|
||||||
:class="['ui', 'labeled', {loading: isLoadingAllowList}, 'icon', 'button']">
|
|
||||||
<i class="check icon"></i>
|
|
||||||
<translate translate-context="Content/Moderation/Link/Verb">Add to allow-list</translate>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui column">
|
<div class="ui column">
|
||||||
|
@ -102,15 +74,6 @@
|
||||||
</h3>
|
</h3>
|
||||||
<table class="ui very basic table">
|
<table class="ui very basic table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-if="allowListEnabled">
|
|
||||||
<td>
|
|
||||||
<translate translate-context="Content/Moderation/*/Adjective">Is present on allow-list</translate>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<translate v-if="object.allowed" translate-context="*/*/*">Yes</translate>
|
|
||||||
<translate v-else translate-context="*/*/*">No</translate>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<translate translate-context="Content/*/Table.Label">Last checked</translate>
|
<translate translate-context="Content/*/Table.Label">Last checked</translate>
|
||||||
|
@ -337,7 +300,7 @@ import InstancePolicyForm from "@/components/manage/moderation/InstancePolicyFor
|
||||||
import InstancePolicyCard from "@/components/manage/moderation/InstancePolicyCard"
|
import InstancePolicyCard from "@/components/manage/moderation/InstancePolicyCard"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ["id", "allowListEnabled"],
|
props: ["id"],
|
||||||
components: {
|
components: {
|
||||||
InstancePolicyForm,
|
InstancePolicyForm,
|
||||||
InstancePolicyCard,
|
InstancePolicyCard,
|
||||||
|
@ -348,7 +311,6 @@ export default {
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
isLoadingStats: false,
|
isLoadingStats: false,
|
||||||
isLoadingPolicy: false,
|
isLoadingPolicy: false,
|
||||||
isLoadingAllowList: false,
|
|
||||||
policy: null,
|
policy: null,
|
||||||
object: null,
|
object: null,
|
||||||
stats: null,
|
stats: null,
|
||||||
|
@ -391,15 +353,6 @@ export default {
|
||||||
self.isLoadingPolicy = false
|
self.isLoadingPolicy = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setAllowList(value) {
|
|
||||||
var self = this
|
|
||||||
this.isLoadingAllowList = true
|
|
||||||
let url = `manage/federation/domains/${this.id}/`
|
|
||||||
axios.patch(url, {allowed: value}).then(response => {
|
|
||||||
self.object = response.data
|
|
||||||
self.isLoadingAllowList = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
refreshNodeInfo (data) {
|
refreshNodeInfo (data) {
|
||||||
this.object.nodeinfo = data
|
this.object.nodeinfo = data
|
||||||
this.object.nodeinfo_fetch_date = new Date()
|
this.object.nodeinfo_fetch_date = new Date()
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
<label for="domain"><translate translate-context="Content/Moderation/Form.Label/Verb">Add a domain</translate></label>
|
<label for="domain"><translate translate-context="Content/Moderation/Form.Label/Verb">Add a domain</translate></label>
|
||||||
<input type="text" name="domain" id="domain" v-model="domainName">
|
<input type="text" name="domain" id="domain" v-model="domainName">
|
||||||
</div>
|
</div>
|
||||||
<div class="field" v-if="allowListEnabled">
|
|
||||||
<input type="checkbox" name="allowed" id="allowed" v-model="domainAllowed">
|
|
||||||
<label for="allowed"><translate translate-context="Content/Moderation/Form.Label/Verb">Add to allow-list</translate></label>
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<button :class="['ui', {'loading': isCreating}, 'green', 'button']" type="submit" :disabled="isCreating">
|
<button :class="['ui', {'loading': isCreating}, 'green', 'button']" type="submit" :disabled="isCreating">
|
||||||
<label for="domain"><translate translate-context="Content/Moderation/Button/Verb">Add</translate></label>
|
<label for="domain"><translate translate-context="Content/Moderation/Button/Verb">Add</translate></label>
|
||||||
|
@ -26,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div class="ui clearing hidden divider"></div>
|
<div class="ui clearing hidden divider"></div>
|
||||||
<domains-table :allow-list-enabled="allowListEnabled"></domains-table>
|
<domains-table></domains-table>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
@ -36,14 +32,12 @@ import axios from 'axios'
|
||||||
|
|
||||||
import DomainsTable from "@/components/manage/moderation/DomainsTable"
|
import DomainsTable from "@/components/manage/moderation/DomainsTable"
|
||||||
export default {
|
export default {
|
||||||
props: ['allowListEnabled'],
|
|
||||||
components: {
|
components: {
|
||||||
DomainsTable
|
DomainsTable
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
domainName: '',
|
domainName: '',
|
||||||
domainAllowed: this.allowListEnabled ? true : null,
|
|
||||||
isCreating: false,
|
isCreating: false,
|
||||||
errors: []
|
errors: []
|
||||||
}
|
}
|
||||||
|
@ -60,7 +54,7 @@ export default {
|
||||||
let self = this
|
let self = this
|
||||||
this.isCreating = true
|
this.isCreating = true
|
||||||
this.errors = []
|
this.errors = []
|
||||||
axios.post('manage/federation/domains/', {name: this.domainName, allowed: this.domainAllowed}).then((response) => {
|
axios.post('manage/federation/domains/', {name: this.domainName}).then((response) => {
|
||||||
this.isCreating = false
|
this.isCreating = false
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: "manage.moderation.domains.detail",
|
name: "manage.moderation.domains.detail",
|
||||||
|
|
Loading…
Reference in New Issue