diff --git a/app/js/login/manager.js b/app/js/login/manager.js
index 96c2d896..b1afd821 100644
--- a/app/js/login/manager.js
+++ b/app/js/login/manager.js
@@ -367,9 +367,13 @@ function support() {
}
})
}
+function backToInit() {
+ $('#auth').hide()
+ $('#add').show()
+}
//URL指定してポップアップ
-function login(url) {
+async function login(url) {
var multi = localStorage.getItem('multi')
var obj = JSON.parse(multi)
if ($('#misskey:checked').val() == 'on') {
@@ -378,16 +382,18 @@ function login(url) {
return
}
$('#compt').hide()
- if ($('#linux:checked').val() == 'on') {
- var red = 'urn:ietf:wg:oauth:2.0:oob'
+ const start = `https://${url}/api/v1/apps`
+ $('#loginBtn').attr('disabled', true)
+ const nextSetup = await versionChecker(url)
+ $('#loginBtn').attr('disabled', false)
+ let red = 'thedesk://manager'
+ if (!nextSetup) {
+ red = 'urn:ietf:wg:oauth:2.0:oob'
if (~url.indexOf('pixelfed')) {
red = 'https://thedesk.top/hello.html'
}
- } else {
- var red = 'thedesk://manager'
}
localStorage.setItem('redirect', red)
- var start = 'https://' + url + '/api/v1/apps'
var httpreq = new XMLHttpRequest()
httpreq.open('POST', start, true)
httpreq.setRequestHeader('Content-Type', 'application/json')
@@ -420,103 +426,86 @@ function login(url) {
localStorage.setItem('client_id', json['client_id'])
localStorage.setItem('client_secret', json['client_secret'])
$('#auth').show()
- versionChecker(url)
$('#add').hide()
postMessage(['openUrl', auth], '*')
}
}
}
-function versionChecker(url) {
- var start = 'https://' + url + '/api/v1/instance'
- fetch(start, {
- method: 'GET',
- headers: {
- 'content-type': 'application/json'
+async function versionChecker(url) {
+ const start = `https://${url}/api/v1/instance`
+ try {
+ const response = await fetch(start, {
+ method: 'GET',
+ headers: {
+ 'content-type': 'application/json'
+ }
+ })
+ if (!response.ok) {
+ response.text().then(function (text) {
+ setLog(response.url, response.status, text)
+ })
}
- })
- .then(function (response) {
- if (!response.ok) {
- response.text().then(function (text) {
- setLog(response.url, response.status, text)
+ const json = await response.json()
+ const version = json.version
+ if (version) {
+ const reg = version.match(/^([0-9])\.[0-9]\.[0-9]/u)
+ if (reg) versionCompat(json.title, version)
+ if (version.match('compatible')) {
+ $('#compt-warn').show()
+ return false
+ } else {
+ $('#compt-warn').hide()
+ if (pwa) return true
+ const codeSetupCheck = await Swal.fire({
+ title: lang.lang_manager_codesetup_title,
+ text: lang.lang_manager_codesetup,
+ icon: 'info',
+ showCancelButton: true
})
+ if (!codeSetupCheck.isConfirmed) return false
+ return true
}
- return response.json()
- })
- .catch(function (error) {
- todo(error)
- setLog(start, 'JSON', error)
- console.error(error)
- })
- .then(function (json) {
- var version = json.version
- if (version) {
- var reg = version.match(/^([0-9])\.[0-9]\.[0-9]/u)
- if (reg) {
- versionCompat(reg[1], reg, json.title, reg[0])
- }
- }
- })
-}
-function versionCompat(prefix, ver, title, real) {
- $('#compt-instance').text(title)
- $('#compt-ver').text(real)
- if (~real.indexOf('compatible')) {
- $('#compt-warn').show()
- } else {
- $('#compt-warn').hide()
+ }
+ } catch {
+ return false
}
+}
+async function versionCompat(title, version) {
+ const [sem, a, b, c] = version.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)/)
+ $('#compt-instance').text(title)
+ $('#compt-ver').text(version)
$('#compt-list').html('')
var start = '../../source/version.json'
- fetch(start, {
- method: 'GET',
- headers: {
- 'content-type': 'application/json'
+ const response = await fetch(start)
+ const json = await response.json()
+ const keys = Object.keys(json)
+ let i = 0
+ let onceAdd = false
+ for (const targetVersion of keys) {
+ const data = json[targetVersion]
+ const [tsem, ta, tb, tc] = targetVersion.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)/)
+ let add = false
+ if (ta === a) {
+ if (tb === b) {
+ if (tc > c) {
+ add = true
+ }
+ } else if (tb > b) {
+ add = true
+ }
+ } else if (ta > a) {
+ add = true
}
- })
- .then(function (response) {
- 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) {
- var complete = false
- var ct = 0
- var jl = 0
- var jl2 = 0
- Object.keys(json).forEach(function (key) {
- var data = json[key]
- if (data) {
- jl++
- if (key != real && !complete) {
- for (var i = 0; i < data.length; i++) {
- var e = ''
- if (i == 0) {
- e = '(' + key + ')'
- }
- $('#compt-list').append('
' + data[i] + e + '')
- ct++
- e = ''
- }
- jl2++
- } else if (!complete) {
- complete = true
- }
- }
- })
- if (lang.language == 'ja' && ct > 0) {
- if (jl2 != jl && prefix != '1') {
- $('#compt').show()
- }
- }
- })
+ if (!add) break
+ if (add) onceAdd = true
+ for (const note of data) {
+ $('#compt-list').append(`${note}(${targetVersion})`)
+ }
+ i++
+ }
+ if (lang.language == 'ja' && onceAdd) {
+ $('#compt').show()
+ }
}
//これが後のMisskeyである。
function misskeyLogin(url) {
@@ -1156,9 +1145,8 @@ function asReadEnd() {
// Or with jQuery
-$(document).ready(function(){
- $('input.autocomplete').autocomplete({
- data: {},
- });
- });
-
\ No newline at end of file
+$(document).ready(function () {
+ $('input.autocomplete').autocomplete({
+ data: {},
+ });
+});
diff --git a/app/source/version.json b/app/source/version.json
index 5547712c..858df48d 100644
--- a/app/source/version.json
+++ b/app/source/version.json
@@ -1,5 +1,14 @@
{
- "latest":[],
+ "4.0.0": [
+ "トゥートの翻訳"
+ ],
+ "3.5.0": [
+ "投稿の編集",
+ "トレンドタグ・投稿"
+ ],
+ "3.3.0": [
+ "ミュートの継続時間設定"
+ ],
"3.2.0": [],
"3.1.5": [],
"3.1.4": [
diff --git a/app/view/make/acct.sample.html b/app/view/make/acct.sample.html
index 35a51e0e..49a43c37 100644
--- a/app/view/make/acct.sample.html
+++ b/app/view/make/acct.sample.html
@@ -55,8 +55,9 @@
-
+
@@ -80,6 +81,7 @@
@@codepastewarn@@
+
@@redo@@
diff --git a/app/view/make/language/en/acct.json b/app/view/make/language/en/acct.json
index d1610731..85e772ec 100644
--- a/app/view/make/language/en/acct.json
+++ b/app/view/make/language/en/acct.json
@@ -21,5 +21,6 @@
"misskeylogin":"Read
Docs(ja) to login Misskey.",
"nodata":"No data",
"accessTokenSetup": "Use access token to login(click after fill not code but access-token in box: Advanced)",
- "haveExported": "Having the exported file of TheDesk, click here to jump setting page"
+ "haveExported": "Having the exported file of TheDesk, click here to jump setting page",
+ "redo": "Retry(re-input address)"
}
\ No newline at end of file
diff --git a/app/view/make/language/en/main.json b/app/view/make/language/en/main.json
index dadd225c..0ee4fcc8 100644
--- a/app/view/make/language/en/main.json
+++ b/app/view/make/language/en/main.json
@@ -50,6 +50,8 @@
"lang_manager_logout": "Logout",
"lang_manager_maxChars": "Max chars of toots",
"lang_manager_refreshAt": "Login with this domain",
+ "lang_manager_codesetup_title": "Skip code-setup",
+ "lang_manager_codesetup": "If you failed log-in, please click Cancel.",
"lang_bbmd_misskey": "TheDesk regards \"@\" as reply, but put other parameter. Unlisted on Mastodon means Home on Misskey.",
"lang_emoji_get": "Get emojis",
"lang_emoji_custom": "Custom emojis",
diff --git a/app/view/make/language/ja-KS/acct.json b/app/view/make/language/ja-KS/acct.json
index 08264700..b696ede5 100644
--- a/app/view/make/language/ja-KS/acct.json
+++ b/app/view/make/language/ja-KS/acct.json
@@ -19,5 +19,6 @@
"thisismisskey":"これはMisskeyや",
"misskeylogin":"",
"nodata":"アカウントあらへん",
- "accessTokenSetup": "アクセストークン使うてもいけるで(コードの代わりにアクセストークンを入れてクリックしてな: 一見さんお断り)"
+ "accessTokenSetup": "アクセストークン使うてもいけるで(コードの代わりにアクセストークンを入れてクリックしてな: 一見さんお断り)",
+ "redo": "もっぺんやる"
}
\ No newline at end of file
diff --git a/app/view/make/language/ja-KS/main.json b/app/view/make/language/ja-KS/main.json
index f4bf4d26..2f2e8eea 100644
--- a/app/view/make/language/ja-KS/main.json
+++ b/app/view/make/language/ja-KS/main.json
@@ -49,6 +49,8 @@
"lang_manager_godev": "",
"lang_manager_logout": "ログアウト",
"lang_manager_refreshAt": "このドメインでログイン",
+ "lang_manager_codesetup_title": "コードスキップログイン",
+ "lang_manager_codesetup": "ログインできひんのやったら、「キャンセル」を押してな",
"lang_bbmd_misskey": "TheDeskのMisskeyは、@を返信として扱うけんど、全ての@はなおされて別パラメータになってまう。ついでに、「未収載」は「ホーム」扱いや。",
"lang_emoji_get": "絵文字リスト引っ張ってくる",
"lang_emoji_custom": "カスタム絵文字",
diff --git a/app/view/make/language/ja/acct.json b/app/view/make/language/ja/acct.json
index ebbaeb25..2e507d64 100644
--- a/app/view/make/language/ja/acct.json
+++ b/app/view/make/language/ja/acct.json
@@ -21,5 +21,6 @@
"misskeylogin":"
ドキュメントを参照して正しいコードを入れてください。",
"nodata":"アカウントがありません",
"accessTokenSetup": "アクセストークンを用いたセットアップ(コードの代わりにアクセストークンを入力してクリックしてください: 上級者向け)",
- "haveExported": "設定をインポートしたい場合、ここをクリックして設定画面に飛んでください"
+ "haveExported": "設定をインポートしたい場合、ここをクリックして設定画面に飛んでください",
+ "redo": "やり直し"
}
\ No newline at end of file
diff --git a/app/view/make/language/ja/main.json b/app/view/make/language/ja/main.json
index 240fad8b..2fd63646 100644
--- a/app/view/make/language/ja/main.json
+++ b/app/view/make/language/ja/main.json
@@ -50,6 +50,8 @@
"lang_manager_logout": "ログアウト",
"lang_manager_maxChars": "投稿最大文字数",
"lang_manager_refreshAt": "このドメインでログイン",
+ "lang_manager_codesetup_title": "コードスキップログイン",
+ "lang_manager_codesetup": "うまくログインできなかった場合、「キャンセル」を押してください",
"lang_bbmd_misskey": "TheDeskにおけるMisskeyでは、@を返信として扱いますが、全ての@は消去され別パラメータに入力されます。また、「未収載」を「ホーム」として扱います。",
"lang_emoji_get": "絵文字リストを取得",
"lang_emoji_custom": "カスタム絵文字",