Skip to content

Commit

Permalink
1.1.2 (2019/05/02-1)
Browse files Browse the repository at this point in the history
uploaded at 2019/05/02 17:51
  • Loading branch information
nishlumi committed May 2, 2019
1 parent 9d62045 commit 9a7bfb3
Show file tree
Hide file tree
Showing 63 changed files with 4,321 additions and 228 deletions.
13 changes: 13 additions & 0 deletions CHANGES.md
@@ -1,5 +1,18 @@
# Updates

## G+DON-1102-20190502-01
Fix:
* Pleromaインスタンスのユーザーだとユーザーページが正常に取得できないのを修正。
* マストドンのstatuses/:id/cardにデータがない場合に取得するリンク先情報が、正常に取得できない場合があるのを修正。
* トゥート単独のURLに改めてアクセスしたときに、表示できなくなっていたのを修正。
* サーバー画面でPleromaインスタンスの場合、正常に取得できなかったのを修正。
* 未ログインの状態でトゥートを開いてもお気に入り・ブーストボタンが押せてしまうのを修正。

Update/New
* メディアの表示で拡大表示にちゃんとしたライブラリを使用して閲覧・操作性アップ。
* 「このスレッドの全メディアファイルを表示する」ボタンを追加。
* アカウントページの「告知可能なURLをコピー」にマストドンオリジナルのURL、QRコード表示機能を追加。

## G+DON-1101-20190427-01
Fix:
* ユーザーのポップアップカードがマウスカーソルが外れたにもかかわらず残ってしまう場合があったのを修正。
Expand Down
39 changes: 31 additions & 8 deletions apps/cls_mstdn.js
Expand Up @@ -148,18 +148,41 @@ var cls_mstdn = {
console.log("result2=",result2);
var sta = result2.data[0];

var realuri = sta.url.replace(`/@${idname}`, "/api/v1/statuses");
return api.originalGet(realuri, {
api : {},
app : {
copy_userid : result2.options.app.copyuser.id,
copy_instance : result2.options.app.copyuser.instance
var realuri = "";
var stindex = sta.url.indexOf("/objects/");
var options = {
api: {},
app: {
copy_userid: result2.options.app.copyuser.id,
copy_instance: result2.options.app.copyuser.instance
}
});
};
if (stindex === -1) {
realuri = sta.url.replace(`/@${idname}`, "/api/v1/statuses");
options.app["searchapi"] = false;
} else {
realuri = sta.url.substr(0, stindex) + `/api/v1/accounts/search?q=${idname}`;
options.app["searchapi"] = true;
}
return api.originalGet(realuri, options);
})
.then(result3 => {
console.log("result3=",result3);
console.log("result3=", result3);
var tuser = null;
var tt = JSON.parse(result3.data);

//---case of Pleroma
if (result3.options.app.searchapi) {
var userarr = tt;
for (var i = 0; i < userarr.length; i++) {
if (userarr[i].username == idname) {
if (userarr[i].url.indexOf(instance) > -1) {
tt["account"] = userarr[i];
}
}
}
}

tt.account["instance"] = instance;
tt.account["copy"] = {
id : tt.account.id,
Expand Down
10 changes: 5 additions & 5 deletions apps/res_langs.js

Large diffs are not rendered by default.

78 changes: 52 additions & 26 deletions apps/ucommon.js
Expand Up @@ -104,42 +104,68 @@ async function loadWebsiteOGP(request, info, url) {
if (CON_ACCEPT_HOSTS.indexOf(tmpurl.hostname) > -1) {
//---when in this app site
var arr = tmpurl.pathname.split("/");
var instance = arr[2];
var id = arr[3];
var instance = "";
var id = "";
if (arr.length >= 3) {
instance = arr[2];
id = arr[3];
}
if (arr[1] == "users") {

var api = cls_mstdn.loadAPImaster();
cls_mstdn.getUser(api, instance, id)
.then(result => {
//console.log(result);
//---set up og:
var oginfo = { //---default value
title: appEffectiveName,
type: "website",
description: "",
url: "https://gplusdon.net",
image: "https://gplusdon.net/static/images/gp_og_image.png",
site_name: appEffectiveName
};
if ((result) && ("id" in result)) {
var name = (result.display_name.trim() == "" ? result.username : result.display_name);
oginfo.title = ucommon._T(info.realtrans, "lab_profile", [`${name}@${result.instance}`]);
oginfo.description = result.text;
oginfo.type = "profile";
oginfo.url = `https://${request.hostname}/users/${instance}/${id}`;
oginfo.image = result.avatar;
}
var HTML_FOR_OGP = `
.then(result => {
//console.log(result);
//---set up og:
var oginfo = { //---default value
title: appEffectiveName,
type: "website",
description: "",
url: "https://gplusdon.net",
image: "https://gplusdon.net/static/images/gp_og_image.png",
site_name: appEffectiveName
};
if ((result) && ("id" in result)) {
var name = (result.display_name.trim() == "" ? result.username : result.display_name);
oginfo.title = ucommon._T(info.realtrans, "lab_profile", [`${name}@${result.instance}`]);
oginfo.description = result.text;
oginfo.type = "profile";
oginfo.url = `https://${request.hostname}/users/${instance}/${id}`;
oginfo.image = result.avatar;

}
var HTML_FOR_OGP = `
<meta property="og:title" content="${oginfo.title}" />
<meta property="og:type" content="${oginfo.type}" />
<meta property="og:description" content="${oginfo.description}" />
<meta property="og:url" content="${oginfo.url}" />
<meta property="og:image" content="${oginfo.image}"/>
<meta property="og:site_name" content="${oginfo.site_name}" />
`;
resolve(HTML_FOR_OGP);
resolve(HTML_FOR_OGP);

});
} else {
var oginfo = { //---default value
title: appEffectiveName,
type: "website",
description: "",
url: "https://gplusdon.net",
image: "https://gplusdon.net/static/images/gp_og_image.png",
site_name: appEffectiveName
};

var HTML_FOR_OGP = `
<meta property="og:title" content="${oginfo.title}" />
<meta property="og:type" content="${oginfo.type}" />
<meta property="og:description" content="${oginfo.description}" />
<meta property="og:url" content="${oginfo.url}" />
<meta property="og:image" content="${oginfo.image}"/>
<meta property="og:site_name" content="${oginfo.site_name}" />
`;
resolve({
raw : oginfo,
html: HTML_FOR_OGP
});
}
} else {
Expand Down Expand Up @@ -169,7 +195,7 @@ async function loadWebsiteOGP(request, info, url) {
var ht = (info.innerHTML);
resolve({
raw: body,
html: ht
html: sanhtml(ht)
});

} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "gplusdon",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"engines": {
"node": ">=10.0.0"
Expand Down
2 changes: 1 addition & 1 deletion pwabuilder-sw.js
@@ -1,6 +1,6 @@
//This is the service worker with the Cache-first network

var CACHE = "G+Don-1101-20190427-01";
var CACHE = "G+Don-1102-20190502-01";
var precacheFiles = [
/* Add an array of files to precache for your app */
"/",
Expand Down
61 changes: 61 additions & 0 deletions routes/accounts.js
@@ -1,6 +1,8 @@
'use strict';
var express = require('express');
var ucommon = require('../apps/ucommon');
var cls_mstdn = require("../apps/cls_mstdn");

var router = express.Router();

var menuStatus = {
Expand Down Expand Up @@ -45,4 +47,63 @@ router.get('/:instance/:id', function (req, res) {
uid : req.params.id
});
});
router.get('/:instance/:id/toots/:tootid', function (req, res) {
//if (req.params.tootid == ucommon.swjs) return;
//var lan = req.acceptsLanguages();
//var trans = ucommon.load_translation(req,lan);
var info = ucommon.analyze_locale(req);
var api = cls_mstdn.loadAPImaster(req.params.instance);

var userdata = {};
var pro = [];
var opt = {
api: {},
app: {}
};
var targeturl = `https://${req.params.instance}/api/v1/statuses/${req.params.tootid}`;
pro.push(api.originalGet(targeturl, opt));

targeturl = `https://${req.params.instance}/api/v1/statuses/${req.params.tootid}/context`;
pro.push(api.originalGet(targeturl, opt));

Promise.all(pro)
.then(result => {
var fnldata = {
toot: result[0],
context: result[1]
};
res.render('appaccount', {
sysinfo: info.sysinfo,
lang: info.lang,
transjs: info.trans,
trans: info.realtrans,
instance: req.params.instance,
uid: req.params.id,
page: "home",
onetoote: JSON.stringify(fnldata),
userdata: JSON.stringify(userdata),
csrfToken: req.csrfToken(),
menustat: menuStatus
});
})
.catch(error => {
var fnldata = {
toot: {},
context: {}
};
res.render('appaccount', {
sysinfo: info.sysinfo,
lang: info.lang,
transjs: info.trans,
trans: info.realtrans,
instance: req.params.instance,
uid: req.params.id,
page: "home",
onetoote: JSON.stringify(fnldata),
userdata: JSON.stringify(userdata),
csrfToken: req.csrfToken(),
menustat: menuStatus
});
});
});
module.exports = router;
2 changes: 1 addition & 1 deletion routes/index.js
Expand Up @@ -163,7 +163,7 @@ router.post('/srv/ogp', function (req, res) {
var text = ucommon.load_website_ogp(req, info, req.body["url"]);
text.then(result => {
//console.log("text=", result);
res.send(result);
res.send(JSON.stringify(result));
})
.catch(error=>{
res.send(error);
Expand Down
6 changes: 6 additions & 0 deletions routes/users.js
Expand Up @@ -71,6 +71,8 @@ router.get('/:instance/:id', function (req, res) {
var realid = "";
if ("_gp_logined" in req.cookies) {
userdata = {};
//realid = result.id;
//userdata = result;
} else {
realid = result.id;
userdata = result;
Expand Down Expand Up @@ -130,12 +132,16 @@ router.get('/:instance/:id/toots/:tootid', function (req, res) {
targeturl = `https://${req.params.instance}/api/v1/statuses/${req.params.tootid}/context`;
pro.push(api.originalGet(targeturl, opt));

pro.push(cls_mstdn.getUser(api, req.params.instance, req.params.id));

Promise.all(pro)
.then(result => {
var fnldata = {
toot: result[0],
context: result[1]
};
userdata = result[2];

res.render('appuser', {
sysinfo: info.sysinfo,
lang: info.lang,
Expand Down
14 changes: 13 additions & 1 deletion static/css/toot-timeline.css
Expand Up @@ -545,7 +545,7 @@ img.portrait, .carousel .carousel-item img.portrait, .modal-content img.portrait
video.portrait, .carousel .carousel-item video.portrait, .modal-content video.portrait,
.tootgallery-carousel img.portrait, .tootgallery-carousel video.portrait,
.v-image.img.portrait {
/*width : auto;*/
width : auto;
height : 100%;
margin : auto;
z-index : 9;
Expand All @@ -559,6 +559,14 @@ video.portrait, .carousel .carousel-item video.portrait, .modal-content video.po
text-shadow: 2px 2px 2px #696969;
z-index : 10;
}
.image-popup-btn-lt {
position : fixed;
top : 1rem;
left : 1rem;
color : #BABABA;
text-shadow: 2px 2px 2px #696969;
z-index : 10;
}
.tootgallery-carousel .slick-list .draggable {
height : auto !important;
}
Expand All @@ -574,6 +582,10 @@ video.portrait, .carousel .carousel-item video.portrait, .modal-content video.po
.media_borderset_forgrid {
border-radius: 1.5rem;
}
span.lg-usercaption-avatarname {
display : inline-block;
vertical-align: top;
}

/*=== toot action ===*/
.toot_card_base .toot_content_action {
Expand Down

0 comments on commit 9a7bfb3

Please sign in to comment.