Introduce BlurHash,repair YouPlay,improve link previews feature,add debug mode,add lighttpd example config,bug fixes
This commit is contained in:
parent
9aa173a786
commit
c9bc7ecb30
|
@ -27,6 +27,7 @@ We moved our instances list to our webpage: https://www.halcyon.social/instances
|
|||
or read our new documentation pages to install it manually: https://www.halcyon.social/documentation.php?page=install
|
||||
|
||||
## Blog
|
||||
- Release of Version 2.3.4 - Introduce BlurHash,repair YouPlay,improve link previews feature,add debug mode,add lighttpd example config,bug fixes
|
||||
- Release of Version 2.3.3 - New media uploader,sort uploads,drag&drop and copy&paste uploads,fix automatic dark mode
|
||||
- Release of Version 2.3.2 - Add block and mute management,add management for follow requests,add Catalan translation
|
||||
- Release of Version 2.3.1 - Fix duplicated thread,allow adding more toots as reply chain,add Dutch translation,more bugfixes,improved translations.
|
||||
|
|
|
@ -577,6 +577,9 @@ border-top: 1px solid #E1E8ED;
|
|||
.single_reply_status .status_preview .toot_entry .toot_footer,.report_stauts .status_preview .toot_entry .toot_footer {
|
||||
display: none!important;
|
||||
}
|
||||
.single_reply_status .status_preview .toot_entry .link_preview,.report_stauts .status_preview .toot_entry .link_preview {
|
||||
display: none!important;
|
||||
}
|
||||
.single_reply_status .status_form .status_bottom,.report_status .status_form .status_bottom {
|
||||
width: 100%;
|
||||
margin-left: 0;
|
||||
|
@ -993,6 +996,9 @@ position: absolute;
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #000;
|
||||
background-size:cover;
|
||||
background-position:center;
|
||||
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
|
||||
}
|
||||
.media_views.sensitive .sensitive_alart .text1 {
|
||||
font-size: 26px;
|
||||
|
|
|
@ -64,6 +64,7 @@ getDropDown().removeClass('showDropDown').addClass('hideDropDown');
|
|||
if(resultname) {
|
||||
if(resultname == "acct") {
|
||||
if(ele.display_name == "") ele.display_name = ele.username;
|
||||
ele.display_name = htmlEscape(ele.display_name);
|
||||
for(var i=0;i<ele.emojis.length;i++) {
|
||||
ele.display_name = ele.display_name.replace(new RegExp(":"+ele.emojis[i].shortcode+":","g"),"<img src='"+ele.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
(function($) {
|
||||
var digitCharacters = [
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
||||
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
|
||||
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
|
||||
"U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d",
|
||||
"e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
|
||||
"o", "p", "q", "r", "s", "t", "u", "v", "w", "x",
|
||||
"y", "z", "#", "$", "%", "*", "+", ",", "-", ".",
|
||||
":", ";", "=", "?", "@", "[", "]", "^", "_", "{",
|
||||
"|", "}", "~",
|
||||
];
|
||||
function decode83(str) {
|
||||
var value = 0;
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var c = str[i];
|
||||
var digit = digitCharacters.indexOf(c);
|
||||
value = value * 83 + digit;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function sRGBToLinear(value) {
|
||||
var v = value / 255;
|
||||
if (v <= 0.04045) {
|
||||
return v / 12.92;
|
||||
}
|
||||
else {
|
||||
return Math.pow((v + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
}
|
||||
function linearTosRGB(value) {
|
||||
var v = Math.max(0, Math.min(1, value));
|
||||
if (v <= 0.0031308) {
|
||||
return Math.round(v * 12.92 * 255 + 0.5);
|
||||
}
|
||||
else {
|
||||
return Math.round((1.055 * Math.pow(v, 1 / 2.4) - 0.055) * 255 + 0.5);
|
||||
}
|
||||
}
|
||||
function sign(n) {
|
||||
return (n < 0 ? -1 : 1);
|
||||
}
|
||||
function signPow(val, exp) {
|
||||
return sign(val) * Math.pow(Math.abs(val), exp);
|
||||
}
|
||||
function decodeDC(value) {
|
||||
var intR = value >> 16;
|
||||
var intG = (value >> 8) & 255;
|
||||
var intB = value & 255;
|
||||
return [sRGBToLinear(intR), sRGBToLinear(intG), sRGBToLinear(intB)];
|
||||
}
|
||||
function decodeAC(value, maximumValue) {
|
||||
var quantR = Math.floor(value / (19 * 19));
|
||||
var quantG = Math.floor(value / 19) % 19;
|
||||
var quantB = value % 19;
|
||||
var rgb = [
|
||||
signPow((quantR - 9) / 9, 2.0) * maximumValue,
|
||||
signPow((quantG - 9) / 9, 2.0) * maximumValue,
|
||||
signPow((quantB - 9) / 9, 2.0) * maximumValue,
|
||||
];
|
||||
return rgb;
|
||||
}
|
||||
$.decode = function(blurhash,width,height,punch) {
|
||||
punch = punch | 1;
|
||||
if (blurhash.length < 6) {
|
||||
console.error('too short blurhash');
|
||||
return null;
|
||||
}
|
||||
var sizeFlag = decode83(blurhash[0]);
|
||||
var numY = Math.floor(sizeFlag / 9) + 1;
|
||||
var numX = (sizeFlag % 9) + 1;
|
||||
var quantisedMaximumValue = decode83(blurhash[1]);
|
||||
var maximumValue = (quantisedMaximumValue + 1) / 166;
|
||||
if (blurhash.length !== 4 + 2 * numX * numY) {
|
||||
console.error('blurhash length mismatch', blurhash.length, 4 + 2 * numX * numY);
|
||||
return null;
|
||||
}
|
||||
var colors = new Array(numX * numY);
|
||||
for (var i = 0; i < colors.length; i++) {
|
||||
if (i === 0) {
|
||||
var value = decode83(blurhash.substring(2, 6));
|
||||
colors[i] = decodeDC(value);
|
||||
}
|
||||
else {
|
||||
var value = decode83(blurhash.substring(4 + i * 2, 6 + i * 2));
|
||||
colors[i] = decodeAC(value, maximumValue * punch);
|
||||
}
|
||||
}
|
||||
var bytesPerRow = width * 4;
|
||||
var pixels = new Uint8ClampedArray(bytesPerRow * height);
|
||||
for (var y = 0; y < height; y++) {
|
||||
for (var x = 0; x < width; x++) {
|
||||
var r = 0;
|
||||
var g = 0;
|
||||
var b = 0;
|
||||
for (var j = 0; j < numY; j++) {
|
||||
for (var i = 0; i < numX; i++) {
|
||||
var basis = Math.cos(Math.PI * x * i / width) * Math.cos(Math.PI * y * j / height);
|
||||
var color = colors[i + j * numX];
|
||||
r += color[0] * basis;
|
||||
g += color[1] * basis;
|
||||
b += color[2] * basis;
|
||||
}
|
||||
}
|
||||
var intR = linearTosRGB(r);
|
||||
var intG = linearTosRGB(g);
|
||||
var intB = linearTosRGB(b);
|
||||
pixels[4 * x + 0 + y * bytesPerRow] = intR;
|
||||
pixels[4 * x + 1 + y * bytesPerRow] = intG;
|
||||
pixels[4 * x + 2 + y * bytesPerRow] = intB;
|
||||
pixels[4 * x + 3 + y * bytesPerRow] = 255;
|
||||
}
|
||||
}
|
||||
return pixels;
|
||||
}
|
||||
})(jQuery);
|
||||
function getBlurImage(hash) {
|
||||
const pixels = $.decode(hash,32,32);
|
||||
if(pixels) {
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.height = 32;
|
||||
canvas.width = 32;
|
||||
const ctx = canvas.getContext('2d');
|
||||
const imagedata = new ImageData(pixels,32,32);
|
||||
ctx.putImageData(imagedata,0,0);
|
||||
return canvas.toDataURL();
|
||||
}
|
||||
else return false;
|
||||
}
|
|
@ -119,71 +119,6 @@ else if(ytbe) embedMedia("youtube",$(this).closest(".toot_article"),ytbe[2]);
|
|||
else if(htbe) embedMedia("youtube",$(this).closest(".toot_article"),htbe[2]);
|
||||
else if(vimeo) embedMedia("vimeo",$(this).closest(".toot_article"),vimeo[2]);
|
||||
else if(peertube) embedMedia("peertube",$(this).closest(".toot_article"),peertube[0].replace("/watch/","/embed/"));
|
||||
else if(localStorage.setting_link_previews == "true") {
|
||||
if(!window.cards) {
|
||||
cards = new Array();
|
||||
}
|
||||
if(!$(this).attr("class") && $(this).parent().parent().parent().parent().parent().attr("sid") != undefined) {
|
||||
if(!cards[$(this).parent().parent().parent().parent().parent().attr("sid")]) {
|
||||
var this_id = $(this).parent().parent().parent().parent().parent().attr("sid");
|
||||
api.get("statuses/"+$(this).parent().parent().parent().parent().parent().attr("sid")+"/card",function(data) {
|
||||
cards[this_id] = data;
|
||||
if($(".toot_entry[sid="+this_id+"]").children().children("section").children("article").children(".link_preview").length == 0 && data.url) {
|
||||
$(".toot_entry[sid="+this_id+"]").children().children("section").children("article").append(
|
||||
$("<div>").addClass("media_views").addClass("link_preview").attr("sid",this_id).attr("media_length",1).css("height","unset").data("url",data.url).append(
|
||||
$("<img>").attr("src",data.image).width(data.width).css("max-width","200px").css("float","left").css("margin-right","5px")).append(
|
||||
$("<strong>").text(data.title)).append($("<br>")).append(
|
||||
$("<span>").text(data.description)).append($("<br>")).append(
|
||||
$("<span>").css("color","#777777").text(data.url)).click(function(e) {
|
||||
e.stopPropagation();
|
||||
window.open($(this).data("url"),"_blank");
|
||||
})
|
||||
);
|
||||
}
|
||||
if($(".main_status[sid="+this_id+"]").children().children("section").children("article").children(".link_preview").length == 0 && data.url) {
|
||||
$(".main_status[sid="+this_id+"]").children().children("section").children("article").append(
|
||||
$("<div>").addClass("media_views").addClass("link_preview").attr("sid",this_id).attr("media_length",1).css("height","unset").data("url",data.url).append(
|
||||
$("<img>").attr("src",data.image).width(data.width).css("max-width","200px").css("float","left").css("margin-right","5px")).append(
|
||||
$("<strong>").text(data.title)).append($("<br>")).append(
|
||||
$("<span>").text(data.description)).append($("<br>")).append(
|
||||
$("<span>").css("color","#777777").text(data.url)).click(function(e) {
|
||||
e.stopPropagation();
|
||||
window.open($(this).data("url"),"_blank");
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
var this_id = $(this).parent().parent().parent().parent().parent().attr("sid");
|
||||
data = cards[this_id];
|
||||
if($(".toot_entry[sid="+this_id+"]").children().children("section").children("article").children(".link_preview").length == 0 && data.url) {
|
||||
$(".toot_entry[sid="+this_id+"]").children().children("section").children("article").append(
|
||||
$("<div>").addClass("media_views").addClass("link_preview").attr("sid",this_id).attr("media_length",1).css("height","unset").data("url",data.url).append(
|
||||
$("<img>").attr("src",data.image).width(data.width).css("max-width","200px").css("float","left").css("margin-right","5px")).append(
|
||||
$("<strong>").text(data.title)).append($("<br>")).append(
|
||||
$("<span>").text(data.description)).append($("<br>")).append(
|
||||
$("<span>").css("color","#777777").text(data.url)).click(function(e) {
|
||||
e.stopPropagation();
|
||||
window.open($(this).data("url"),"_blank");
|
||||
})
|
||||
);
|
||||
}
|
||||
if($(".main_status[sid="+this_id+"]").children().children("section").children("article").children(".link_preview").length == 0 && data.url) {
|
||||
$(".main_status[sid="+this_id+"]").children().children("section").children("article").append(
|
||||
$("<div>").addClass("media_views").addClass("link_preview").attr("sid",this_id).attr("media_length",1).css("height","unset").data("url",data.url).append(
|
||||
$("<img>").attr("src",data.image).width(data.width).css("max-width","200px").css("float","left").css("margin-right","5px")).append(
|
||||
$("<strong>").text(data.title)).append($("<br>")).append(
|
||||
$("<span>").text(data.description)).append($("<br>")).append(
|
||||
$("<span>").css("color","#777777").text(data.url)).click(function(e) {
|
||||
e.stopPropagation();
|
||||
window.open($(this).data("url"),"_blank");
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function getConversionedDate(key, value) {
|
||||
|
|
|
@ -2,6 +2,7 @@ function mediaattachments_template(status) {
|
|||
let media_views = "";
|
||||
var border = "";
|
||||
var mvfullheight = "";
|
||||
var blurbackground = "";
|
||||
var dsplength = status.media_attachments.length;
|
||||
if(status.media_attachments[0].remote_url != null) {
|
||||
status.media_attachments[0].url = status.media_attachments[0].remote_url;
|
||||
|
@ -18,8 +19,9 @@ else if(!status.sensitive || localStorage.setting_show_nsfw == "true") {
|
|||
media_views = `<div class='media_views${mvfullheight}' sid="${status.id}" media_length='${dsplength}'${border}>`;
|
||||
}
|
||||
else {
|
||||
if(status.media_attachments[0].blurhash) blurbackground = 'style="background-image:url('+getBlurImage(status.media_attachments[0].blurhash)+')"';
|
||||
media_views = `<div class='media_views sensitive${mvfullheight}' media_length='${dsplength}'${border}>
|
||||
<div class='sensitive_alart'>
|
||||
<div class='sensitive_alart'${blurbackground}>
|
||||
<span class="text1">${__('Sensitive content')}</span>
|
||||
<span class="text2">${__('Click to view')}</span>
|
||||
</div>`;
|
||||
|
@ -82,6 +84,27 @@ media_views += "</div>";
|
|||
}
|
||||
return media_views;
|
||||
}
|
||||
function link_preview_template(card) {
|
||||
if(localStorage.setting_link_previews == "true") {
|
||||
const ytcom = card.url.match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
|
||||
const htcom = card.url.match(/https?:\/\/(www\.)?hooktube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
|
||||
const ivcom = card.url.match(/https?:\/\/(www\.)?invidio\.us\/watch\?v=([a-zA-Z\d_-]+)/);
|
||||
const ytbe = card.url.match(/https?:\/\/(www\.)?youtu\.be\/([a-zA-Z\d_-]+)/);
|
||||
const htbe = card.url.match(/https?:\/\/(www\.)?hooktube\.com\/([a-zA-Z\d_-]+)/);
|
||||
const vimeo = card.url.match(/https?:\/\/(www\.)?vimeo\.com\/([\d]+)/);
|
||||
const peertube = card.url.match(/https?:\/\/.+..+\/videos\/watch\/([\da-z]{8}-[\da-z]{4}-[\da-z]{4}-[\da-z]{4}-[\da-z]{12})\/?$/);
|
||||
if(((!ytcom && !htcom && !ivcom && !ytbe && !htbe) || (localStorage.setting_play_youplay == "false" && localStorage.setting_play_invidious == "false")) && (!vimeo || localStorage.setting_play_vimeo) && (!peertube || localStorage.setting_play_peertube)) {
|
||||
let preview_html = (`<div class="media_views link_preview" media_length="1" style="height:unset" data-url="${card.url}">
|
||||
<img src="${card.image}" style="width:${card.width};max-width:200px;float:left;margin-right:5px">
|
||||
<strong>${card.title}</strong><br/>
|
||||
<span>${card.description}</span><br/>
|
||||
<span style="color:#777777">${card.url}</span>`);
|
||||
return preview_html;
|
||||
}
|
||||
else return "";
|
||||
}
|
||||
else return "";
|
||||
}
|
||||
function poll_template(poll) {
|
||||
let poll_html = "";
|
||||
var expires_at = new Date(new Date(poll.expires_at).getTime()-Date.now());
|
||||
|
@ -159,6 +182,7 @@ toot_reblogs_count= "",
|
|||
toot_favourites_count = "",
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
preview_object = "";
|
||||
if(status.spoiler_text && localStorage.setting_show_content_warning == "false") {
|
||||
alart_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW MORE')+"</button>",
|
||||
article_option = "content_warning";
|
||||
|
@ -181,6 +205,9 @@ media_views = mediaattachments_template(status);
|
|||
if(status.poll) {
|
||||
poll_object = poll_template(status.poll);
|
||||
}
|
||||
if(status.card) {
|
||||
preview_object = link_preview_template(status.card);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -263,6 +290,7 @@ ${alart_text}
|
|||
<span class="status_content emoji_poss">
|
||||
${status.content}
|
||||
</span>
|
||||
${preview_object}
|
||||
</article>
|
||||
<footer class="toot_footer"${toot_footer_width}>
|
||||
<div class="toot_reaction">
|
||||
|
@ -326,6 +354,7 @@ toot_reblogs_count= "",
|
|||
toot_favourites_count = "",
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
preview_object = "";
|
||||
if(status.reblog.spoiler_text && localStorage.setting_show_content_warning == "false") {
|
||||
alart_text = "<span>"+status.reblog.spoiler_text+"</span><button class='cw_button'>"+__('SHOW MORE')+"</button>",
|
||||
article_option = "content_warning";
|
||||
|
@ -348,6 +377,9 @@ media_views = mediaattachments_template(status.reblog);
|
|||
if(status.reblog.poll) {
|
||||
poll_object = poll_template(status.reblog.poll);
|
||||
}
|
||||
if(status.reblog.card) {
|
||||
preview_object = link_preview_template(status.reblog.card);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -423,6 +455,7 @@ ${alart_text}
|
|||
<span class="status_content emoji_poss">
|
||||
${status.reblog.content}
|
||||
</span>
|
||||
${preview_object}
|
||||
</article>
|
||||
<footer class="toot_footer" style="width:320px">
|
||||
<div class="toot_reaction">
|
||||
|
@ -487,6 +520,7 @@ toot_reblogs_count= "",
|
|||
toot_favourites_count = "",
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
preview_object = "";
|
||||
if(status.spoiler_text && localStorage.setting_show_content_warning == "false") {
|
||||
alart_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW MORE')+"</button>",
|
||||
article_option = "content_warning";
|
||||
|
@ -509,6 +543,9 @@ media_views = mediaattachments_template(status);
|
|||
if(status.poll) {
|
||||
poll_object = poll_template(status.poll);
|
||||
}
|
||||
if(status.card) {
|
||||
preview_object = link_preview_template(status.card);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -574,6 +611,7 @@ ${alart_text}
|
|||
<span class="status_content emoji_poss">
|
||||
${status.content}
|
||||
</span>
|
||||
${preview_object}
|
||||
</article>
|
||||
<footer class="toot_footer" style="width:320px">
|
||||
<div class="toot_reaction">
|
||||
|
@ -739,6 +777,7 @@ toot_reblogs_count= "",
|
|||
toot_favourites_count = "",
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
preview_object = "";
|
||||
for(i=0;i<NotificationObj.status.emojis.length;i++) {
|
||||
NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp(":"+NotificationObj.status.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -778,6 +817,9 @@ media_views = mediaattachments_template(NotificationObj.status);
|
|||
if(NotificationObj.status.poll) {
|
||||
poll_object = poll_template(NotificationObj.status.poll);
|
||||
}
|
||||
if(NotificationObj.status.card) {
|
||||
preview_object = link_preview_template(NotificationObj.status.card);
|
||||
}
|
||||
if(NotificationObj.status.account.display_name.length == 0) {
|
||||
NotificationObj.status.account.display_name = NotificationObj.status.account.username;
|
||||
}
|
||||
|
@ -860,6 +902,7 @@ ${alart_text}
|
|||
<span class="status_content emoji_poss">
|
||||
${NotificationObj.status.content}
|
||||
</span>
|
||||
${preview_object}
|
||||
</article>
|
||||
<footer class="toot_footer"${toot_footer_width}>
|
||||
<div class="toot_reaction">
|
||||
|
@ -900,6 +943,7 @@ toot_reblogs_count= "",
|
|||
toot_favourites_count = "",
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
preview_object = "";
|
||||
for(i=0;i<NotificationObj.status.emojis.length;i++) {
|
||||
NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp(":"+NotificationObj.status.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -939,6 +983,9 @@ media_views = mediaattachments_template(NotificationObj.status);
|
|||
if(NotificationObj.status.poll) {
|
||||
poll_object = poll_template(NotificationObj.status.poll);
|
||||
}
|
||||
if(NotificationObj.status.card) {
|
||||
preview_object = link_preview_template(NotificationObj.status.card);
|
||||
}
|
||||
if(NotificationObj.status.account.display_name.length == 0) {
|
||||
NotificationObj.status.account.display_name = NotificationObj.status.account.username;
|
||||
}
|
||||
|
@ -1027,6 +1074,7 @@ ${alart_text}
|
|||
<span class="status_content emoji_poss">
|
||||
${NotificationObj.status.content}
|
||||
</span>
|
||||
${preview_object}
|
||||
</article>
|
||||
<footer class="toot_footer"${toot_footer_width}>
|
||||
<div class="toot_reaction">
|
||||
|
@ -1131,6 +1179,7 @@ toot_reblogs_count= "",
|
|||
toot_favourites_count = "",
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
preview_object = "";
|
||||
for(i=0;i<status.emojis.length;i++) {
|
||||
status.content = status.content.replace(new RegExp(":"+status.emojis[i].shortcode+":","g"),"<img src='"+status.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -1170,6 +1219,9 @@ media_views = mediaattachments_template(status);
|
|||
if(status.poll) {
|
||||
poll_object = poll_template(status.poll);
|
||||
}
|
||||
if(status.card) {
|
||||
preview_object = link_preview_template(status.card);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -1251,6 +1303,7 @@ ${alart_text}
|
|||
<span class="status_content emoji_poss">
|
||||
${status.content}
|
||||
</span>
|
||||
${preview_object}
|
||||
</article>
|
||||
<time datetime="${status_attr_datetime}">${status_datetime}</time>
|
||||
</section>
|
||||
|
@ -1390,6 +1443,7 @@ toot_reblogs_count= "",
|
|||
toot_favourites_count = "",
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
preview_object = "";
|
||||
for(i=0;i<status.reblog.emojis.length;i++) {
|
||||
status.reblog.content = status.reblog.content.replace(new RegExp(":"+status.reblog.emojis[i].shortcode+":","g"),"<img src='"+status.reblog.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -1433,6 +1487,9 @@ media_views = mediaattachments_template(status.reblog);
|
|||
if(status.reblog.poll) {
|
||||
poll_object = poll_template(status.reblog.poll);
|
||||
}
|
||||
if(status.reblog.card) {
|
||||
preview_object = link_preview_template(status.reblog.card);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -1500,6 +1557,7 @@ ${alart_text}
|
|||
<span class="status_content emoji_poss">
|
||||
${status.reblog.content}
|
||||
</span>
|
||||
${preview_object}
|
||||
</article>
|
||||
<time datetime="${status_attr_datetime}">${status_datetime}</time>
|
||||
</section>
|
||||
|
|
|
@ -1007,12 +1007,22 @@ replace_emoji();
|
|||
}
|
||||
function setRecentImages(mid) {
|
||||
api.get("accounts/"+mid+"/statuses", [{name:'only_media',data:'true'},{name:'limit',data:'6'}], function(statuses) {
|
||||
if ( statuses.length ) {
|
||||
if (statuses.length) {
|
||||
$('#js_profile_recent_images span').text(`${statuses[0].account.statuses_count} ${__('Photos and toots')}`);
|
||||
$('#js_profile_recent_images a').attr('href', $("#media_link").attr('href'));
|
||||
for ( i in statuses ) {
|
||||
$(`<div class="profile_recent_images_item media_attachment" otype="image" sid="${statuses[i].id}" url="${statuses[i].media_attachments[0].preview_url}">
|
||||
<img src="${statuses[i].media_attachments[0].preview_url}" />
|
||||
for (i in statuses) {
|
||||
if(statuses[i].sensitive) {
|
||||
if(statuses[i].media_attachments[0].blurhash) var imgurl = getBlurImage(statuses[i].media_attachments[0].blurhash);
|
||||
else var imgurl = "https://"+current_instance+"/avatars/original/missing.png";
|
||||
}
|
||||
else {
|
||||
if(statuses[i].media_attachments[0].remote_url != null) statuses[i].media_attachments[0].url = statuses[i].media_attachments[0].remote_url;
|
||||
if(statuses[i].media_attachments[0].type == "image") var imgurl = statuses[i].media_attachments[0].url;
|
||||
else if(statuses[i].media_attachments[0].type == "video" || statuses[i].media_attachments[0].type == "gifv") var imgurl = statuses[i].media_attachments[0].preview_url;
|
||||
else var imgurl = "https://"+current_instance+"/avatars/original/missing.png";
|
||||
}
|
||||
$(`<div class="profile_recent_images_item media_attachment" otype="image" sid="${statuses[i].id}" oid="${statuses[i].media_attachments[0].id}" url="${imgurl}" mediacount="0">
|
||||
<img src="${imgurl}">
|
||||
</div>`).appendTo('#js_profile_recent_images_box');
|
||||
};
|
||||
}
|
||||
|
@ -2009,6 +2019,10 @@ $(".poll_"+poll_id).remove();
|
|||
}
|
||||
return false;
|
||||
});
|
||||
$(document).on('click','.link_preview',function(e) {
|
||||
e.stopPropagation();
|
||||
window.open($(this).data("url"),"_blank");
|
||||
});
|
||||
$(document).on('focus','.status_textarea textarea,.status_top .status_spoiler',function(e) {
|
||||
global_focus_textfield = $(this).data("random");
|
||||
$(".status_textarea textarea").change();
|
||||
|
|
|
@ -4,6 +4,7 @@ api_client_name = Your application name
|
|||
api_client_website = https://example.com/
|
||||
who_to_follow_provider = https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-osa-api.cgi?{{host}}+{{user}}
|
||||
default_language = en_US
|
||||
debug_mode = false
|
||||
|
||||
; Media embed settings
|
||||
; YouPlay resolves YouTube MP4s on your server and sends this link to the user for privacy-friendly watching
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
include("language.php");
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
|
@ -33,6 +31,7 @@ document.write('<link rel="stylesheet" href="/assets/css/dark.css" media="all">'
|
|||
<script src="/assets/js/autocomplete/textarea.js"></script>
|
||||
<script src="/assets/js/shortcut.js"></script>
|
||||
<script src="/assets/js/replace_emoji.js"></script>
|
||||
<script src="/assets/js/blurhash.js"></script>
|
||||
<script src="/assets/js/emojipicker/emojidata.js"></script>
|
||||
<script src="/assets/js/emojipicker/emojipicker.js"></script>
|
||||
<script src="/assets/js/halcyon/halcyonTemplates.js"></script>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
$config = parse_ini_file(__DIR__.'/config/config.ini',true);
|
||||
if($config["App"]["debug_mode"]) {
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
}
|
||||
$locale = '';
|
||||
if(isset($_COOKIE['language'])) $locale = $_COOKIE['language'];
|
||||
else if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
server.port = 443
|
||||
server.username = "http"
|
||||
server.groupname = "http"
|
||||
server.document-root = "/srv/http"
|
||||
server.errorlog = "/var/log/lighttpd/error.log"
|
||||
server.modules = ( "mod_fastcgi", "mod_compress", "mod_rewrite", "mod_openssl" )
|
||||
dir-listing.activate = "disable"
|
||||
ssl.engine = "enable"
|
||||
ssl.pemfile = "/etc/lighttpd/halcyon.pem"
|
||||
index-file.names = ( "index.html", "index.php" )
|
||||
mimetype.assign = (
|
||||
".txt" => "text/plain",
|
||||
".html" => "text/html",
|
||||
".htm" => "text/html",
|
||||
".css" => "text/css",
|
||||
".js" => "application/x-javascript",
|
||||
".jpg" => "image/jpeg",
|
||||
".jpeg" => "image/jpeg",
|
||||
".gif" => "image/gif",
|
||||
".png" => "image/png",
|
||||
".svg" => "image/svg+xml",
|
||||
"" => "application/octet-stream"
|
||||
)
|
||||
fastcgi.server = ( ".php" => ((
|
||||
"bin-path" => "/usr/bin/php-cgi",
|
||||
"socket" => "/tmp/php.socket"
|
||||
)))
|
||||
compress.allowed-encodings = ("bzip2", "gzip", "deflate")
|
||||
compress.filetype = ("application/x-javascript", "application/javascript", "text/javascript", "text/x-js", "text/css", "text/html", "text/plain")
|
||||
$HTTP["host"] == "halcyon.example.com" {
|
||||
server.document-root = "/srv/http/halcyon"
|
||||
url.rewrite = (
|
||||
"^/home/?$" => "/",
|
||||
"^/login/?$" => "/login/login.php",
|
||||
"^/auth\/?(\?.*)/?$" => "/login/auth.php$1",
|
||||
"^/logout/?$" => "/login/logout.php",
|
||||
"^/terms/?$" => "/login/terms.php",
|
||||
"^/privacy/?$" => "/login/privacy.php",
|
||||
"^/imprint/?$" => "/login/imprint.php",
|
||||
"^/local/?$" => "/local.php",
|
||||
"^/federated/?$" => "/federated.php",
|
||||
"^/notifications/?$" => "/notifications.php",
|
||||
"^/whotofollow/?$" => "/who_to_follow.php",
|
||||
"^/direct/?$" => "/direct.php",
|
||||
"^/instance/?$" => "/instance.php",
|
||||
"^/lists/?$" => "/lists.php",
|
||||
"^/lists/(\d+)/?$" => "/lists_view.php?id=$1",
|
||||
"^/lists/(\d+)/add/?$" => "/lists_add.php?id=$1",
|
||||
"^/search\/?(\?.*)/?$" => "/search_hash_tag.php$1",
|
||||
"^/search/users\/?(\?.*)/?$" => "/search_user.php$1",
|
||||
"^/settings/?$" => "/settings_general.php",
|
||||
"^/settings/profile/?$" => "/settings_profile.php",
|
||||
"^/settings/appearance/?$" => "/settings_appearance.php",
|
||||
"^/settings/filters/?$" => "/settings_filters.php",
|
||||
"^/settings/media/?$" => "/settings_media.php",
|
||||
"^/settings/followers/?$" => "/settings_accounts.php",
|
||||
"^/settings/mutes/?$" => "/settings_accounts.php",
|
||||
"^/settings/blocks/?$" => "/settings_accounts.php",
|
||||
"^/@(.+)@(.+)\.([a-z]+)/status/(.+?)\/?\??(.*)/?$" => "/user.php?user=@$1@$2\.$3&status=$4&$5",
|
||||
"^/@(.+)@(.+)\.([a-z]+)/media\/?\??(.*)/?$" => "/user_only_media.php?user=@$1@$2\.$3&$4",
|
||||
"^/@(.+)@(.+)\.([a-z]+)/with_replies\/?\??(.*)/?$" => "/user_include_replies.php?user=@$1@$2\.$3&$4",
|
||||
"^/@(.+)@(.+)\.([a-z]+)/followers\/?\??(.*)/?$" => "/user_followers.php?user=@$1@$2\.$3&$4",
|
||||
"^/@(.+)@(.+)\.([a-z]+)/following\/?\??(.*)/?$" => "/user_following.php?user=@$1@$2\.$3&$4",
|
||||
"^/@(.+)@(.+)\.([a-z]+)/favourites\/?\??(.*)/?$" => "/user_favorite.php?user=@$1@$2\.$3&$4",
|
||||
"^/@(.+)@(.+)\.([a-z]+)\/?\??(.*)/?$" => "/user.php?user=@$1@$2\.$3&$4",
|
||||
"^/avatars/original/missing.png$" => "/assets/images/missing.png",
|
||||
"^/headers/original/missing.png$" => "/assets/images/missing_header.png",
|
||||
"^/404/?$" => "/404.php"
|
||||
)
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
include("../language.php");
|
||||
require_once('../authorize/mastodon.php');
|
||||
use HalcyonSuite\HalcyonForMastodon\Mastodon;
|
||||
if (isset($_POST['acct'])) {
|
||||
|
@ -20,7 +21,6 @@ die();
|
|||
}
|
||||
}
|
||||
}
|
||||
include("../language.php");
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
|
|
|
@ -106,7 +106,7 @@ $query = http_build_query(array(
|
|||
'authuser' => '1',
|
||||
'video_id' => $videoID,
|
||||
));
|
||||
if($this->is_Ok($videoData = $this->curlGet("http://www.youtube.com/get_video_info?{$query}"))) {
|
||||
if($this->is_Ok($videoData = $this->curlGet("https://www.youtube.com/get_video_info?{$query}"))) {
|
||||
parse_str($videoData, $videoData);
|
||||
break;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ $thumbdata = explode("#",$thumbparts[$thumbnum]);
|
|||
$vInfo['Title'] = $videoData['title'];
|
||||
$vInfo['ChannelName'] = $videoData['author'];
|
||||
$vInfo['ChannelId'] = $videoData['ucid'];
|
||||
$vInfo['Thumbnail'] = str_replace('default', 'maxresdefault', $videoData['thumbnail_url']);
|
||||
$vInfo['Thumbnail'] = $playerData->videoDetails->thumbnail->thumbnails[count($playerData->videoDetails->thumbnail->thumbnails)-1]->url;
|
||||
$vInfo['Duration'] = $videoData['length_seconds'];
|
||||
$vInfo['Rating'] = $playerData->videoDetails->averageRating;
|
||||
$vInfo['Captions'] = $captions;
|
||||
|
@ -183,7 +183,7 @@ protected function curlGet($url) {
|
|||
if(in_array('curl', get_loaded_extensions())){
|
||||
$appSettings = parse_ini_file('../config/config.ini',true);
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0');
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
//curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||
|
|
|
@ -1 +1 @@
|
|||
2.3.3
|
||||
2.3.4
|
||||
|
|
Loading…
Reference in New Issue