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

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