Add: Misskey v11 streaming method
This commit is contained in:
parent
8991cb5a96
commit
edbe3c164f
|
@ -14,23 +14,6 @@ function ck() {
|
|||
}
|
||||
var domainz = localStorage.getItem("domain_0");
|
||||
var at = localStorage.getItem("acct_0_at");
|
||||
var oldat = localStorage.getItem(domainz + "_at");
|
||||
if(oldat){
|
||||
console.log("Move to New Account Management System")
|
||||
var multi = localStorage.getItem("multi");
|
||||
if (!multi) {
|
||||
var acctlen=1;
|
||||
} else {
|
||||
var obj = JSON.parse(multi);
|
||||
var acctlen=obj.length;
|
||||
}
|
||||
for(i=0;acctlen>i;i++){
|
||||
var domain = localStorage.getItem("domain_"+i);
|
||||
var oldat = localStorage.getItem(domain + "_at");
|
||||
var newat = localStorage.setItem("acct_"+ i + "_at",oldat);
|
||||
localStorage.removeItem(domain + "_at");
|
||||
}
|
||||
}
|
||||
//コード受信
|
||||
if(location.search){
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
|
||||
|
@ -50,6 +33,11 @@ function ck() {
|
|||
var acct=obj[key];
|
||||
if(acct.domain){
|
||||
refresh(key,true)
|
||||
var domain = localStorage.getItem("domain_" + key);
|
||||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
localStorage.removeItem("misskey_wss_" + key)
|
||||
connectMisskey(key)
|
||||
}
|
||||
}
|
||||
});
|
||||
if (obj[0].domain) {
|
||||
|
|
|
@ -363,8 +363,7 @@ function misskeyLogin(url) {
|
|||
"reaction-read",
|
||||
"reaction-write",
|
||||
"vote-read",
|
||||
"vote-write"
|
||||
/*
|
||||
"vote-write",
|
||||
"read:account",
|
||||
"write:account",
|
||||
"read:drive",
|
||||
|
@ -385,7 +384,6 @@ function misskeyLogin(url) {
|
|||
"read:reactions",
|
||||
"write:reactions",
|
||||
"write:votes"
|
||||
*/
|
||||
]
|
||||
}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,7 +20,7 @@ function notfColumn(acct_id, tlid, sys){
|
|||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
var misskey=true;
|
||||
var start = "https://" + domain + "/api/i/notifications";
|
||||
httpreq.open(POST, start, true);
|
||||
httpreq.open("POST", start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
var body=JSON.stringify({
|
||||
i:at
|
||||
|
@ -44,7 +44,10 @@ function notfColumn(acct_id, tlid, sys){
|
|||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var max_id = httpreq.getResponseHeader("link").match(/[?&]{1}max_id=([0-9]+)/)[1];
|
||||
var max_id = httpreq.getResponseHeader("link");
|
||||
if(max_id){
|
||||
max_id=max_id.match(/[?&]{1}max_id=([0-9]+)/)[1]
|
||||
}
|
||||
if(json[0]){
|
||||
var templete="";
|
||||
var lastnotf=localStorage.getItem("lastnotf_" + acct_id);
|
||||
|
@ -211,10 +214,6 @@ function notfCommon(acct_id, tlid, sys) {
|
|||
}
|
||||
var start = wss + "/api/v1/streaming/?stream=user&access_token=" +
|
||||
at;
|
||||
}else{
|
||||
var start = "wss://" + domain + "/?i=" +
|
||||
at;
|
||||
}
|
||||
|
||||
console.log(start);
|
||||
var wsid = websocketNotf.length;
|
||||
|
@ -233,32 +232,6 @@ function notfCommon(acct_id, tlid, sys) {
|
|||
popup = 0;
|
||||
}
|
||||
console.log(domain)
|
||||
if(misskey){
|
||||
console.log("misskey")
|
||||
console.log(JSON.parse(mess.data));
|
||||
if (JSON.parse(mess.data).type == "notification") {
|
||||
var obj = JSON.parse(mess.data).body;
|
||||
console.log(obj);
|
||||
if(obj.type!="follow"){
|
||||
|
||||
templete = misskeyParse([obj], 'notf', acct_id, 'notf', popup);
|
||||
}else{
|
||||
templete = misskeyUserparse([obj], 'notf', acct_id, 'notf', popup);
|
||||
}
|
||||
if(obj.type=="reaction"){
|
||||
console.log("refresh")
|
||||
reactRefresh(acct_id,obj.note.id)
|
||||
}
|
||||
if(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){
|
||||
$("div[data-notf=" + acct_id +"]").prepend(templete);
|
||||
$("div[data-const=notf_"+acct_id+"]").prepend(templete);
|
||||
}
|
||||
jQuery("time.timeago").timeago();
|
||||
}else if(JSON.parse(mess.data).type == "note-updated"){
|
||||
var obj = JSON.parse(mess.data).body.note;
|
||||
reactRefreshCore(obj)
|
||||
}
|
||||
}else{
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
||||
console.log(obj);
|
||||
var type = JSON.parse(mess.data).event;
|
||||
|
@ -279,12 +252,12 @@ function notfCommon(acct_id, tlid, sys) {
|
|||
$("[toot-id=" + obj + "]").hide();
|
||||
$("[toot-id=" + obj + "]").remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
websocketNotf[acct_id].onerror = function(error) {
|
||||
console.error('WebSocket Error ' + error);
|
||||
};
|
||||
}
|
||||
}
|
||||
//一定のスクロールで発火
|
||||
function notfmore(tlid) {
|
||||
console.log(moreloading);
|
||||
|
|
|
@ -164,33 +164,13 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
|||
localStorage.setItem("now", type);
|
||||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
var misskey=true;
|
||||
console.log(type);
|
||||
if (type == "home") {
|
||||
var start = "wss://" + domain +
|
||||
"/?i=" + at;
|
||||
} else if (type == "pub") {
|
||||
var start = "wss://" + domain +
|
||||
"/global-timeline?i=" + at;
|
||||
} else if (type == "pub-media") {
|
||||
var start = "wss://" + domain +
|
||||
"/global-timeline?i=" + at;
|
||||
} else if (type == "local") {
|
||||
var start = "wss://" + domain +
|
||||
"/local-timeline?i=" + at;
|
||||
} else if (type == "local-media") {
|
||||
var start = "wss://" + domain +
|
||||
"/local-timeline?i=" + at;
|
||||
} else if (type == "mix") {
|
||||
var start = "wss://" + domain +
|
||||
"/hybrid-timeline?i=" + at;
|
||||
} else if (type == "tag") {
|
||||
Materialize.toast(lang.lang_misskeyparse_tagnostr, 3000);
|
||||
} else if (type == "noauth") {
|
||||
var start = "wss://" + acct_id +
|
||||
"/local-timeline?i=" + at;
|
||||
} else if (type=="list"){
|
||||
var start = "wss://" + domain +
|
||||
"/user-list?i=" + at+"&listId="+data;
|
||||
var key=localStorage.getItem("misskey_wss_" + acct_id)
|
||||
var send='{"type":"connect","body":{"channel":"'+typePs(type)+'","id":"'+tlid+'"}}'
|
||||
while(1){
|
||||
if(misskeywsstate[key]){
|
||||
misskeyws[key].send(send)
|
||||
break
|
||||
}
|
||||
}
|
||||
}else{
|
||||
var misskey=false;
|
||||
|
@ -233,8 +213,6 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
|||
var start = wss +
|
||||
"/api/v1/streaming/?stream=direct&access_token=" + at;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(start);
|
||||
var wsid = websocket.length;
|
||||
localStorage.setItem("wss_" + tlid, wsid);
|
||||
|
@ -351,7 +329,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
|||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//一定のスクロールで発火
|
||||
|
@ -710,6 +688,24 @@ function com(type, data) {
|
|||
return "direct?"
|
||||
}
|
||||
}
|
||||
//Misskey
|
||||
function typePs(type){
|
||||
if (type == "home") {
|
||||
return "homeTimeline"
|
||||
} else if (type == "local" || type == "noauth") {
|
||||
return "localTimeline"
|
||||
} else if (type == "local-media") {
|
||||
return "localTimeline"
|
||||
} else if (type == "pub") {
|
||||
return "globalTimeline"
|
||||
} else if (type == "mix") {
|
||||
return "hybridTimeline"
|
||||
} else if (type == "tag") {
|
||||
return "hashtag"
|
||||
}else if (type == "list") {
|
||||
return "userList"
|
||||
}
|
||||
}
|
||||
function misskeycom(type, data) {
|
||||
if (type == "home") {
|
||||
return "timeline"
|
||||
|
|
|
@ -180,9 +180,17 @@ function parseColumn() {
|
|||
if(key===0){
|
||||
left_hold='';
|
||||
}
|
||||
if(localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct.domain))=="misskey"){
|
||||
var isMisRed=""
|
||||
exclude=""
|
||||
var if_misskey_hide="hide"
|
||||
}else{
|
||||
var isMisRed="red-text"
|
||||
var if_misskey_hide=""
|
||||
}
|
||||
var html='<div class="boxIn" id="timeline_box_' + key + '_box" tlid="' + key +
|
||||
'" data-acct="'+acct.domain+'"><div class="notice-box z-depth-2" id="menu_'+key+'" style="'+insert+' ">'+
|
||||
'<div class="area-notice"><i class="material-icons waves-effect red-text" id="notice_icon_' + key + '"'+notf_attr+' style="font-size:40px; padding-top:25%;" onclick="checkStr(\''+acct.type+'\', \''+data+'\', \''+acct.domain+'\', \''+key+'\', \''+delc+'\',\''+voice+'\',null)" title="'+lang.lang_layout_gotop +'"></i></div>'+
|
||||
'<div class="area-notice"><i class="material-icons waves-effect '+isMisRed+'" id="notice_icon_' + key + '"'+notf_attr+' style="font-size:40px; padding-top:25%;" onclick="checkStr(\''+acct.type+'\', \''+data+'\', \''+acct.domain+'\', \''+key+'\', \''+delc+'\',\''+voice+'\',null)" title="'+lang.lang_layout_gotop +'"></i></div>'+
|
||||
'<div class="area-notice_name"><span id="notice_' + key + '" class="tl-title"></span></div>'+
|
||||
'<div class="area-a1"><a onclick="notfToggle(' + acct.domain + ',' + key +
|
||||
')" class="setting nex '+if_notf+'" title="'+unique_notf+'"'+icnsert+'><i class="material-icons waves-effect nex notf-icon_' +
|
||||
|
@ -201,7 +209,7 @@ function parseColumn() {
|
|||
key + '">On</span></a>'+lang.lang_layout_linkana +'<br><a onclick="voiceToggle(' + key +
|
||||
')" class="setting nex"><i class="material-icons waves-effect nex" title="'+lang.lang_layout_tts +'">hearing</i><span id="sta-voice-' +
|
||||
key + '">On</span></a>'+lang.lang_layout_tts +'TL<br><a onclick="reconnector(' + key +
|
||||
',\''+acct.type+'\',\''+acct.domain+'\',\''+escapeHTML(acct.data)+'\')" class="setting nex '+if_notf+'"><i class="material-icons waves-effect nex '+if_notf+'" title="'+lang.lang_layout_reconnect+'">low_priority</i></a><span class="'+if_notf+'">'+lang.lang_layout_reconnect+'</span><br>'+lang.lang_layout_headercolor +'<br><div id="picker_'+key+'" class="color-picker"></div></div><div class="tl-box" tlid="' + key + '"><div id="timeline_' + key +
|
||||
',\''+acct.type+'\',\''+acct.domain+'\',\''+escapeHTML(acct.data)+'\')" class="setting nex '+if_notf+' '+if_misskey_hide+'"><i class="material-icons waves-effect nex '+if_notf+'" title="'+lang.lang_layout_reconnect+'">low_priority</i></a><span class="'+if_notf+'">'+lang.lang_layout_reconnect+'</span><br>'+lang.lang_layout_headercolor +'<br><div id="picker_'+key+'" class="color-picker"></div></div><div class="tl-box" tlid="' + key + '"><div id="timeline_' + key +
|
||||
'" class="tl '+acct.type+'-timeline " tlid="' + key + '" data-type="' + acct.type + '" data-acct="'+acct.domain+'" data-const="' + acct.type + '_'+acct.domain+'"><div id="landing_'+key+'" style="text-align:center">'+lang.lang_layout_nodata +'</div></div></div>'
|
||||
$('#timeline_box_' + basekey + '_parentBox').append(html);
|
||||
localStorage.removeItem("pool_" + key);
|
||||
|
|
|
@ -658,15 +658,7 @@
|
|||
Entyでは支援者様限定で様々なTheDeskに関する記事をご覧いただけます。<br>
|
||||
困ったときは、<a href="https://docs.thedesk.top">TheDesk Docs</a>をご覧ください。
|
||||
<h5>Release Note Usamin (18.3.3)</h5>
|
||||
・不具合修正<br>
|
||||
・blurhashに対応(2.8.1~)<br>
|
||||
18.3.2<br>
|
||||
・絵文字の描画修正<br>
|
||||
・旗系絵文字の入力修正<br>
|
||||
・このトゥートより後ローカルタイムライン<br>
|
||||
・このトゥートより後ユーザータイムライン<br>
|
||||
・このトゥートより後連合タイムライン<br>
|
||||
・Notestock公開時にリンクを表示<br>
|
||||
・caution:読み上げナシMisskey<br>
|
||||
<br>
|
||||
</div>
|
||||
<div id="release-en">
|
||||
|
|
Loading…
Reference in New Issue
Block a user