add limited flags of moderated account

This commit is contained in:
cutls 2022-10-10 16:09:17 +09:00
parent c2ccc9a493
commit 48c872909d
4 changed files with 241 additions and 239 deletions

View File

@ -721,9 +721,11 @@
text-rendering: auto;
line-height: 1;
font-weight: 900;
color: #000;
color: var(--text);
position: relative;
font-size: 1.5em
font-size: 1.5em;
top: 1.7rem;
left: 1rem;
}
.swal2-icon {

View File

@ -48,13 +48,13 @@ function initPlugin() {
})
})
asCommon['TheDesk:confirm'] = asValue.FN_NATIVE(async (z) => {
const alert = await Swal.fire({
const alertSwal = await Swal.fire({
title: z[0].value,
text: z[1].value,
icon: z[2] ? z[2].value : 'info',
showCancelButton: true
})
return asUtil.jsToVal(!!(alert.value && alert.value === true))
return asUtil.jsToVal(!!(alertSwal.value && alertSwal.value === true))
})
asCommon['TheDesk:css'] = asValue.FN_NATIVE((z) => {
$(escapeHTML(z[0].value)).css(escapeHTML(z[1].value), escapeHTML(z[2].value))
@ -227,13 +227,13 @@ async function testExec(exe) {
})
})
asCommon['TheDesk:confirm'] = asValue.FN_NATIVE(async (z) => {
const alert = await Swal.fire({
const alertSwal = await Swal.fire({
title: z[0].value,
text: z[1].value,
icon: z[2] ? z[2].value : 'info',
showCancelButton: true
})
return asUtil.jsToVal(!!(alert.value && alert.value === true))
return asUtil.jsToVal(!!(alertSwal.value && alertSwal.value === true))
})
asCommon['TheDesk:css'] = asValue.FN_NATIVE((z) => {
$(escapeHTML(z[0].value)).css(escapeHTML(z[1].value), escapeHTML(z[2].value))

View File

@ -837,12 +837,12 @@ function testExecTrg() {
testExec(inputPlugin)
}
async function deletePlugin() {
const alert = await Swal.fire({
const delIsIt = await Swal.fire({
title: 'delete',
icon: 'warning',
showCancelButton: true,
})
if (!alert) return false
if (!delIsIt.isConfirmed) return false
editor.setValue('', -1)
var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]')

View File

@ -80,7 +80,7 @@ async function udgEx(user, acct_id) {
return true
}
function udg(user, acct_id, isSwal) {
async function udg(user, acct_id, isSwal) {
reset()
if (!user) {
user = localStorage.getItem('user-id_' + acct_id)
@ -91,30 +91,22 @@ function udg(user, acct_id, isSwal) {
misskeyUdg(user, acct_id)
return
}
var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = 'https://' + domain + '/api/v1/accounts/' + user
fetch(start, {
const at = localStorage.getItem('acct_' + acct_id + '_at')
const start = 'https://' + domain + '/api/v1/accounts/' + user
const response = await fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
Authorization: 'Bearer ' + at,
},
})
.then(function(response) {
if (isSwal) Swal.close()
if (!response.ok) {
response.text().then(function (text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function(error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function(json) {
const json = await response.json()
//一つ前のユーザーデータ
if (!localStorage.getItem('history')) {
$('#his-history-btn').prop('disabled', true)
@ -129,6 +121,15 @@ function udg(user, acct_id, isSwal) {
displayLength: 4000,
})
}
if (json.limited) {
const limitedCheck = await Swal.fire({
title: lang.lang_showontl_limited_title,
text: lang.lang_showontl_limited,
icon: 'info',
showCancelButton: true
})
if (!limitedCheck.isConfirmed) return false
}
$('#his-data').modal('open')
$('#his-data').attr('user-id', user)
$('#his-data').attr('use-acct', acct_id)
@ -287,7 +288,6 @@ function udg(user, acct_id, isSwal) {
}
//外部データ取得(死かもしれないので)
udAdd(acct_id, user, json.url)
})
}
function misskeyUdg(user, acct_id) {