Add: login by access-token

This commit is contained in:
cutls 2019-10-22 14:34:23 +09:00
parent 7eccc04e98
commit 4943b3ad20
6 changed files with 467 additions and 454 deletions

View File

@ -7,7 +7,7 @@ function load() {
var mode = m[1]; var mode = m[1];
var codex = m[2]; var codex = m[2];
if (mode == "first" && codex == "true") { if (mode == "first" && codex == "true") {
$("body").addClass("first") $("body").addClass("first");
} else { } else {
} }
} }
@ -38,27 +38,18 @@ function load() {
var acct = obj[key]; var acct = obj[key];
var list = key * 1 + 1; var list = key * 1 + 1;
if (acct.background != "def" && acct.text != "def") { if (acct.background != "def" && acct.text != "def") {
var style = 'style="background-color:#' + acct.background + '; color:' + acct.text + ';"' var style = 'style="background-color:#' + acct.background + "; color:" + acct.text + ';"';
} else { } else {
var style = "" var style = "";
} }
if (acct.name) { if (acct.name) {
var name = acct.name; var name = acct.name;
} else { } else {
var name = acct.user; var name = acct.user;
} }
templete = '<div id="acct_' + key + '" class="card" ' + style + '><div class="card-content "><span class="lts">' + list + templete = '<div id="acct_' + key + '" class="card" ' + style + '><div class="card-content "><span class="lts">' + list + '.</span><img src="' + acct.prof + '" width="40" height="40"><span class="card-title">' + name + "</span>" + escapeHTML(acct.user) + "@" + acct.domain + '</div><div class="card-action"><a class="waves-effect disTar pointer white-text" onclick="data(\'' + acct.domain + '\')"><i class="material-icons">info</i>' + lang.lang_manager_info + '</a><a class="waves-effect disTar pointer white-text" onclick="refresh(' + key + ')"><i class="material-icons">refresh</i>' + lang.lang_manager_refresh + '</a><a class="waves-effect disTar pointer red-text" onclick="multiDel(' + key + ')"><i class="material-icons">delete</i>' + lang.lang_manager_delete + "</a><br>" + lang.lang_manager_color + '<div id="colorsel_' + key + '" class="colorsel"></div></div></div>';
'.</span><img src="' + acct.prof + '" width="40" height="40"><span class="card-title">' +
name + '</span>' + escapeHTML(acct.user) + '@' + acct.domain +
'</div><div class="card-action"><a class="waves-effect disTar pointer white-text" onclick="data(\'' +
acct.domain +
'\')"><i class="material-icons">info</i>' + lang.lang_manager_info + '</a><a class="waves-effect disTar pointer white-text" onclick="refresh(' +
key +
')"><i class="material-icons">refresh</i>' + lang.lang_manager_refresh + '</a><a class="waves-effect disTar pointer red-text" onclick="multiDel(' +
key +
')"><i class="material-icons">delete</i>' + lang.lang_manager_delete + '</a><br>' + lang.lang_manager_color + '<div id="colorsel_' + key + '" class="colorsel"></div></div></div>';
$("#acct-list").append(templete); $("#acct-list").append(templete);
colorpicker(key) colorpicker(key);
}); });
multisel(); multisel();
var acctN = localStorage.getItem("acct"); var acctN = localStorage.getItem("acct");
@ -68,7 +59,6 @@ function load() {
} }
//全部チェックアリでいいと思うの //全部チェックアリでいいと思うの
$("#linux").prop("checked", true); $("#linux").prop("checked", true);
} }
//最初に読む //最初に読む
load(); load();
@ -85,27 +75,30 @@ function data(domain) {
$("#ins-user").text("Loading..."); $("#ins-user").text("Loading...");
$("#ins-ver").text("Loading..."); $("#ins-ver").text("Loading...");
$("#ins-name").text("Loading..."); $("#ins-name").text("Loading...");
$("#ins-prof").attr('src', "../../img/loading.svg"); $("#ins-prof").attr("src", "../../img/loading.svg");
var start = "https://instances.social/api/1.0/instances/show?name=" + domain; var start = "https://instances.social/api/1.0/instances/show?name=" + domain;
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json",
'Authorization': 'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M' Authorization: "Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M"
}, }
}).then(function (response) { })
.then(function(response) {
return response.json(); return response.json();
}).catch(function (error) { })
.catch(function(error) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { })
.then(function(json) {
if (!json.error) { if (!json.error) {
$("#ins-name").text(json.name); $("#ins-name").text(json.name);
$("#ins-upd").text(date(json.checked_at, 'full')); $("#ins-upd").text(date(json.checked_at, "full"));
$("#ins-add").text(date(json.added_at, 'full')); $("#ins-add").text(date(json.added_at, "full"));
$("#ins-connect").text(json.connections); $("#ins-connect").text(json.connections);
$("#ins-toot").text(json.statuses); $("#ins-toot").text(json.statuses);
$("#ins-sys").text(date(json.updated_at, 'full')); $("#ins-sys").text(date(json.updated_at, "full"));
$("#ins-per").text(json.uptime * 100); $("#ins-per").text(json.uptime * 100);
$("#ins-user").text(json.users); $("#ins-user").text(json.users);
$("#ins-ver").text(json.version); $("#ins-ver").text(json.version);
@ -115,16 +108,19 @@ function data(domain) {
}); });
var start = "https://" + domain + "/api/v1/instance"; var start = "https://" + domain + "/api/v1/instance";
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json"
}, }
}).then(function (response) { })
.then(function(response) {
return response.json(); return response.json();
}).catch(function (error) { })
.catch(function(error) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { })
.then(function(json) {
if (!json.error) { if (!json.error) {
$("#ins-title").text(json.title); $("#ins-title").text(json.title);
$("#ins-desc").html(json.description); $("#ins-desc").html(json.description);
@ -132,7 +128,7 @@ function data(domain) {
$("#ins-toot").text(json.stats.status_count); $("#ins-toot").text(json.stats.status_count);
$("#ins-user").text(json.stats.user_count); $("#ins-user").text(json.stats.user_count);
$("#ins-ver").text(json.version); $("#ins-ver").text(json.version);
$("#ins-prof").attr('src', json.thumbnail); $("#ins-prof").attr("src", json.thumbnail);
$("#ins-admin").text(escapeHTML(json.contact_account.display_name) + "(" + json.contact_account.acct + ")"); $("#ins-admin").text(escapeHTML(json.contact_account.display_name) + "(" + json.contact_account.acct + ")");
$("#ins-admin").attr("href", "index.html?mode=user&code=" + json.contact_account.username + "@" + domain); $("#ins-admin").attr("href", "index.html?mode=user&code=" + json.contact_account.username + "@" + domain);
} else { } else {
@ -149,13 +145,13 @@ function multiDel(target) {
Swal.fire({ Swal.fire({
title: lang.lang_manager_logout, title: lang.lang_manager_logout,
text: obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm, text: obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm,
type: 'warning', type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: '#3085d6', confirmButtonColor: "#3085d6",
cancelButtonColor: '#d33', cancelButtonColor: "#d33",
confirmButtonText: lang.lang_yesno, confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no cancelButtonText: lang.lang_no
}).then((result) => { }).then(result => {
if (result.value) { if (result.value) {
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function(key) {
var nk = key - 1; var nk = key - 1;
@ -182,7 +178,6 @@ function multiDel(target) {
localStorage.setItem("user-id_" + target, localStorage.getItem("user-id_" + key)); localStorage.setItem("user-id_" + target, localStorage.getItem("user-id_" + key));
localStorage.setItem("prof_" + target, localStorage.getItem("prof_" + key)); localStorage.setItem("prof_" + target, localStorage.getItem("prof_" + key));
} }
}); });
//とりあえず消す //とりあえず消す
obj.splice(target, 1); obj.splice(target, 1);
@ -213,9 +208,8 @@ function multiDel(target) {
}); });
var json = JSON.stringify(newcols); var json = JSON.stringify(newcols);
localStorage.setItem("column", json); localStorage.setItem("column", json);
} }
}) });
} }
function multiDel2(target) { function multiDel2(target) {
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem("multi");
@ -223,13 +217,13 @@ function multiDel2(target) {
Swal.fire({ Swal.fire({
title: lang.lang_manager_logout, title: lang.lang_manager_logout,
text: obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm, text: obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm,
type: 'warning', type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: '#3085d6', confirmButtonColor: "#3085d6",
cancelButtonColor: '#d33', cancelButtonColor: "#d33",
confirmButtonText: lang.lang_yesno, confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no cancelButtonText: lang.lang_no
}).then((result) => { }).then(result => {
if (result.value) { if (result.value) {
obj.splice(target, 1); obj.splice(target, 1);
var json = JSON.stringify(obj); var json = JSON.stringify(obj);
@ -250,10 +244,12 @@ function multiDel2(target) {
}); });
var col = localStorage.getItem("column"); var col = localStorage.getItem("column");
if (!col) { if (!col) {
var obj = [{ var obj = [
{
domain: 0, domain: 0,
type: 'local' type: "local"
}]; }
];
localStorage.setItem("card_0", "true"); localStorage.setItem("card_0", "true");
var json = JSON.stringify(obj); var json = JSON.stringify(obj);
localStorage.setItem("column", json); localStorage.setItem("column", json);
@ -275,7 +271,7 @@ function multiDel2(target) {
localStorage.setItem("column", json); localStorage.setItem("column", json);
load(); load();
} }
}) });
} }
//サポートインスタンス //サポートインスタンス
@ -283,8 +279,7 @@ function support() {
Object.keys(idata).forEach(function(key) { Object.keys(idata).forEach(function(key) {
var instance = idata[key]; var instance = idata[key];
if (instance == "instance") { if (instance == "instance") {
templete = '<a onclick="login(\'' + key + templete = "<a onclick=\"login('" + key + '\')" class="collection-item pointer transparent">' + idata[key + "_name"] + "(" + key + ")</a>";
'\')" class="collection-item pointer transparent">' + idata[key + "_name"] + '(' + key + ')</a>';
$("#support").append(templete); $("#support").append(templete);
} }
}); });
@ -294,206 +289,172 @@ function support() {
function login(url) { function login(url) {
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi); var obj = JSON.parse(multi);
if ($('#misskey:checked').val() == "on") { if ($("#misskey:checked").val() == "on") {
$("#misskey").prop("checked", true); $("#misskey").prop("checked", true);
misskeyLogin(url); misskeyLogin(url);
return; return;
} }
$("#compt").hide() $("#compt").hide();
if ($('#linux:checked').val() == "on") { if ($("#linux:checked").val() == "on") {
var red = "urn:ietf:wg:oauth:2.0:oob" var red = "urn:ietf:wg:oauth:2.0:oob";
if (~url.indexOf("pixelfed")) { if (~url.indexOf("pixelfed")) {
red = "https://thedesk.top/hello.html" red = "https://thedesk.top/hello.html";
} }
} else { } else {
var red = 'thedesk://manager'; var red = "thedesk://manager";
} }
localStorage.setItem("redirect", red); localStorage.setItem("redirect", red);
var start = "https://" + url + "/api/v1/apps"; var start = "https://" + url + "/api/v1/apps";
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(JSON.stringify({ httpreq.send(
scopes: 'read write follow', JSON.stringify({
scopes: "read write follow",
client_name: "TheDesk(PC)", client_name: "TheDesk(PC)",
redirect_uris: red, redirect_uris: red,
website: "https://thedesk.top" website: "https://thedesk.top"
})); })
);
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
localStorage.setItem("msky", "false"); localStorage.setItem("msky", "false");
var auth = "https://" + url + "/oauth/authorize?client_id=" + json[ var auth = "https://" + url + "/oauth/authorize?client_id=" + json["client_id"] + "&client_secret=" + json["client_secret"] + "&response_type=code&scope=read+write+follow&redirect_uri=" + encodeURIComponent(red);
"client_id"] + "&client_secret=" + json["client_secret"] +
"&response_type=code&scope=read+write+follow&redirect_uri=" + encodeURIComponent(red);
localStorage.setItem("domain_tmp", url); localStorage.setItem("domain_tmp", url);
localStorage.setItem("client_id", json["client_id"]); localStorage.setItem("client_id", json["client_id"]);
localStorage.setItem("client_secret", json["client_secret"]); localStorage.setItem("client_secret", json["client_secret"]);
$("#auth").show(); $("#auth").show();
versionChecker(url) versionChecker(url);
$("#add").hide(); $("#add").hide();
postMessage(["openUrl", auth], "*") postMessage(["openUrl", auth], "*");
if ($('#linux:checked').val() == "on") { } else { if ($("#linux:checked").val() == "on") {
postMessage(["sendSinmpleIpc", "quit"], "*") } else {
} postMessage(["sendSinmpleIpc", "quit"], "*");
} }
} }
};
} }
function versionChecker(url) { function versionChecker(url) {
var start = "https://" + url + "/api/v1/instance"; var start = "https://" + url + "/api/v1/instance";
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json"
}, }
}).then(function (response) { })
.then(function(response) {
return response.json(); return response.json();
}).catch(function (error) { })
.catch(function(error) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { })
var version = json.version .then(function(json) {
var version = json.version;
if (version) { if (version) {
var reg = version.match(/^([0-9])\.[0-9]\.[0-9]/u); var reg = version.match(/^([0-9])\.[0-9]\.[0-9]/u);
if (reg) { if (reg) {
versionCompat(reg[1], reg, json.title, reg[0]) versionCompat(reg[1], reg, json.title, reg[0]);
} }
} }
}); });
} }
function versionCompat(prefix, ver, title, real) { function versionCompat(prefix, ver, title, real) {
$("#compt-instance").text(title) $("#compt-instance").text(title);
$("#compt-ver").text(real) $("#compt-ver").text(real);
if (~real.indexOf("compatible")) { if (~real.indexOf("compatible")) {
$("#compt-warn").show() $("#compt-warn").show();
} else { } else {
$("#compt-warn").hide() $("#compt-warn").hide();
} }
$("#compt-list").html("") $("#compt-list").html("");
var start = "../../source/version.json"; var start = "../../source/version.json";
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json"
}, }
}).then(function (response) { })
.then(function(response) {
return response.json(); return response.json();
}).catch(function (error) { })
.catch(function(error) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { })
var complete = false .then(function(json) {
var ct = 0 var complete = false;
var jl = 0 var ct = 0;
var jl2 = 0 var jl = 0;
var jl2 = 0;
Object.keys(json).forEach(function(key) { Object.keys(json).forEach(function(key) {
var data = json[key]; var data = json[key];
if (data) { if (data) {
jl++ jl++;
if (key != real && !complete) { if (key != real && !complete) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var e = "" var e = "";
if (i == 0) { if (i == 0) {
e = "(" + key + ")" e = "(" + key + ")";
} }
$("#compt-list").append('<li>' + data[i] + e + '</li>') $("#compt-list").append("<li>" + data[i] + e + "</li>");
ct++; ct++;
e = "" e = "";
} }
jl2++ jl2++;
} else if (!complete) { } else if (!complete) {
complete = true complete = true;
} }
} }
}); });
if (lang.language == "ja" && ct > 0) { if (lang.language == "ja" && ct > 0) {
if (jl2 != jl && prefix != "1") { if (jl2 != jl && prefix != "1") {
$("#compt").show() $("#compt").show();
} }
} }
}); });
} }
//これが後のMisskeyである。 //これが後のMisskeyである。
function misskeyLogin(url) { function misskeyLogin(url) {
if (!url) { if (!url) {
var url = $("#misskey-url").val(); var url = $("#misskey-url").val();
} }
var start = "https://" + url + "/api/app/create"; var start = "http://" + url + "/api/app/create";
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.responseType = "json"; httpreq.responseType = "json";
localStorage.setItem("msky", "true"); localStorage.setItem("msky", "true");
httpreq.send(JSON.stringify({ httpreq.send(
JSON.stringify({
name: "TheDesk(PC)", name: "TheDesk(PC)",
description: "Mastodon client for PC", description: "Mastodon and Misskey client for PC",
permission: [ permission: ["account-read", "account-write", "account/read", "account/write", "drive-read", "drive-write", "favorite-read", "favorite-write", "favorites-read", "following-read", "following-write", "messaging-read", "messaging-write", "note-read", "note-write", "notification-read", "notification-write", "reaction-read", "reaction-write", "vote-read", "vote-write", "read:account", "write:account", "read:drive", "write:drive", "read:blocks", "write:blocks", "read:favorites", "write:favorites", "read:following", "write:following", "read:messaging", "write:messaging", "read:mutes", "write:mutes", "write:notes", "read:notifications", "write:notifications", "read:reactions", "write:reactions", "write:votes"]
"account-read", })
"account-write", );
"account/read",
"account/write",
"drive-read",
"drive-write",
"favorite-read",
"favorite-write",
"favorites-read",
"following-read",
"following-write",
"messaging-read",
"messaging-write",
"note-read",
"note-write",
"notification-read",
"notification-write",
"reaction-read",
"reaction-write",
"vote-read",
"vote-write",
"read:account",
"write:account",
"read:drive",
"write:drive",
"read:blocks",
"write:blocks",
"read:favorites",
"write:favorites",
"read:following",
"write:following",
"read:messaging",
"write:messaging",
"read:mutes",
"write:mutes",
"write:notes",
"read:notifications",
"write:notifications",
"read:reactions",
"write:reactions",
"write:votes"
]
}));
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
misskeyAuth(url, json.secret) misskeyAuth(url, json.secret);
} }
} };
} }
function misskeyAuth(url, mkc) { function misskeyAuth(url, mkc) {
var start = "https://" + url + "/api/auth/session/generate"; var start = "https://" + url + "/api/auth/session/generate";
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.responseType = "json"; httpreq.responseType = "json";
localStorage.setItem("mkc", mkc) localStorage.setItem("mkc", mkc);
localStorage.setItem("msky", "true"); localStorage.setItem("msky", "true");
httpreq.send(JSON.stringify({ httpreq.send(
JSON.stringify({
appSecret: mkc appSecret: mkc
})); })
);
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
@ -503,16 +464,16 @@ function misskeyAuth(url, mkc) {
$("#add").hide(); $("#add").hide();
$("#misskey").prop("checked", false); $("#misskey").prop("checked", false);
localStorage.setItem("domain_tmp", url); localStorage.setItem("domain_tmp", url);
postMessage(["openUrl", json.url], "*") postMessage(["openUrl", json.url], "*");
}
} }
};
} }
//テキストボックスにURL入れた //テキストボックスにURL入れた
function instance() { function instance() {
var url = $("#url").val(); var url = $("#url").val();
if (url.indexOf("@") != -1 || url.indexOf("https") != -1) { if (url.indexOf("@") != -1 || url.indexOf("https") != -1) {
alert("入力形式が違います。(Cutls@mstdn.jpにログインする場合、入力するのは\"mstdn.jp\"です。)") alert('入力形式が違います。(Cutls@mstdn.jpにログインする場合、入力するのは"mstdn.jp"です。)');
return false; return false;
} }
login(url); login(url);
@ -520,23 +481,29 @@ function instance() {
//コード入れてAccessTokenゲット //コード入れてAccessTokenゲット
function code(code) { function code(code) {
localStorage.removeItem("redirect") localStorage.removeItem("redirect");
if (!code) { if (!code) {
var code = $("#code").val(); var code = $("#code").val();
$("#code").val(""); $("#code").val("");
} }
if(!code || code==""){
M.toast({ html: lang.lang_fatalerroroccured + "Error: no code", displayLength: 5000 });
return false
}
var url = localStorage.getItem("domain_tmp"); var url = localStorage.getItem("domain_tmp");
localStorage.removeItem("domain_tmp"); localStorage.removeItem("domain_tmp");
if (localStorage.getItem("msky") == "true") { if (localStorage.getItem("msky") == "true") {
var start = "https://" + url + "/api/auth/session/userkey"; var start = "https://" + url + "/api/auth/session/userkey";
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(JSON.stringify({ httpreq.send(
JSON.stringify({
token: code, token: code,
appSecret: localStorage.getItem("mkc") appSecret: localStorage.getItem("mkc")
})); })
);
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
@ -553,10 +520,10 @@ function code(code) {
vis: priv, vis: priv,
mode: "misskey" mode: "misskey"
}; };
localStorage.setItem("mode_" + url, "misskey") localStorage.setItem("mode_" + url, "misskey");
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi); var obj = JSON.parse(multi);
var target = obj.lengtth; var target = obj.length;
obj.push(add); obj.push(add);
localStorage.setItem("name_" + target, json["user"]["name"]); localStorage.setItem("name_" + target, json["user"]["name"]);
localStorage.setItem("user_" + target, json["user"]["username"]); localStorage.setItem("user_" + target, json["user"]["username"]);
@ -565,32 +532,34 @@ function code(code) {
var json = JSON.stringify(obj); var json = JSON.stringify(obj);
localStorage.setItem("multi", json); localStorage.setItem("multi", json);
if ($("body").hasClass("first")) { if ($("body").hasClass("first")) {
location.href = "index.html" location.href = "index.html";
} }
load(); load();
return; return;
} }
} };
return; return;
} else { } else {
var red = "urn:ietf:wg:oauth:2.0:oob" var red = "urn:ietf:wg:oauth:2.0:oob";
if (~url.indexOf("pixelfed")) { if (~url.indexOf("pixelfed")) {
red = "https://thedesk.top/hello.html" red = "https://thedesk.top/hello.html";
} }
var start = "https://" + url + "/oauth/token"; var start = "https://" + url + "/oauth/token";
var id = localStorage.getItem("client_id"); var id = localStorage.getItem("client_id");
var secret = localStorage.getItem("client_secret"); var secret = localStorage.getItem("client_secret");
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(JSON.stringify({ httpreq.send(
JSON.stringify({
grant_type: "authorization_code", grant_type: "authorization_code",
redirect_uri: red, redirect_uri: red,
client_id: id, client_id: id,
client_secret: secret, client_secret: secret,
code: code code: code
})); })
);
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
@ -600,28 +569,30 @@ function code(code) {
getdata(url, json["access_token"]); getdata(url, json["access_token"]);
} }
} }
};
} }
} }
}
//ユーザーデータ取得 //ユーザーデータ取得
function getdata(domain, at) { function getdata(domain, at) {
var start = "https://" + domain + "/api/v1/accounts/verify_credentials"; var start = "https://" + domain + "/api/v1/accounts/verify_credentials";
fetch(start, { 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) { })
.then(function(response) {
return response.json(); return response.json();
}).catch(function (error) { })
.catch(function(error) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { })
.then(function(json) {
if (json.error) { if (json.error) {
console.error("Error:" + json.error); console.error("Error:" + json.error);
M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 }) M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 });
return; return;
} }
var avatar = json["avatar"]; var avatar = json["avatar"];
@ -646,7 +617,7 @@ function getdata(domain, at) {
}; };
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi); var obj = JSON.parse(multi);
var target = obj.lengtth; var target = obj.length;
obj.push(add); obj.push(add);
localStorage.setItem("name_" + target, json["display_name"]); localStorage.setItem("name_" + target, json["display_name"]);
localStorage.setItem("user_" + target, json["acct"]); localStorage.setItem("user_" + target, json["acct"]);
@ -655,37 +626,88 @@ function getdata(domain, at) {
var json = JSON.stringify(obj); var json = JSON.stringify(obj);
localStorage.setItem("multi", json); localStorage.setItem("multi", json);
if ($("body").hasClass("first")) { if ($("body").hasClass("first")) {
location.href = "index.html" location.href = "index.html";
} }
load(); load();
}); });
} }
//アクセストークン直接入力
function atSetup(type) {
var url = localStorage.getItem("domain_tmp");
localStorage.removeItem("domain_tmp");
var multi = localStorage.getItem("multi");
var avatar = "../../img/missing.svg";
var priv = "public";
if (type == "misskey") {
var i = $("#misskey-key").val();
var add = {
at: i,
name: "Pseudo Account",
domain: url,
user: "user+pseudo",
prof: avatar,
id: "id+pseudo",
vis: priv,
mode: "misskey"
};
localStorage.setItem("mode_" + url, "misskey");
} else {
var i = $("#code").val();
var add = {
at: i,
name: "Pseudo Account",
domain: url,
user: "user+pseudo",
prof: avatar,
id: "id+pseudo",
vis: priv,
mode: ""
};
}
if(!i || i==""){
M.toast({ html: lang.lang_fatalerroroccured + "Error: access token", displayLength: 5000 });
return false
}
var obj = JSON.parse(multi);
var target = obj.length;
obj.push(add);
localStorage.setItem("name_" + target, add["name"]);
localStorage.setItem("user_" + target, add["username"]);
localStorage.setItem("user-id_" + target, add["id"]);
localStorage.setItem("prof_" + target, avatar);
var json = JSON.stringify(obj);
localStorage.setItem("multi", json);
refresh(target);
}
//ユーザーデータ更新 //ユーザーデータ更新
function refresh(target) { function refresh(target) {
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi); var obj = JSON.parse(multi);
console.log(obj)
if (obj[target].mode == "misskey") { if (obj[target].mode == "misskey") {
misskeyRefresh(obj, target, obj[target].domain); misskeyRefresh(obj, target, obj[target].domain);
return return;
} }
var start = "https://" + obj[target].domain + var start = "https://" + obj[target].domain + "/api/v1/accounts/verify_credentials";
"/api/v1/accounts/verify_credentials";
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json",
'Authorization': 'Bearer ' + obj[target].at Authorization: "Bearer " + obj[target].at
}, }
}).then(function (response) { })
.then(function(response) {
return response.json(); return response.json();
}).catch(function (error) { })
.catch(function(error) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { })
.then(function(json) {
if (json.error) { if (json.error) {
console.error("Error:" + json.error); console.error("Error:" + json.error);
M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 }) M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 });
return; return;
} }
var avatar = json["avatar"]; var avatar = json["avatar"];
@ -721,18 +743,19 @@ function refresh(target) {
function misskeyRefresh(obj, target, url) { function misskeyRefresh(obj, target, url) {
var start = "https://" + url + "/api/users/show"; var start = "https://" + url + "/api/users/show";
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(JSON.stringify({ httpreq.send(
JSON.stringify({
username: obj[target].user, username: obj[target].user,
i: localStorage.getItem("at") i: obj[target].at
})); })
);
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
return; var avatar = json["user"]["avatarUrl"];
var avatar = json["user"]["avatarURL"];
var priv = "public"; var priv = "public";
var add = { var add = {
at: json.accessToken, at: json.accessToken,
@ -745,7 +768,7 @@ function misskeyRefresh(obj, target, url) {
}; };
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi); var obj = JSON.parse(multi);
var target = obj.lengtth; var target = obj.length;
obj.push(add); obj.push(add);
localStorage.setItem("name_" + target, json["user"]["name"]); localStorage.setItem("name_" + target, json["user"]["name"]);
localStorage.setItem("user_" + target, json["user"]["username"]); localStorage.setItem("user_" + target, json["user"]["username"]);
@ -756,7 +779,7 @@ function misskeyRefresh(obj, target, url) {
load(); load();
return; return;
} }
} };
} }
//アカウントを選択…を実装 //アカウントを選択…を実装
function multisel() { function multisel() {
@ -773,14 +796,14 @@ function multisel() {
var sel; var sel;
if (obj.length < 1) { if (obj.length < 1) {
$("#src-acct-sel").html('<option value="tootsearch">Tootsearch</option>'); $("#src-acct-sel").html('<option value="tootsearch">Tootsearch</option>');
$("#add-acct-sel").html('<option value="noauth">' + lang.lang_login_noauth + '</option>'); $("#add-acct-sel").html('<option value="noauth">' + lang.lang_login_noauth + "</option>");
} else { } else {
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function(key) {
var acct = obj[key]; var acct = obj[key];
var list = key * 1 + 1; var list = key * 1 + 1;
if (key == last) { if (key == last) {
sel = "selected"; sel = "selected";
mainb = '(' + lang.lang_manager_def + ')' mainb = "(" + lang.lang_manager_def + ")";
var domain = localStorage.getItem("domain_" + key); var domain = localStorage.getItem("domain_" + key);
var profimg = localStorage.getItem("prof_" + key); var profimg = localStorage.getItem("prof_" + key);
var domain = localStorage.getItem("domain_" + key); var domain = localStorage.getItem("domain_" + key);
@ -789,46 +812,21 @@ function multisel() {
} }
} else { } else {
sel = ""; sel = "";
mainb = "" mainb = "";
} }
templete = '<option value="' + key + '" data-icon="' + acct.prof + templete = '<option value="' + key + '" data-icon="' + acct.prof + '" class="left circle" ' + sel + ">" + acct.user + "@" + acct.domain + mainb + "</option>";
'" class="left circle" ' + sel + '>' + acct.user + '@' + acct.domain + mainb +
'</option>';
$(".acct-sel").append(templete); $(".acct-sel").append(templete);
}); });
} }
$('select').formSelect(); $("select").formSelect();
} }
function mainacct() { function mainacct() {
var acct_id = $("#main-acct-sel").val(); var acct_id = $("#main-acct-sel").val();
localStorage.setItem("main", acct_id); localStorage.setItem("main", acct_id);
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 }) M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 });
} }
function colorpicker(key) { function colorpicker(key) {
temp = temp = '<div onclick="coloradd(' + key + ",'def','def')\" class=\"pointer exc\">" + lang.lang_manager_none + "</div>" + '<div onclick="coloradd(' + key + ",'f44336','white')\" class=\"red white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'e91e63','white')\" class=\"pink white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'9c27b0','white')\" class=\"purple white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'673ab7','white')\" class=\"deep-purple white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'3f51b5','white')\" class=\"indigo white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'2196f3','white')\" class=\"blue white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'03a9f4','black')\" class=\"light-blue black-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'00bcd4','black')\" class=\"cyan black-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'009688','white')\" class=\"teal white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'4caf50','black')\" class=\"green black-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'8bc34a','black')\" class=\"light-green black-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'cddc39','black')\" class=\"lime black-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'ffeb3b','black')\" class=\"yellow black-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'ffc107','black')\" class=\"amber black-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'ff9800','black')\" class=\"orange black-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'ff5722','white')\" class=\"deep-orange white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'795548','white')\" class=\"brown white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'9e9e9e','white')\" class=\"grey white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'607d8b','white')\" class=\"blue-grey white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'000000','white')\" class=\"black white-text pointer\"></div>" + '<div onclick="coloradd(' + key + ",'ffffff','black')\" class=\"white black-text pointer\"></div>";
'<div onclick="coloradd(' + key + ',\'def\',\'def\')" class="pointer exc">' + lang.lang_manager_none + '</div>' +
'<div onclick="coloradd(' + key + ',\'f44336\',\'white\')" class="red white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'e91e63\',\'white\')" class="pink white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'9c27b0\',\'white\')" class="purple white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'673ab7\',\'white\')" class="deep-purple white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'3f51b5\',\'white\')" class="indigo white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'2196f3\',\'white\')" class="blue white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'03a9f4\',\'black\')" class="light-blue black-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'00bcd4\',\'black\')" class="cyan black-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'009688\',\'white\')" class="teal white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'4caf50\',\'black\')" class="green black-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'8bc34a\',\'black\')" class="light-green black-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'cddc39\',\'black\')" class="lime black-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'ffeb3b\',\'black\')" class="yellow black-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'ffc107\',\'black\')" class="amber black-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'ff9800\',\'black\')" class="orange black-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'ff5722\',\'white\')" class="deep-orange white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'795548\',\'white\')" class="brown white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'9e9e9e\',\'white\')" class="grey white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'607d8b\',\'white\')" class="blue-grey white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'000000\',\'white\')" class="black white-text pointer"></div>' +
'<div onclick="coloradd(' + key + ',\'ffffff\',\'black\')" class="white black-text pointer"></div>';
$("#colorsel_" + key).html(temp); $("#colorsel_" + key).html(temp);
} }
function coloradd(key, bg, txt) { function coloradd(key, bg, txt) {
@ -841,18 +839,18 @@ function coloradd(key, bg, txt) {
var json = JSON.stringify(o); var json = JSON.stringify(o);
localStorage.setItem("multi", json); localStorage.setItem("multi", json);
if (txt == "def") { if (txt == "def") {
$("#acct_" + key).attr("style", "") $("#acct_" + key).attr("style", "");
} else { } else {
$("#acct_" + key).css('background-color', '#' + bg); $("#acct_" + key).css("background-color", "#" + bg);
if (txt == "black") { if (txt == "black") {
var bghex = "000000"; var bghex = "000000";
var ichex = "9e9e9e" var ichex = "9e9e9e";
} else if (txt == "white") { } else if (txt == "white") {
var bghex = "ffffff"; var bghex = "ffffff";
var ichex = "eeeeee" var ichex = "eeeeee";
} }
$("#acct_" + key + " .nex").css('color', '#' + ichex); $("#acct_" + key + " .nex").css("color", "#" + ichex);
$("#acct_" + key).css('color', '#' + bghex); $("#acct_" + key).css("color", "#" + bghex);
} }
} }
//入力時にハッシュタグと@をサジェスト //入力時にハッシュタグと@をサジェスト
@ -863,33 +861,36 @@ var input = document.getElementById("url");
var prev_val = input.value; var prev_val = input.value;
var oldSuggest; var oldSuggest;
var suggest; var suggest;
input.addEventListener("focus", function () { input.addEventListener(
"focus",
function() {
$("#ins-suggest").html(""); $("#ins-suggest").html("");
window.clearInterval(timer); window.clearInterval(timer);
timer = window.setInterval(function() { timer = window.setInterval(function() {
var new_val = input.value; var new_val = input.value;
if (prev_val != new_val) { if (prev_val != new_val) {
if (new_val.length > 3) { if (new_val.length > 3) {
var start = "https://instances.social/api/1.0/instances/search?q=" + var start = "https://instances.social/api/1.0/instances/search?q=" + new_val;
new_val;
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json",
'Authorization': 'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M' Authorization: "Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M"
}, }
}).then(function (response) { })
.then(function(response) {
return response.json(); return response.json();
}).catch(function (error) { })
.catch(function(error) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { })
.then(function(json) {
if (!json.error) { if (!json.error) {
var urls = "Suggest:"; var urls = "Suggest:";
Object.keys(json.instances).forEach(function(key) { Object.keys(json.instances).forEach(function(key) {
var url = json.instances[key]; var url = json.instances[key];
urls = urls + ' <a onclick="login(\'' + url.name + urls = urls + " <a onclick=\"login('" + url.name + '\')" class="pointer">' + escapeHTML(url.name) + "</a> ";
'\')" class="pointer">' + escapeHTML(url.name) + '</a> ';
}); });
$("#ins-suggest").html(urls); $("#ins-suggest").html(urls);
} else { } else {
@ -901,12 +902,18 @@ input.addEventListener("focus", function () {
prev_value = new_val; prev_value = new_val;
} }
}, 1000); }, 1000);
}, false); },
false
);
input.addEventListener("blur", function () { input.addEventListener(
"blur",
function() {
window.clearInterval(timer); window.clearInterval(timer);
}, false); },
false
);
//acctで未読マーカーは要らない //acctで未読マーカーは要らない
function asReadEnd() { function asReadEnd() {
postMessage(["asReadComp", ""], "*") postMessage(["asReadComp", ""], "*");
} }

View File

@ -131,8 +131,10 @@
</div> </div>
<div id="auth" style="display:none"> <div id="auth" style="display:none">
@@codepastewarn@@<br> @@codepastewarn@@<br>
<input type="text" id="code" placeholder="@@codepaste@@"> <input type="text" id="code" placeholder="@@codepaste@@" required>
<button class="btn waves-effect" onclick="code()">Auth</button><br> <button class="btn waves-effect" onclick="code()">Auth</button><br>
<br>
<a onclick="atSetup()" class="pointer">@@accessTokenSetup@@</a>
<div id="compt" style="display:none"> <div id="compt" style="display:none">
<h5>ログイン前に必ずご確認ください</h5> <h5>ログイン前に必ずご確認ください</h5>
<span id="compt-instance"></span>はバージョンが<span id="compt-ver"></span>のため以下の機能がご利用いただけません。 <span id="compt-instance"></span>はバージョンが<span id="compt-ver"></span>のため以下の機能がご利用いただけません。
@ -144,8 +146,10 @@
<h5>AppSecret</h5> <h5>AppSecret</h5>
@@misskeylogin@@<br> @@misskeylogin@@<br>
<input type="hidden" id="misskey-url"> <input type="hidden" id="misskey-url">
<input type="text" id="misskey-key" placeholder="@@codepaste@@"> <input type="text" id="misskey-key" placeholder="@@codepaste@@" required>
<button class="btn waves-effect" onclick="misskeyLogin()">Auth</button><br> <button class="btn waves-effect" onclick="misskeyLogin()">Auth</button><br>
<br>
<a onclick="atSetup('misskey')" class="pointer">@@accessTokenSetup@@</a>
</div> </div>
</div> </div>
<div class="hide-first"> <div class="hide-first">

View File

@ -18,5 +18,6 @@
"ko":"", "ko":"",
"thisismisskey":"Login as Misskey", "thisismisskey":"Login as Misskey",
"misskeylogin":"Read <a href=\"https://thedesk.top/how-to-misskey-login.html\">Docs(ja)</a> to login Misskey.", "misskeylogin":"Read <a href=\"https://thedesk.top/how-to-misskey-login.html\">Docs(ja)</a> to login Misskey.",
"nodata":"No data" "nodata":"No data",
"accessTokenSetup": "Use access token to login(click after fill not code but access-token in box: Advanced)"
} }

View File

@ -9,7 +9,7 @@
"lang_edit": "Edit", "lang_edit": "Edit",
"lang_del": "Delete", "lang_del": "Delete",
"lang_add": "Add", "lang_add": "Add",
"lang_fatalerroroccured": "Some errors are occured, please restart TheDesk.", "lang_fatalerroroccured": "Error",
"lang_speech": "Google US English", "lang_speech": "Google US English",
"lang_lang": "Language", "lang_lang": "Language",
"lang_langlocale": "English", "lang_langlocale": "English",

View File

@ -18,5 +18,6 @@
"ko":"個", "ko":"個",
"thisismisskey":"Misskeyとしてログイン", "thisismisskey":"Misskeyとしてログイン",
"misskeylogin":"<a href=\"https://thedesk.top/how-to-misskey-login.html\">ドキュメント</a>を参照して正しいコードを入れてください。", "misskeylogin":"<a href=\"https://thedesk.top/how-to-misskey-login.html\">ドキュメント</a>を参照して正しいコードを入れてください。",
"nodata":"アカウントがありません" "nodata":"アカウントがありません",
"accessTokenSetup": "アクセストークンを用いたセットアップ(コードの代わりにアクセストークンを入力してクリックしてください: 上級者向け)"
} }

View File

@ -9,7 +9,7 @@
"lang_edit": "編集", "lang_edit": "編集",
"lang_del": "削除", "lang_del": "削除",
"lang_add": "追加", "lang_add": "追加",
"lang_fatalerroroccured": "エラーが発生しました。しばらく待ってから再起動してください。", "lang_fatalerroroccured": "エラーが発生しました。",
"lang_speech": "Google 日本語", "lang_speech": "Google 日本語",
"lang_lang": "言語", "lang_lang": "言語",
"lang_langlocale": "日本語", "lang_langlocale": "日本語",