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; text-rendering: auto;
line-height: 1; line-height: 1;
font-weight: 900; font-weight: 900;
color: #000; color: var(--text);
position: relative; position: relative;
font-size: 1.5em font-size: 1.5em;
top: 1.7rem;
left: 1rem;
} }
.swal2-icon { .swal2-icon {

View File

@ -48,13 +48,13 @@ function initPlugin() {
}) })
}) })
asCommon['TheDesk:confirm'] = asValue.FN_NATIVE(async (z) => { asCommon['TheDesk:confirm'] = asValue.FN_NATIVE(async (z) => {
const alert = await Swal.fire({ const alertSwal = await Swal.fire({
title: z[0].value, title: z[0].value,
text: z[1].value, text: z[1].value,
icon: z[2] ? z[2].value : 'info', icon: z[2] ? z[2].value : 'info',
showCancelButton: true 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) => { asCommon['TheDesk:css'] = asValue.FN_NATIVE((z) => {
$(escapeHTML(z[0].value)).css(escapeHTML(z[1].value), escapeHTML(z[2].value)) $(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) => { asCommon['TheDesk:confirm'] = asValue.FN_NATIVE(async (z) => {
const alert = await Swal.fire({ const alertSwal = await Swal.fire({
title: z[0].value, title: z[0].value,
text: z[1].value, text: z[1].value,
icon: z[2] ? z[2].value : 'info', icon: z[2] ? z[2].value : 'info',
showCancelButton: true 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) => { asCommon['TheDesk:css'] = asValue.FN_NATIVE((z) => {
$(escapeHTML(z[0].value)).css(escapeHTML(z[1].value), escapeHTML(z[2].value)) $(escapeHTML(z[0].value)).css(escapeHTML(z[1].value), escapeHTML(z[2].value))

View File

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

View File

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