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

@ -1,6 +1,6 @@
//ユーザーデータ表示 //ユーザーデータ表示
localStorage.removeItem('history') localStorage.removeItem('history')
//コード受信 //コード受信
if (location.search) { if (location.search) {
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/) var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
var mode = m[1] var mode = m[1]
@ -45,8 +45,8 @@ async function udgEx(user, acct_id) {
onBeforeOpen: () => { onBeforeOpen: () => {
Swal.showLoading() Swal.showLoading()
}, },
onClose: () => {}, onClose: () => { },
}).then((result) => {}) }).then((result) => { })
fetch(start, { fetch(start, {
method: 'GET', method: 'GET',
headers: { headers: {
@ -54,21 +54,21 @@ async function udgEx(user, acct_id) {
Authorization: 'Bearer ' + at, Authorization: 'Bearer ' + at,
}, },
}) })
.then(function(response) { .then(function (response) {
if (!response.ok) { if (!response.ok) {
Swal.close() Swal.close()
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() return response.json()
}) })
.catch(function(error) { .catch(function (error) {
todo(error) todo(error)
setLog(start, 'JSON', error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function (json) {
if (json.accounts[0]) { if (json.accounts[0]) {
var id = json.accounts[0].id var id = json.accounts[0].id
udg(id, acct_id, true) udg(id, acct_id, true)
@ -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)
@ -154,7 +155,7 @@ function udg(user, acct_id, isSwal) {
} }
//絵文字があれば //絵文字があれば
if (actemojick) { if (actemojick) {
Object.keys(json.emojis).forEach(function(key5) { Object.keys(json.emojis).forEach(function (key5) {
var emoji = json.emojis[key5] var emoji = json.emojis[key5]
var shortcode = emoji.shortcode var shortcode = emoji.shortcode
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">' var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">'
@ -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) {
@ -313,20 +313,20 @@ function misskeyUdg(user, acct_id) {
userId: user, userId: user,
}), }),
}) })
.then(function(response) { .then(function (response) {
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() return response.json()
}) })
.catch(function(error) { .catch(function (error) {
todo(error) todo(error)
setLog(start, 'JSON', error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function (json) {
//一つ前のユーザーデータ //一つ前のユーザーデータ
if (!localStorage.getItem('history')) { if (!localStorage.getItem('history')) {
$('#his-history-btn').prop('disabled', true) $('#his-history-btn').prop('disabled', true)
@ -444,20 +444,20 @@ function relations(user, acct_id) {
Authorization: 'Bearer ' + at, Authorization: 'Bearer ' + at,
}, },
}) })
.then(function(response) { .then(function (response) {
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() return response.json()
}) })
.catch(function(error) { .catch(function (error) {
todo(error) todo(error)
setLog(start, 'JSON', error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function (json) {
var json = json[0] var json = json[0]
if (json.requested) { if (json.requested) {
//フォロリク中 //フォロリク中
@ -597,7 +597,7 @@ function reset() {
$('#his-data').removeClass('locked') $('#his-data').removeClass('locked')
$('#his-data').removeClass('requesting') $('#his-data').removeClass('requesting')
} }
$('#my-data-nav .anc-link').on('click', function() { $('#my-data-nav .anc-link').on('click', function () {
var target = $(this).attr('go') var target = $(this).attr('go')
if (target) { if (target) {
let title = $(this).html() let title = $(this).html()