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
[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
## For Vanilla Instances
WindowsクライアントTheDesk Riina (ver.6)リリース
WindowsクライアントTheDesk Riina (ver.8)リリース
・バグ修正
トゥート自動折りたたみ機能他
・デザイン微修正
・プラットフォーム追加(サポート外となります)
https://thedesk.top

View File

@ -30,6 +30,8 @@
<input type="text" id="url" style="width:70%" placeholder="mstdn.jp">
<div id="ins-suggest"></div>
<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>
<div id="support"></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/modal.js"></script>
<script>
var ver="Riina (ver.7)";
//トゥートリンク追加
var ver="Riina (ver.8)";
//betaを入れるとバージョンチェックしない
//var ver="beta";
var acct_id=0;
@ -37,7 +38,8 @@ var tlid=0;
<input type="text" id="url" style="width:70%" placeholder="mstdn.jp">
<div id="ins-suggest"></div>
<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>
<div id="support">
</div>

View File

@ -8,7 +8,7 @@ function ck() {
var at = localStorage.getItem(domain + "_at");
//コード受信
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 codex=m[2];
if(mode=="manager" || mode=="login"){
@ -32,6 +32,12 @@ function ck() {
ck();
//ログインポップアップ
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";
fetch(start, {
method: 'POST',
@ -41,7 +47,7 @@ function login(url) {
body: JSON.stringify({
scopes: 'read write follow',
client_name: "TheDesk(PC)",
redirect_uris: 'thedesk://login',
redirect_uris: red,
website: "https://thedesk.top"
})
}).then(function(response) {
@ -78,6 +84,8 @@ function instance() {
//コードを入れた後認証
function code(code,mode) {
var red = localStorage.getItem("redirect");
localStorage.removeItem("redirect")
if(!code){
var code = $("#code").val();
}
@ -96,7 +104,7 @@ function code(code,mode) {
},
body: JSON.stringify({
grant_type: "authorization_code",
redirect_uri: "thedesk://"+mode,
redirect_uri: red,
client_id: id,
client_secret: secret,
code: code

View File

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

View File

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

View File

@ -18,7 +18,16 @@ function notf(acct_id, tlid, sys) {
todo(error);
console.error(error);
}).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") {
$("#timeline_" + tlid).html(templete);
} else {
@ -51,7 +60,11 @@ function notf(acct_id, tlid, sys) {
if (!popup) {
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];
console.log(templete);
if (sys == "direct") {

View File

@ -51,7 +51,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
var notice = noticetext;
var memory = localStorage.getItem("notice-mem");
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");
localStorage.setItem("notice-mem", noticetext);
noticetext = "";
@ -96,7 +96,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
var spoiler = "cw cw_hide_" + toot.id;
var api_spoil = "gray";
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
'\')" class="nex parsed">見る</a>';
'\')" class="nex parsed">見る</a><br>';
} else {
var ct = toot.content.split('</p>').length + toot.content.split('<br />').length -
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 datetype = localStorage.getItem("datetype");
Object.keys(obj).forEach(function(key) {
@ -320,6 +320,13 @@ function userparse(obj, auth, acct_id, notf) {
}else{
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 +
'<div class="" style="padding-top:5px;" user-id="' + toot.id + '">' +
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");
//コード受信
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 codex=m[2];
if(mode=="user"){

View File

@ -47,7 +47,7 @@ function createWindow() {
var code=m[2];
mainWindow.loadURL('file://' + __dirname + '/index.html?mode='+mode+'&code='+code);
}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');
}
}else{

View File

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