Preferences:
settings
diff --git a/app/js/lang/lang.js b/app/js/lang/lang.js
index 1e739cb1..b5c61e9c 100644
--- a/app/js/lang/lang.js
+++ b/app/js/lang/lang.js
@@ -112,6 +112,10 @@ var lang_manager_none={
"ja":"なし",
"en":"None"
}
+var lang_manager_godev={
+ "ja":"MisskeyのDevセンターに移動します。同時に開かれるドキュメントを参考にログインしてください。",
+ "en":"Open DevCenter of Misskey. We show also an official documents to refer."
+}
//post/bb-md.js
var lang_bbmd_misskey={
"ja":"TheDeskにおけるMisskeyでは、@を返信として扱いますが、全ての@は消去され別パラメータに入力されます。また、「未収載」を「ホーム」として扱います。",
diff --git a/app/js/login/login.js b/app/js/login/login.js
index 3a1fb934..62c996d8 100644
--- a/app/js/login/login.js
+++ b/app/js/login/login.js
@@ -263,7 +263,7 @@ function getdataAdv(domain, at) {
function refresh(target) {
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
- if(obj[target].domain=="misskey.xyz"){
+ if(obj[target].mode=="misskey"){
return
}
var start = "https://" + obj[target].domain +
@@ -320,6 +320,7 @@ function refresh(target) {
//絶対ストリーミングを閉じさせないマン
function ckdb(acct_id) {
var domain = localStorage.getItem("domain_" + acct_id);
+
if(domain=="kirishima.cloud"){
localStorage.setItem("kirishima", "true");
$("#ranking-btn").show();
@@ -380,7 +381,7 @@ function ckdb(acct_id) {
localStorage.setItem("follow_" + acct_id, json[domain + "_follow"]);
}
}
- if(domain!="misskey.xyz"){
+ if(domain.indexOf("misskey::")==-1 || domain!="misskey.xyz"){
var start = "https://" + domain + "/api/v1/instance/activity";
fetch(start, {
method: 'GET',
@@ -402,6 +403,10 @@ function ckdb(acct_id) {
}
});
+ }else{
+ if(domain=="misskey.xyz"){
+ localStorage.setItem("domain_" + acct_id,"misskey::misskey.xyz");
+ }
}
@@ -420,29 +425,30 @@ function multiSelector() {
var templete;
if(localStorage.getItem("mainuse")=="main"){
var last = localStorage.getItem("main");
- }else{
+ }else if(localStorage.getItem("last-use")){
var last = localStorage.getItem("last-use");
+ }else{
+ var last=0;
}
var sel;
- console.log(obj.length)
if(obj.length<1){
$("#src-acct-sel").html('
Tootsearch ');
$("#add-acct-sel").html('
'+lang_login_noauth[lang]+' ');
}else{
Object.keys(obj).forEach(function(key) {
var acct = obj[key];
-
var list = key * 1 + 1;
if (key == last) {
sel = "selected";
var domain = localStorage.getItem("domain_" + key);
+ var domain=domain.replace( "misskey::", "" );
if(idata[domain+"_letters"]){
$("#textarea").attr("data-length", idata[domain+"_letters"])
}else{
$("#textarea").attr("data-length", 500)
}
var profimg=localStorage.getItem("prof_"+key);
- var domain=localStorage.getItem("domain_"+key);
+ console.log(profimg);
if(!profimg){
profimg="./img/missing.svg";
}
diff --git a/app/js/login/manager.js b/app/js/login/manager.js
index d2d06f5c..ffcef936 100644
--- a/app/js/login/manager.js
+++ b/app/js/login/manager.js
@@ -244,8 +244,8 @@ function support() {
function login(url) {
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
- if(url=="misskey.xyz"){
- misskeyLogin();
+ if($('#misskey:checked').val()=="on"){
+ misskeyLogin(url);
return;
}
if($('#linux:checked').val()=="on"){
@@ -270,6 +270,7 @@ function login(url) {
if (httpreq.readyState == 4) {
var json = httpreq.response;
console.log(json);
+ localStorage.setItem("msky","false");
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);
@@ -281,7 +282,7 @@ function login(url) {
const {
shell
} = require('electron');
-
+
shell.openExternal(auth);
var electron = require("electron");
var ipc = electron.ipcRenderer;
@@ -294,16 +295,42 @@ function login(url) {
}
//これが後のMisskeyである。
-function misskeyLogin() {
+function misskeyLogin(url) {
+ if(!url){
+ var url=$("#misskey-url").val();
+ }
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
- var start = "https://misskey.xyz/api/auth/session/generate";
+ var start = "https://"+url+"/api/auth/session/generate";
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = 'json';
+ localStorage.setItem("msky","ture");
+ if(url=="misskey.xyz"){
+ var mkc=localStorage.getItem("mkc");
+ }else{
+ var mkc=$("#misskey-key").val();
+ if(!mkc){
+ $("#misskeylogin").show();
+ $("#misskey-url").val(url);
+ if(confirm(lang_manager_godev[lang])){
+ const {
+ shell
+ } = require('electron');
+ console.log("https://"+url+"/dev")
+ shell.openExternal("https://"+url+"/dev");
+ shell.openExternal("https://thedesk.top/how-to-login-misskey.html");
+ }
+
+ return false;
+ }else{
+ $("#misskeylogin").hide();
+ $("#misskey-url").val("");
+ }
+ }
httpreq.send(JSON.stringify({
- appSecret: localStorage.getItem("mkc")
+ appSecret: mkc
}));
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
@@ -316,7 +343,7 @@ function misskeyLogin() {
$("#auth").show();
$("#code").val(token);
$("#add").hide();
- localStorage.setItem("domain_tmp","misskey.xyz");
+ localStorage.setItem("domain_tmp",url);
shell.openExternal(json.url);
var electron = require("electron");
}
@@ -328,6 +355,10 @@ function misskeyLogin() {
//テキストボックスにURL入れた
function instance() {
var url = $("#url").val();
+ if(url.indexOf("@")!=-1 || url.indexOf("https")!=-1){
+ alert("入力形式が違います。(Cutls@mstdn.jpにログインする場合、入力するのは\"mstdn.jp\"です。)")
+ return false;
+ }
login(url);
}
@@ -336,12 +367,13 @@ function code(code) {
localStorage.removeItem("redirect")
if(!code){
var code = $("#code").val();
+ $("#code").val("");
}
var url = localStorage.getItem("domain_tmp");
localStorage.removeItem("domain_tmp");
console.log(url);
- if(url=="misskey.xyz"){
- var start = "https://misskey.xyz/api/auth/session/userkey";
+ if(localStorage.getItem("msky")=="true"){
+ var start = "https://"+url+"/api/auth/session/userkey";
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
@@ -360,11 +392,12 @@ function code(code) {
var add = {
at: i,
name: json["user"]["name"],
- domain: "misskey.xyz",
+ domain: url,
user: json["user"]["username"],
prof: avatar,
id: json["user"]["id"],
- vis: priv
+ vis: priv,
+ mode: "misskey"
};
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
@@ -398,13 +431,6 @@ function code(code) {
client_secret: secret,
code: code
}));
- console.log({
- grant_type: "authorization_code",
- redirect_uri: "urn:ietf:wg:oauth:2.0:oob",
- client_id: id,
- client_secret: secret,
- code: code
- })
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
var json = httpreq.response;
@@ -458,7 +484,8 @@ function getdata(domain, at) {
user: json["acct"],
prof: avatar,
id: json["id"],
- vis: priv
+ vis: priv,
+ mode: "mastodon"
};
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
@@ -479,8 +506,8 @@ function getdata(domain, at) {
function refresh(target) {
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
- if(obj[target].domain=="misskey.xyz"){
- misskeyRefresh(obj,target);
+ if(obj[target].mode=="misskey"){
+ misskeyRefresh(obj,target,obj[target].domain);
return
}
var start = "https://" + obj[target].domain +
@@ -532,8 +559,9 @@ function refresh(target) {
load();
});
}
-function misskeyRefresh(obj,target){
- var start = "https://misskey.xyz/api/users/show";
+function misskeyRefresh(obj,target,url){
+
+ var start = "https://"+url+"/api/users/show";
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
@@ -552,7 +580,7 @@ function misskeyRefresh(obj,target){
var add = {
at: json.accessToken,
name: json["user"]["name"],
- domain: "misskey.xyz",
+ domain: url,
user: json["user"]["username"],
prof: avatar,
id: json["user"]["id"],
@@ -722,4 +750,4 @@ input.addEventListener("focus", function() {
input.addEventListener("blur", function() {
window.clearInterval(timer);
-}, false);
+}, false);
\ No newline at end of file
diff --git a/app/js/post/bb-md.js b/app/js/post/bb-md.js
index 823622db..84c24955 100644
--- a/app/js/post/bb-md.js
+++ b/app/js/post/bb-md.js
@@ -3,11 +3,14 @@
function mdCheck(){
var acct_id = $("#post-acct-sel").val();
var profimg=localStorage.getItem("prof_"+acct_id);
- $("#acct-sel-prof").attr("src",profimg);
+ if(!profimg){
+ profimg="./img/missing.svg";
+ }
+ $("#acct-sel-prof").attr("src",profimg);
if(localStorage.getItem("post_" + acct_id)){
$("#toot-post-btn").text(localStorage.getItem("post_" + acct_id)+"("+localStorage.getItem("domain_"+acct_id)+")");
}else{
- $("#toot-post-btn").text(lang_toot[lang]+"("+localStorage.getItem("domain_"+acct_id)+")");
+ $("#toot-post-btn").text(lang_toot[lang]+"("+localStorage.getItem("domain_"+acct_id).replace( "misskey::", "" )+")");
}
if(!localStorage.getItem("bb_"+acct_id) && !localStorage.getItem("md_"+acct_id)){
$(".markdown").addClass("hide");
@@ -36,7 +39,7 @@ function mdCheck(){
}else{
$("#trendtag").html("");
}
- if(domain=="misskey.xyz"){
+ if(~domain.indexOf("misskey::")){
Materialize.toast(lang_bbmd_misskey[lang], 5000);
}
if(idata[domain+"_letters"]){
diff --git a/app/js/post/img.js b/app/js/post/img.js
index a49577e6..399d4527 100644
--- a/app/js/post/img.js
+++ b/app/js/post/img.js
@@ -102,8 +102,9 @@ function media(b64, type, no) {
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var httpreq = new XMLHttpRequest();
- if(domain=="misskey.xyz"){
- var start = "https://" + domain + "/api/drive/files/create";
+ if(~domain.indexOf("misskey::")){
+
+ var start = "https://" + domain.replace( "misskey::", "" ) + "/api/drive/files/create";
httpreq.open('POST', start, true);
httpreq.upload.addEventListener("progress", progshow, false);
httpreq.responseType = 'json';
diff --git a/app/js/post/use-txtbox.js b/app/js/post/use-txtbox.js
index 61610533..e2d71325 100644
--- a/app/js/post/use-txtbox.js
+++ b/app/js/post/use-txtbox.js
@@ -11,6 +11,11 @@ function re(id,at,acct_id,mode){
$('select').material_select();
$("#textarea").attr("placeholder",lang_usetxtbox_reply[lang]);
$("#textarea").focus();
+ var profimg=localStorage.getItem("prof_"+acct_id);
+ if(!profimg){
+ profimg="./img/missing.svg";
+ }
+ $("#acct-sel-prof").attr("src",profimg);
vis(mode);
}
function reEx(id){
diff --git a/app/js/tl/card.js b/app/js/tl/card.js
index 219d48c1..f870162a 100644
--- a/app/js/tl/card.js
+++ b/app/js/tl/card.js
@@ -29,9 +29,11 @@ function additional(acct_id, tlid) {
var card = localStorage.getItem("card_" + tlid);
var text = $(this).attr('href');
if(text){
- var urls = text.match(
- /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
- );
+ if(text.indexOf("twimg.com")=== -1){
+ var urls = text.match(
+ /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
+ );
+ }
}else{
var urls =[]
}
@@ -297,6 +299,7 @@ function mov(id,tlid,type){
}
if(mouseover=="hide"){
$(tlide+" [toot-id="+id+"] .area-actions").toggleClass("hide")
+ $(tlide+" [toot-id="+id+"] .area-side").toggleClass("hide")
}
}
@@ -313,6 +316,7 @@ function resetmv(type){
}
if(mouseover=="hide"){
$(".area-actions").addClass("hide");
+ $(".area-side").addClass("hide");
}
}
\ No newline at end of file
diff --git a/app/js/tl/mix.js b/app/js/tl/mix.js
index 87eedcc5..980d092d 100644
--- a/app/js/tl/mix.js
+++ b/app/js/tl/mix.js
@@ -77,7 +77,7 @@ function mixtl(acct_id, tlid, type,delc,voice) {
//Streamingに接続
-function mixre(acct_id, tlid, TLtype, mute,delc,voice) {
+function mixre(acct_id, tlid, TLtype, mute,delc,voice,mode) {
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var startHome = "wss://" + domain +
@@ -146,6 +146,11 @@ function mixre(acct_id, tlid, TLtype, mute,delc,voice) {
console.log(obj);
var type = JSON.parse(mess.data).event;
if (type == "delete") {
+ if(del>10){
+ reconnector(tlid,type,acct_id,data)
+ }else{
+ localStorage.setItem("delete",del*1+1)
+ }
if(delc=="true"){
$("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
$("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch");
@@ -154,6 +159,7 @@ function mixre(acct_id, tlid, TLtype, mute,delc,voice) {
$("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
}
} else if (type == "update") {
+ localStorage.removeItem("delete");
if(TLtype=="integrated"){
var templete = parse([obj], '', acct_id, tlid);
}else if(TLtype=="plus"){
@@ -187,10 +193,42 @@ function mixre(acct_id, tlid, TLtype, mute,delc,voice) {
}
websocketLocal[wslid].onerror = function(error) {
console.error('WebSocket Error ' + error);
+ if(mode=="error"){
+ $("#notice_icon_" + tlid).addClass("red-text");
+ todo('WebSocket Error ' + error);
+ }else{
+ reconnector(tlid,TLtype,acct_id,"","error");
+ }
+ };
+ websocketLocal[wslid].onclose = function() {
+ console.error('WebSocketLocal Closing by error:' + tlid);
+ if(mode=="error"){
+ $("#notice_icon_" + tlid).addClass("red-text");
+ todo('WebSocket Closed');
+ }else{
+ reconnector(tlid,TLtype,acct_id,"","error");
+ }
};
websocketHome[wshid].onerror = function(error) {
console.error('WebSocket Error ' + error);
+ if(mode=="error"){
+ $("#notice_icon_" + tlid).addClass("red-text");
+ todo('WebSocket Error ' + error);
+ }else{
+ reconnector(tlid,TLtype,acct_id,"","error");
+ }
};
+ websocketHome[wshid].onclose = function() {
+ console.error('WebSocketHome Closing by error:' + tlid);
+ if(mode=="error"){
+ $("#notice_icon_" + tlid).addClass("red-text");
+ todo('WebSocket Closed');
+ }else{
+ reconnector(tlid,TLtype,acct_id,"","error");
+ }
+
+ };
+
}
//ある程度のスクロールで発火
diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js
index 8eb5d409..26e7a2c4 100644
--- a/app/js/tl/parse.js
+++ b/app/js/tl/parse.js
@@ -157,7 +157,18 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
});
}
+ var noticeavatar="";
if (mix == "notf") {
+ if (gif == "yes") {
+ noticeavatar = toot.account.avatar;
+ } else {
+ noticeavatar = toot.account.avatar_static;
+ }
+ noticeavatar='
' +
+ ' ';
if (toot.type == "mention") {
var what = lang_parse_mentioned[lang];
var icon = "fa-share teal-text";
@@ -249,6 +260,16 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
}else{
var if_notf="";
if (toot.reblog) {
+ if (gif == "yes") {
+ noticeavatar = toot.account.avatar;
+ } else {
+ noticeavatar = toot.account.avatar_static;
+ }
+ noticeavatar='
' +
+ ' ';
var rebtxt = lang_parse_btedsimple[lang];
var rticon = "fa-retweet light-blue-text";
if(localStorage.getItem("domain_" + acct_id)=="imastodon.net" && !locale){
@@ -387,7 +408,24 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
spoil = spoil.replace(regExp, emoji_url);
});
}
-
+ //ニコフレ絵文字
+ if(toot.profile_emojis){
+ var nicoemojick = toot.profile_emojis[0];
+ }else{
+ var nicoemojick=false;
+ }
+ //絵文字があれば
+ if (nicoemojick) {
+ Object.keys(toot.profile_emojis).forEach(function(keynico) {
+ var emoji = toot.profile_emojis[keynico];
+ var shortcode = emoji.shortcode;
+ var emoji_url = '
';
+ var regExp = new RegExp(":" + shortcode + ":", "g");
+ content = content.replace(regExp, emoji_url);
+ spoil = spoil.replace(regExp, emoji_url);
+ });
+ }
//デフォ絵文字
content=twemoji.parse(content);
if(dis_name){
@@ -551,7 +589,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
'\',' + acct_id + ');" user="' + toot.account.acct + '" class="udg">' +
'