TheDesk Riina (ver.8)

This commit is contained in:
cutls 2018-02-26 00:32:10 +09:00
parent ba95bd9a24
commit 19eb4c2588
13 changed files with 79 additions and 22 deletions

View File

@ -1,15 +1,13 @@
## For Markdown-supporting Instances ## For Markdown-supporting Instances
[TheDesk](https://thedesk.top) :thedesk: Riina (ver.7) [TheDesk](https://thedesk.top) :thedesk: Riina (ver.8)
・バグ修正 ・バグ修正
トゥート自動折りたたみ機能他 ・プラットフォーム追加(サポート外となります)
・デザイン微修正
:github: [cutls/TheDesk](https://github.com/cutls/TheDesk) #Desk #DeskUpdate :github: [cutls/TheDesk](https://github.com/cutls/TheDesk) #Desk #DeskUpdate
## For Vanilla Instances ## For Vanilla Instances
WindowsクライアントTheDesk Riina (ver.6)リリース WindowsクライアントTheDesk Riina (ver.8)リリース
・バグ修正 ・バグ修正
トゥート自動折りたたみ機能他 ・プラットフォーム追加(サポート外となります)
・デザイン微修正
https://thedesk.top https://thedesk.top

View File

@ -30,6 +30,8 @@
<input type="text" id="url" style="width:70%" placeholder="mstdn.jp"> <input type="text" id="url" style="width:70%" placeholder="mstdn.jp">
<div id="ins-suggest"></div> <div id="ins-suggest"></div>
<button class="btn waves-effect" onclick="instance()">Login</button><br> <button class="btn waves-effect" onclick="instance()">Login</button><br>
<input type="checkbox" class="filled-in" id="linux" value="linux" />
<label for="linux">Linuxの方はチェックをいれてください。</label><br>
<span style="font-family:Open Sans;">Supports</span> <span style="font-family:Open Sans;">Supports</span>
<div id="support"></div> <div id="support"></div>
</div> </div>

View File

@ -23,7 +23,8 @@
<script type="text/javascript" src="./js/common/keyshortcut.js"></script> <script type="text/javascript" src="./js/common/keyshortcut.js"></script>
<script type="text/javascript" src="./js/common/modal.js"></script> <script type="text/javascript" src="./js/common/modal.js"></script>
<script> <script>
var ver="Riina (ver.7)"; //トゥートリンク追加
var ver="Riina (ver.8)";
//betaを入れるとバージョンチェックしない //betaを入れるとバージョンチェックしない
//var ver="beta"; //var ver="beta";
var acct_id=0; var acct_id=0;
@ -37,7 +38,8 @@ var tlid=0;
<input type="text" id="url" style="width:70%" placeholder="mstdn.jp"> <input type="text" id="url" style="width:70%" placeholder="mstdn.jp">
<div id="ins-suggest"></div> <div id="ins-suggest"></div>
<button class="btn waves-effect" onclick="instance()">Login</button><br> <button class="btn waves-effect" onclick="instance()">Login</button><br>
<input type="checkbox" class="filled-in" id="linux" />
<label for="linux">Linuxの方はチェックをいれてください。</label><br>
<span style="font-family:Open Sans;">Supports</span> <span style="font-family:Open Sans;">Supports</span>
<div id="support"> <div id="support">
</div> </div>

View File

@ -8,7 +8,7 @@ function ck() {
var at = localStorage.getItem(domain + "_at"); var at = localStorage.getItem(domain + "_at");
//コード受信 //コード受信
if(location.search){ if(location.search){
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=([a-zA-Z-0-9]+)/); var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
var mode=m[1]; var mode=m[1];
var codex=m[2]; var codex=m[2];
if(mode=="manager" || mode=="login"){ if(mode=="manager" || mode=="login"){
@ -32,6 +32,12 @@ function ck() {
ck(); ck();
//ログインポップアップ //ログインポップアップ
function login(url) { function login(url) {
if($('#linux:checked').val()=="linux"){
var red = "urn:ietf:wg:oauth:2.0:oob"
}else{
var red = 'thedesk://login';
}
localStorage.setItem("redirect", red);
var start = "https://" + url + "/api/v1/apps"; var start = "https://" + url + "/api/v1/apps";
fetch(start, { fetch(start, {
method: 'POST', method: 'POST',
@ -41,7 +47,7 @@ function login(url) {
body: JSON.stringify({ body: JSON.stringify({
scopes: 'read write follow', scopes: 'read write follow',
client_name: "TheDesk(PC)", client_name: "TheDesk(PC)",
redirect_uris: 'thedesk://login', redirect_uris: red,
website: "https://thedesk.top" website: "https://thedesk.top"
}) })
}).then(function(response) { }).then(function(response) {
@ -78,6 +84,8 @@ function instance() {
//コードを入れた後認証 //コードを入れた後認証
function code(code,mode) { function code(code,mode) {
var red = localStorage.getItem("redirect");
localStorage.removeItem("redirect")
if(!code){ if(!code){
var code = $("#code").val(); var code = $("#code").val();
} }
@ -96,7 +104,7 @@ function code(code,mode) {
}, },
body: JSON.stringify({ body: JSON.stringify({
grant_type: "authorization_code", grant_type: "authorization_code",
redirect_uri: "thedesk://"+mode, redirect_uri: red,
client_id: id, client_id: id,
client_secret: secret, client_secret: secret,
code: code code: code

View File

@ -145,6 +145,12 @@ function login(url) {
if (ng) { if (ng) {
return; return;
} }
if($('#linux:checked').val()=="linux"){
var red = "urn:ietf:wg:oauth:2.0:oob"
}else{
var red = 'thedesk://manager';
}
localStorage.setItem("redirect", red);
var start = "https://" + url + "/api/v1/apps"; var start = "https://" + url + "/api/v1/apps";
fetch(start, { fetch(start, {
method: 'POST', method: 'POST',
@ -154,7 +160,7 @@ function login(url) {
body: JSON.stringify({ body: JSON.stringify({
scopes: 'read write follow', scopes: 'read write follow',
client_name: "TheDesk(PC)", client_name: "TheDesk(PC)",
redirect_uris: 'thedesk://manager', redirect_uris: red,
website: "https://thedesk.top" website: "https://thedesk.top"
}) })
}).then(function(response) { }).then(function(response) {
@ -179,7 +185,11 @@ function login(url) {
shell.openExternal(auth); shell.openExternal(auth);
var electron = require("electron"); var electron = require("electron");
var ipc = electron.ipcRenderer; var ipc = electron.ipcRenderer;
if($('#linux:checked').val()=="linux"){
}else{
ipc.send('quit', 'go'); ipc.send('quit', 'go');
}
}); });
} }
@ -191,6 +201,7 @@ function instance() {
//コード入れてAccessTokenゲット //コード入れてAccessTokenゲット
function code(code) { function code(code) {
localStorage.removeItem("redirect")
if(!code){ if(!code){
var code = $("#code").val(); var code = $("#code").val();
} }

View File

@ -21,6 +21,8 @@
location.href = url; location.href = url;
} }
}else{
location.href = url;
} }
} }
return false; return false;

View File

@ -18,7 +18,16 @@ function notf(acct_id, tlid, sys) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function(json) { }).then(function(json) {
var templete = parse(json, '', acct_id, tlid, -1) var templete="";
Object.keys(json).forEach(function(key) {
var obj = json[key];
if(obj.type!="follow"){
templete = templete+parse([obj], '', acct_id, tlid, -1);
}else{
templete = templete+userparse([obj.account], '', acct_id, tlid, -1);
}
});
if (sys == "direct") { if (sys == "direct") {
$("#timeline_" + tlid).html(templete); $("#timeline_" + tlid).html(templete);
} else { } else {
@ -51,7 +60,11 @@ function notf(acct_id, tlid, sys) {
if (!popup) { if (!popup) {
popup = 0; popup = 0;
} }
var templete = parse(json, '', acct_id, tlid, popup) if(json.type!="follow"){
templete = templete+parse([json], '', acct_id, tlid, popup);
}else{
templete = templete+userparse([json], '', acct_id, tlid, popup);
}
var notices = templete[1]; var notices = templete[1];
console.log(templete); console.log(templete);
if (sys == "direct") { if (sys == "direct") {

View File

@ -51,7 +51,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
var notice = noticetext; var notice = noticetext;
var memory = localStorage.getItem("notice-mem"); var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) { if (popup >= 0 && obj.length < 5 && noticetext != memory) {
Materialize.toast(noticetext, popup * 1000); Materialize.toast(toot.account.display_name+"が"+what, popup * 1000);
$(".notf-icon_" + tlid).addClass("red-text"); $(".notf-icon_" + tlid).addClass("red-text");
localStorage.setItem("notice-mem", noticetext); localStorage.setItem("notice-mem", noticetext);
noticetext = ""; noticetext = "";
@ -96,7 +96,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
var spoiler = "cw cw_hide_" + toot.id; var spoiler = "cw cw_hide_" + toot.id;
var api_spoil = "gray"; var api_spoil = "gray";
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id + var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
'\')" class="nex parsed">見る</a>'; '\')" class="nex parsed">見る</a><br>';
} else { } else {
var ct = toot.content.split('</p>').length + toot.content.split('<br />').length - var ct = toot.content.split('</p>').length + toot.content.split('<br />').length -
2; 2;
@ -296,7 +296,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
} }
//オブジェクトパーサー(ユーザーデータ) //オブジェクトパーサー(ユーザーデータ)
function userparse(obj, auth, acct_id, notf) { function userparse(obj, auth, acct_id, tlid, popup) {
var templete = ''; var templete = '';
var datetype = localStorage.getItem("datetype"); var datetype = localStorage.getItem("datetype");
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function(key) {
@ -320,6 +320,13 @@ function userparse(obj, auth, acct_id, notf) {
}else{ }else{
var notftext=""; var notftext="";
} }
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
Materialize.toast(toot.display_name+"にフォローされました", popup * 1000);
$(".notf-icon_" + tlid).addClass("red-text");
localStorage.setItem("notice-mem", noticetext);
noticetext = "";
}
templete = templete + templete = templete +
'<div class="" style="padding-top:5px;" user-id="' + toot.id + '">' + '<div class="" style="padding-top:5px;" user-id="' + toot.id + '">' +
notftext + notftext +

View File

@ -43,3 +43,17 @@ function zoomBox() {
} }
} }
//コード受信
if(location.search){
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
var mode=m[1];
var codex=m[2];
if(mode=="share"){
console.log(codex);
$('textarea').focus();
$("#textarea").val(decodeURI(codex));
show();
$("body").removeClass("mini-post");
$(".mini-btn").text("expand_less");
}
}

View File

@ -2,7 +2,7 @@
localStorage.removeItem("history"); localStorage.removeItem("history");
//コード受信 //コード受信
if(location.search){ if(location.search){
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=([a-zA-Z-0-9]+)/); var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
var mode=m[1]; var mode=m[1];
var codex=m[2]; var codex=m[2];
if(mode=="user"){ if(mode=="user"){

View File

@ -47,7 +47,7 @@ function createWindow() {
var code=m[2]; var code=m[2];
mainWindow.loadURL('file://' + __dirname + '/index.html?mode='+mode+'&code='+code); mainWindow.loadURL('file://' + __dirname + '/index.html?mode='+mode+'&code='+code);
}else{ }else{
//mainWindow.loadURL('file://' + __dirname + '/index.html?mode=A&code=B'); //mainWindow.loadURL('file://' + __dirname + '/index.html?mode=share&code=日本語');
mainWindow.loadURL('file://' + __dirname + '/index.html'); mainWindow.loadURL('file://' + __dirname + '/index.html');
} }
}else{ }else{

View File

@ -1,6 +1,6 @@
{ {
"name": "TheDesk", "name": "TheDesk",
"version": "12.7.0", "version": "12.8.0",
"description": "TheDesk on Mastodonはシンプルと多機能を両立したデスクトップ向けクライアントです", "description": "TheDesk on Mastodonはシンプルと多機能を両立したデスクトップ向けクライアントです",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@ -1 +1 @@
{"desk":"Riina (ver.7)","date":"2018-02-25","detail":"内部V:12.7.0|バグ修正。デザイン微修正。詳しくはGitHub参照"} {"desk":"Riina (ver.8)","date":"2018-02-25","detail":"内部V:12.8.0|バグ修正。プラットフォーム追加。詳しくはGitHub参照"}