Fixed login with Pleroma,fixed compatibility with Pawoo (older Mastodon),added support for prefers-color-scheme,some more fixes

This commit is contained in:
nipos 2019-02-25 18:18:21 +01:00
parent 8619a1acbe
commit e75fac8cbe
14 changed files with 143 additions and 28 deletions

View File

@ -23,9 +23,11 @@ We moved our instances list to a wiki page: https://notabug.org/halcyon-suite/ha
## Install
[![Install Halcyon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=halcyon)
or read our new wiki pages to install it manually: https://notabug.org/halcyon-suite/halcyon/wiki
or read our new documentation pages to install it manually: https://www.halcyon.social/documentation.php?page=install
## Blog
- Release of Version 2.2.3 - Fixed login with Pleroma,fixed compatibility with Pawoo (older Mastodon),added support for prefers-color-scheme,some more fixes
- Our new information website [halcyon.social](https://www.halcyon.social) came online
- Release of Version 2.2.2 - Fix autocomplete,fix double scrollbars in overlay,add emojis at cursor position,confirm when closing compose window,add czech translation
- Release of Version 2.2.1 - Many small bugfixes (details see release notes) and improved compatibility to the new Pleroma API
- [Release of Version 2.2.0 - Privacy-focused media streaming and more](https://nikisoft.myblog.de/nikisoft/art/11644403/Privacy-focused-media-streaming-and-more-The-new-Halcyon-2-2-0)

View File

@ -271,6 +271,7 @@ localStorage.setItem("current_following_count_link",getRelativeURL(AccountObj["u
localStorage.setItem("current_followers_count_link",getRelativeURL(AccountObj["url"],AccountObj["id"],'/followers'));
localStorage.setItem("current_favourites_link",getRelativeURL(AccountObj["url"],AccountObj["id"],'/favourites'));
localStorage.setItem("current_follow_loaded","false");
localStorage.setItem("current_filters","[]");
current_display_name = localStorage.getItem("current_display_name");
current_acct = localStorage.getItem("current_acct");
current_url = localStorage.getItem("current_url");
@ -284,6 +285,7 @@ current_statuses_count_link = localStorage.getItem("current_statuses_count_link"
current_following_count_link = localStorage.getItem("current_following_count_link");
current_followers_count_link = localStorage.getItem("current_followers_count_link");
current_favourites_link = localStorage.getItem("current_favourites_link");
current_filters = JSON.parse(localStorage.getItem("current_filters"));
current_search_history = JSON.parse(localStorage.getItem("current_search_history"));
setCurrentProfile();
});
@ -339,6 +341,7 @@ emoji.url = data[i].url;
emojis.push(emoji);
}
localStorage.setItem("current_custom_emojis",JSON.stringify(emojis));
$(document).trigger("emojiready");
});
api.get("filters",function(data) {
localStorage.setItem("current_filters",JSON.stringify(data));
@ -373,6 +376,7 @@ current_blocked_accts = localStorage.getItem("current_blocked_accts");
current_muted_accts = localStorage.getItem("current_muted_accts");
current_filters = JSON.parse(localStorage.getItem("current_filters"));
current_search_history = JSON.parse(localStorage.getItem("current_search_history"));
$(document).trigger("emojiready");
$(function() {setCurrentProfile()});
}
function setCurrentProfile() {

View File

@ -173,6 +173,10 @@ else if(window.location.pathname == "/settings/appearance") {
$('#js-settings_nav_appearance').toggleClass('view');
$(function() {
$(".post_streaming_wrap input[name='post_streaming'][value='"+localStorage.getItem("setting_post_stream")+"']")[0].checked = true;
if($("#setting_dark_theme").attr("default") == "default") {
$("#setting_dark_theme_reset").hide();
if(window.matchMedia("prefers-color-scheme:dark").matches) $("#setting_dark_theme")[0].checked = true;
}
if(localStorage.setting_link_previews == "true") {
$("#setting_link_previews")[0].checked = true;
}
@ -209,6 +213,7 @@ localStorage.setItem("setting_post_stream", $(this).val());
putMessage(__("Changed setting to")+" "+$(this).val());
});
$("#setting_dark_theme").change(function() {
$("#setting_dark_theme_reset").fadeIn();
if(this.checked) {
$.cookie("darktheme","true",{path:'/',expires:3650});
$(document.body).append($("<link>").attr("rel","stylesheet").attr("href","/assets/css/dark.css"));
@ -220,6 +225,19 @@ $("link[href='/assets/css/dark.css']").remove();
putMessage(__("Dark theme disabled"));
}
});
$("#setting_dark_theme_reset").click(function() {
$.cookie("darktheme","unset",{path:'/',expires:3650});
$("#setting_dark_theme_reset").fadeOut();
if(window.matchMedia("prefers-color-scheme:dark").matches) {
$("#setting_dark_theme")[0].checked = true;
if($("link[href='/assets/css/dark.css']").length == 0) $(document.body).append($("<link>").attr("rel","stylesheet").attr("href","/assets/css/dark.css"));
}
else {
$("#setting_dark_theme")[0].checked = false;
$("link[href='/assets/css/dark.css']").remove();
}
putMessage(__("Dark theme reset to standard"));
});
$("#setting_link_previews").change(function() {
if(this.checked) {
localStorage.setItem("setting_link_previews","true");

View File

@ -82,9 +82,13 @@ 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'>");
}
status.account.display_name = htmlEscape(status.account.display_name);
for(i=0;i<status.account.emojis.length;i++) {
for(var i=0;i<status.account.emojis.length;i++) {
status.account.display_name = status.account.display_name.replace(new RegExp(":"+status.account.emojis[i].shortcode+":","g"),"<img src='"+status.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<status.mentions.length;i++) {
if(status.mentions[i].acct.indexOf("@") == -1) status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'@'+current_instance+'?mid='+status.mentions[i].id+'"');
else status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'?mid='+status.mentions[i].id+'"');
}
var writtenby = new Object();
writtenby.id = status.account.id;
writtenby.username = status.account.username;
@ -98,6 +102,7 @@ const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null,
status_attr_datetime = getConversionedDate(null, status.created_at);
let alart_text= "",
article_option= "",
toot_replies_count = "",
toot_reblogs_count= "",
toot_favourites_count = "",
media_views = "";
@ -108,6 +113,9 @@ article_option = "content_warning";
else if(status.spoiler_text && localStorage.setting_show_content_warning == "true") {
alart_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
}
if(status.replies_count) {
toot_replies_count = status.replies_count;
}
if (status.reblogs_count) {
toot_reblogs_count = status.reblogs_count;
}
@ -204,7 +212,7 @@ ${status.content}
<div class="toot_reaction">
<button class="reply_button" tid="${status.id}" mentions='${JSON.stringify(status.mentions)}' display_name="${status.account.display_name}" privacy="${status.visibility}">
<i class="fa fa-fw fa-reply"></i>
<span class="reaction_count reply_count"></span>
<span class="reaction_count reply_count">${toot_replies_count}</span>
</button>
</div>
${toot_reblog_button}
@ -237,6 +245,10 @@ status.reblog.account.display_name = htmlEscape(status.reblog.account.display_na
for(i=0;i<status.reblog.account.emojis.length;i++) {
status.reblog.account.display_name = status.reblog.account.display_name.replace(new RegExp(":"+status.reblog.account.emojis[i].shortcode+":","g"),"<img src='"+status.reblog.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<status.reblog.mentions.length;i++) {
if(status.reblog.mentions[i].acct.indexOf("@") == -1) status.reblog.content = status.reblog.content.replace(new RegExp('href="'+status.reblog.mentions[i].url+'"',"g"),'href="/@'+status.reblog.mentions[i].acct+'@'+current_instance+'?mid='+status.reblog.mentions[i].id+'"');
else status.reblog.content = status.reblog.content.replace(new RegExp('href="'+status.reblog.mentions[i].url+'"',"g"),'href="/@'+status.reblog.mentions[i].acct+'?mid='+status.reblog.mentions[i].id+'"');
}
var writtenby = new Object();
writtenby.id = status.reblog.account.id;
writtenby.username = status.reblog.account.username;
@ -252,6 +264,7 @@ if(status.account.acct.indexOf("@") == -1) status_account_link = "/@"+status.ac
else status_account_link = "/@"+status.account.acct+"?mid="+status.account.id;
let alart_text= "",
article_option= "",
toot_replies_count = "",
toot_reblogs_count= "",
toot_favourites_count = "",
media_views = "";
@ -262,6 +275,9 @@ article_option = "content_warning";
else if(status.reblog.spoiler_text && localStorage.setting_show_content_warning == "true") {
alart_text = "<span>"+status.reblog.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
}
if(status.reblog.replies_count) {
toot_replies_count = status.reblog.replies_count;
}
if (status.reblog.reblogs_count) {
toot_reblogs_count = status.reblog.reblogs_count;
}
@ -351,7 +367,7 @@ ${status.reblog.content}
<div class="toot_reaction">
<button class="reply_button" tid="${status.reblog.id}" mentions='${JSON.stringify(status.reblog.mentions)}' display_name="${status.reblog.account.display_name}" privacy="${status.reblog.visibility}">
<i class="fa fa-fw fa-reply"></i>
<span class="reaction_count reply_count"></span>
<span class="reaction_count reply_count">${toot_replies_count}</span>
</button>
</div>
<div class="toot_reaction">
@ -387,6 +403,10 @@ status.account.display_name = htmlEscape(status.account.display_name);
for(i=0;i<status.account.emojis.length;i++) {
status.account.display_name = status.account.display_name.replace(new RegExp(":"+status.account.emojis[i].shortcode+":","g"),"<img src='"+status.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<status.mentions.length;i++) {
if(status.mentions[i].acct.indexOf("@") == -1) status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'@'+current_instance+'?mid='+status.mentions[i].id+'"');
else status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'?mid='+status.mentions[i].id+'"');
}
var writtenby = new Object();
writtenby.id = status.account.id;
writtenby.username = status.account.username;
@ -394,12 +414,13 @@ writtenby.url = status.account.url;
writtenby.acct = status.account.acct;
status.mentions.push(writtenby);
var status_account_link;
if(status.account.acct.indexOf("@") == -1) status_account_link = "/@"+status.account.acct+"@"+current_instance+"?mid="+status.account.id;
if(status.account.acct.indexOf("@") == -1) status_account_link = "/@"+status.account.acct+"@"+current_instance+"?mid="+status.account.id;
else status_account_link = "/@"+status.account.acct+"?mid="+status.account.id;
const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.created_at)),
status_attr_datetime = getConversionedDate(null, status.created_at);
let alart_text= "",
article_option= "",
toot_replies_count = "",
toot_reblogs_count= "",
toot_favourites_count = "",
media_views = "";
@ -410,6 +431,9 @@ article_option = "content_warning";
else if(status.spoiler_text && localStorage.setting_show_content_warning == "true") {
alart_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
}
if(status.replies_count) {
toot_replies_count = status.replies_count;
}
if (status.reblogs_count) {
toot_reblogs_count = status.reblogs_count;
}
@ -489,7 +513,7 @@ ${status.content}
<div class="toot_reaction">
<button class="reply_button" tid="${status.id}" mentions='${JSON.stringify(status.mentions)}' display_name="${status.account.display_name}" privacy="${status.visibility}">
<i class="fa fa-fw fa-reply"></i>
<span class="reaction_count reply_count"></span>
<span class="reaction_count reply_count">${toot_replies_count}</span>
</button>
</div>
<div class="toot_reaction">
@ -541,6 +565,10 @@ NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.
for(i=0;i<NotificationObj.status.account.emojis.length;i++) {
NotificationObj.status.account.display_name = NotificationObj.status.account.display_name.replace(new RegExp(":"+NotificationObj.status.account.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<NotificationObj.status.mentions.length;i++) {
if(NotificationObj.status.mentions[i].acct.indexOf("@") == -1) NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp('href="'+NotificationObj.status.mentions[i].url+'"',"g"),'href="/@'+NotificationObj.status.mentions[i].acct+'@'+current_instance+'?mid='+NotificationObj.status.mentions[i].id+'"');
else NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp('href="'+NotificationObj.status.mentions[i].url+'"',"g"),'href="/@'+NotificationObj.status.mentions[i].acct+'?mid='+NotificationObj.status.mentions[i].id+'"');
}
var account_state_icons = "";
if(NotificationObj.status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(NotificationObj.status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
@ -587,6 +615,10 @@ NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.
for(i=0;i<NotificationObj.status.account.emojis.length;i++) {
NotificationObj.status.account.display_name = NotificationObj.status.account.display_name.replace(new RegExp(":"+NotificationObj.status.account.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<NotificationObj.status.mentions.length;i++) {
if(NotificationObj.status.mentions[i].acct.indexOf("@") == -1) NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp('href="'+NotificationObj.status.mentions[i].url+'"',"g"),'href="/@'+NotificationObj.status.mentions[i].acct+'@'+current_instance+'?mid='+NotificationObj.status.mentions[i].id+'"');
else NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp('href="'+NotificationObj.status.mentions[i].url+'"',"g"),'href="/@'+NotificationObj.status.mentions[i].acct+'?mid='+NotificationObj.status.mentions[i].id+'"');
}
const sid= NotificationObj.status.id;
var account_state_icons = "";
if(NotificationObj.status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
@ -635,6 +667,7 @@ const toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, N
toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at);
let alart_text= "",
article_option= "",
toot_replies_count = "",
toot_reblogs_count= "",
toot_favourites_count = "",
media_views = "";
@ -645,6 +678,10 @@ NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.
for(i=0;i<NotificationObj.status.account.emojis.length;i++) {
NotificationObj.status.account.display_name = NotificationObj.status.account.display_name.replace(new RegExp(":"+NotificationObj.status.account.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<NotificationObj.status.mentions.length;i++) {
if(NotificationObj.status.mentions[i].acct.indexOf("@") == -1) NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp('href="'+NotificationObj.status.mentions[i].url+'"',"g"),'href="/@'+NotificationObj.status.mentions[i].acct+'@'+current_instance+'?mid='+NotificationObj.status.mentions[i].id+'"');
else NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp('href="'+NotificationObj.status.mentions[i].url+'"',"g"),'href="/@'+NotificationObj.status.mentions[i].acct+'?mid='+NotificationObj.status.mentions[i].id+'"');
}
var writtenby = new Object();
writtenby.id = NotificationObj.status.account.id;
writtenby.username = NotificationObj.status.account.username;
@ -658,6 +695,9 @@ article_option = "content_warning";
else if(NotificationObj.status.spoiler_text && localStorage.setting_show_content_warning == "true") {
alart_text = "<span>"+NotificationObj.status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
}
if(NotificationObj.status.replies_count) {
toot_replies_count = NotificationObj.status.replies_count;
}
if (NotificationObj.status.reblogs_count) {
toot_reblogs_count = NotificationObj.status.reblogs_count;
}
@ -735,7 +775,7 @@ ${NotificationObj.status.account.display_name}
</button>
<div class="expand_menu invisible disallow_select">
<ul>
<li><a class="copylink_button" url="${status.url}" >${__('Copy link to Toot')}</a></li>
<li><a class="copylink_button" url="${NotificationObj.status.url}" >${__('Copy link to Toot')}</a></li>
${own_toot_buttons}
</ul>
<ul>
@ -754,7 +794,7 @@ ${NotificationObj.status.content}
<div class="toot_reaction">
<button class="reply_button" tid="${NotificationObj.status.id}" mentions='${JSON.stringify(NotificationObj.status.mentions)}' display_name="${NotificationObj.account.display_name}" privacy="${NotificationObj.status.visibility}">
<i class="fa fa-fw fa-reply"></i>
<span class="reaction_count reply_count"></span>
<span class="reaction_count reply_count">${toot_replies_count}</span>
</button>
</div>
${toot_reblog_button}
@ -841,12 +881,13 @@ return $(html);
function status_template(status, class_options) {
if ( status.reblog === null ) {
var status_account_link;
if(status.account.acct.indexOf("@") == -1) status_account_link = "/@"+status.account.acct+"@"+current_instance+"?mid="+status.account.id;
if(status.account.acct.indexOf("@") == -1) status_account_link = "/@"+status.account.acct+"@"+current_instance+"?mid="+status.account.id;
else status_account_link = "/@"+status.account.acct+"?mid="+status.account.id;
const status_datetime= getConversionedDate(null, status.created_at),
status_attr_datetime = getConversionedDate(null, status.created_at);
let alart_text= "",
article_option= "",
toot_replies_count = "",
toot_reblogs_count= "",
toot_favourites_count = "",
media_views = "";
@ -857,6 +898,10 @@ status.account.display_name = htmlEscape(status.account.display_name);
for(i=0;i<status.account.emojis.length;i++) {
status.account.display_name = status.account.display_name.replace(new RegExp(":"+status.account.emojis[i].shortcode+":","g"),"<img src='"+status.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<status.mentions.length;i++) {
if(status.mentions[i].acct.indexOf("@") == -1) status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'@'+current_instance+'?mid='+status.mentions[i].id+'"');
else status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'?mid='+status.mentions[i].id+'"');
}
var writtenby = new Object();
writtenby.id = status.account.id;
writtenby.username = status.account.username;
@ -870,6 +915,9 @@ article_option = "content_warning";
else if(status.spoiler_text && localStorage.setting_show_content_warning == "true") {
alart_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
}
if(status.replies_count) {
toot_replies_count = status.replies_count;
}
if (status.reblogs_count) {
toot_reblogs_count = status.reblogs_count;
}
@ -967,7 +1015,7 @@ ${status.content}
<div class="toot_reaction">
<button class="reply_button" tid="${status.id}" mentions='${JSON.stringify(status.mentions)}' display_name="${status.account.display_name}" privacy="${status.visibility}">
<i class="fa fa-fw fa-reply"></i>
<span class="reaction_count reply_count"></span>
<span class="reaction_count reply_count">${toot_replies_count}</span>
</button>
</div>
${toot_reblog_button}
@ -1059,7 +1107,7 @@ ${current_instance_charlimit}
<input id="reply_status_form_submit" class="submit_status" type="button" class="invisible"/>
</div>
</form>`);
history.pushState(null, null, getRelativeURL(status.account.url, status.account.id, '/status/'+status.id));
history.pushState(null, null, status_account_link.replace("?mid=",'/status/'+status.id+"?mid="));
html.find(".toot_article").append(media_views);
return html
} else {
@ -1072,6 +1120,7 @@ if(status.account.acct.indexOf("@") == -1) status_account_link = "/@"+status.ac
else status_account_link = "/@"+status.account.acct+"?mid="+status.account.id;
let alart_text= "",
article_option= "",
toot_replies_count = "",
toot_reblogs_count= "",
toot_favourites_count = "",
media_views = "";
@ -1086,6 +1135,10 @@ status.reblog.account.display_name = htmlEscape(status.reblog.account.display_na
for(i=0;i<status.reblog.account.emojis.length;i++) {
status.reblog.account.display_name = status.reblog.account.display_name.replace(new RegExp(":"+status.reblog.account.emojis[i].shortcode+":","g"),"<img src='"+status.reblog.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<status.reblog.mentions.length;i++) {
if(status.reblog.mentions[i].acct.indexOf("@") == -1) status.reblog.content = status.reblog.content.replace(new RegExp('href="'+status.reblog.mentions[i].url+'"',"g"),'href="/@'+status.reblog.mentions[i].acct+'@'+current_instance+'?mid='+status.reblog.mentions[i].id+'"');
else status.reblog.content = status.reblog.content.replace(new RegExp('href="'+status.reblog.mentions[i].url+'"',"g"),'href="/@'+status.reblog.mentions[i].acct+'?mid='+status.reblog.mentions[i].id+'"');
}
var writtenby = new Object();
writtenby.id = status.reblog.account.id;
writtenby.username = status.reblog.account.username;
@ -1099,6 +1152,9 @@ article_option = "content_warning";
else if(status.reblog.spoiler_text && localStorage.setting_show_content_warning == "true") {
alart_text = "<span>"+status.reblog.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
}
if(status.reblog.replies_count) {
toot_replies_count = status.reblog.replies_count;
}
if (status.reblog.reblogs_count) {
toot_reblogs_count = status.reblog.reblogs_count;
}
@ -1182,7 +1238,7 @@ ${status.reblog.content}
<div class="toot_reaction">
<button class="reply_button" tid="${status.reblog.id}" mentions='${JSON.stringify(status.reblog.mentions)}' display_name="${status.reblog.account.display_name}" privacy="${status.reblog.visibility}">
<i class="fa fa-fw fa-reply"></i>
<span class="reaction_count reply_count"></span>
<span class="reaction_count reply_count">${toot_replies_count}</span>
</button>
</div>
<div class="toot_reaction">
@ -1280,7 +1336,7 @@ ${current_instance_charlimit}
</div>
</form>
`);
history.pushState(null, null, getRelativeURL(status.reblog.account.url, status.reblog.id, '/status/'+status.reblog.id));
history.pushState(null, null, status_reblog_account_link.replace("?mid=",'/status/'+status.reblog.id+"?mid="));
html.find(".toot_article").append(media_views);
return html
}
@ -1317,6 +1373,7 @@ const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null,
status_attr_datetime = getConversionedDate(null, status.created_at);
let alart_text= "",
article_option= "",
toot_replies_count = "",
toot_reblogs_count= "",
toot_favourites_count = "",
media_views = "";
@ -1327,6 +1384,10 @@ status.account.display_name = htmlEscape(status.account.display_name);
for(i=0;i<status.account.emojis.length;i++) {
status.account.display_name = status.account.display_name.replace(new RegExp(":"+status.account.emojis[i].shortcode+":","g"),"<img src='"+status.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<status.mentions.length;i++) {
if(status.mentions[i].acct.indexOf("@") == -1) status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'@'+current_instance+'?mid='+status.mentions[i].id+'"');
else status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'?mid='+status.mentions[i].id+'"');
}
var writtenby = new Object();
writtenby.id = status.account.id;
writtenby.username = status.account.username;
@ -1340,6 +1401,9 @@ article_option = "content_warning";
else if(status.spoiler_text && localStorage.setting_show_content_warning == "true") {
alart_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
}
if(status.replies_count) {
toot_replies_count = status.replies_count;
}
if (status.reblogs_count) {
toot_reblogs_count = status.reblogs_count;
}
@ -1413,7 +1477,7 @@ ${status.account.display_name}
</button>
<div class="expand_menu invisible disallow_select">
<ul>
<li><a class="copylink_button" url="" >${__('Copy link to Toot')}</a></li>
<li><a class="copylink_button" url="${status.url}" >${__('Copy link to Toot')}</a></li>
${own_toot_buttons}
</ul>
<ul>
@ -1432,7 +1496,7 @@ ${status.content}
<div class="toot_reaction">
<button class="reply_button" tid="${status.id}" mentions='${JSON.stringify(status.mentions)}' display_name="${status.account.display_name}" privacy="${status.visibility}">
<i class="fa fa-fw fa-reply"></i>
<span class="reaction_count reply_count"></span>
<span class="reaction_count reply_count">${toot_replies_count}</span>
</button>
</div>
${toot_reblog_button}
@ -1463,6 +1527,7 @@ if(status.account.acct.indexOf("@") == -1) status_account_link = "/@"+status.ac
else status_account_link = "/@"+status.account.acct+"?mid="+status.account.id;
let alart_text= "",
article_option= "",
toot_replies_count = "",
toot_reblogs_count= "",
toot_favourites_count = "",
media_views = "";
@ -1477,6 +1542,10 @@ status.reblog.account.display_name = htmlEscape(status.reblog.account.display_na
for(i=0;i<status.reblog.account.emojis.length;i++) {
status.reblog.account.display_name = status.reblog.account.display_name.replace(new RegExp(":"+status.reblog.account.emojis[i].shortcode+":","g"),"<img src='"+status.reblog.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<status.reblog.mentions.length;i++) {
if(status.reblog.mentions[i].acct.indexOf("@") == -1) status.reblog.content = status.reblog.content.replace(new RegExp('href="'+status.reblog.mentions[i].url+'"',"g"),'href="/@'+status.reblog.mentions[i].acct+'@'+current_instance+'?mid='+status.reblog.mentions[i].id+'"');
else status.reblog.content = status.reblog.content.replace(new RegExp('href="'+status.reblog.mentions[i].url+'"',"g"),'href="/@'+status.reblog.mentions[i].acct+'?mid='+status.reblog.mentions[i].id+'"');
}
var writtenby = new Object();
writtenby.id = status.reblog.account.id;
writtenby.username = status.reblog.account.username;
@ -1490,6 +1559,9 @@ article_option = "content_warning";
else if(status.reblog.spoiler_text && localStorage.setting_show_content_warning == "true") {
alart_text = "<span>"+status.reblog.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
}
if(status.reblog.replies_count) {
toot_replies_count = status.reblog.replies_count;
}
if (status.reblog.reblogs_count) {
toot_reblogs_count = status.reblog.reblogs_count;
}
@ -1556,7 +1628,7 @@ ${status.reblog.account.display_name}
</button>
<div class="expand_menu invisible disallow_select">
<ul>
<li><a class="copylink_button" url="" >${__('Copy link to Toot')}</a></li>
<li><a class="copylink_button" url="${status.reblog.url}" >${__('Copy link to Toot')}</a></li>
${own_toot_buttons}
</ul>
<ul>
@ -1575,7 +1647,7 @@ ${status.reblog.content}
<div class="toot_reaction">
<button class="reply_button" tid="${status.reblog.id}" mentions='${JSON.stringify(status.reblog.mentions)}' display_name="${status.reblog.account.display_name}" privacy="${status.reblog.visibility}">
<i class="fa fa-fw fa-reply"></i>
<span class="reaction_count reply_count"></span>
<span class="reaction_count reply_count">${toot_replies_count}</span>
</button>
</div>
<div class="toot_reaction">

View File

@ -1219,6 +1219,7 @@ emoji.name = lsxEmojiData.symbols[i].name;
emoji.value = lsxEmojiData.symbols[i].value;
actEmojiData.push(emoji);
}
$(document).on("emojiready",function() {
var customemojis = JSON.parse(localStorage.current_custom_emojis);
for(var i=0;i<customemojis.length;i++) {
var emoji = new Object();
@ -1226,6 +1227,7 @@ emoji.name = customemojis[i].code;
emoji.url = customemojis[i].url;
actEmojiData.push(emoji);
}
});
$(function() {
$(document).on('click','img[mediaaccess="true"]', function(e) {
e.stopPropagation();

View File

@ -50,12 +50,14 @@ if(xhr.readyState == 0) {
api.get(endpoint,queryStringAppend,callback);
}
else {
if(xhr.responseText.length > 0) {
putMessage(`[${xhr.status}] ${xhr.responseJSON['error']}`);
if ( xhr.status === 401 ) {
location.href = "/logout";
}
}
}
}
});
},
getArray: function (endpoint) {

View File

@ -371,4 +371,4 @@ $response = $this->_get('/api/v1/timelines/tag/'.$hashtag,$parameters);
return $response;
}
}
?>
?>

View File

@ -6,14 +6,14 @@ function __construct(){
$appSettings = parse_ini_file('../config/config.ini',true);
$this->datadir = "../data";
$this->clientName = $appSettings["App"]["api_client_name"];
$this->clientRedirectUris = $appSettings["App"]["api_client_website"].'/auth urn:ietf:wg:oauth:2.0:oob';
$this->clientRedirectUris = $appSettings["App"]["api_client_website"].'/auth';
$this->clientWebsite = $appSettings["App"]["api_client_website"];
$this->clientScopes = array('read','write','follow');
$this->instances = array();
$this->readInstances();
}
private function newInstance($domain) {
$res = $this->create_app($this->clientName,$this->clientScopes,$this->clientRedirectUris,$this->clientWebsite);
$res = $this->create_app($this->clientName,$this->clientScopes,$this->clientRedirectUris."?&host=".substr($domain,8),$this->clientWebsite);
if(isset($res['html']['client_id'])) {
$this->instances[$domain] = $res['html'];
file_put_contents($this->datadir."/".substr($domain,8).".txt",json_encode(array("client_id" => $res['html']['client_id'],"client_secret" => $res['html']['client_secret'])));

View File

@ -13,9 +13,16 @@ include("language.php");
<link rel="shortcut icon" href="/assets/images/favicon.ico">
<link rel="gettext" type="text/x-gettext-translation" href="/locale/<?=$locale?>/LC_MESSAGES/messages.po">
<link rel="stylesheet" href="/assets/css/style.css" media="all">
<?php if(array_key_exists('darktheme', $_COOKIE) && $_COOKIE['darktheme'] == "true")
echo '<link rel="stylesheet" href="/assets/css/dark.css" media="all">';
<?php
if(array_key_exists('darktheme',$_COOKIE)) {
if($_COOKIE['darktheme'] == "true") echo '<link rel="stylesheet" href="/assets/css/dark.css" media="all">';
else if($_COOKIE['darktheme'] == "unset") {
?>
<script>
if(window.matchMedia("prefers-color-scheme:dark").matches)
document.write('<link rel="stylesheet" href="/assets/css/dark.css" media="all">');
</script>
<?php }} ?>
<link rel="stylesheet" href="/assets/css/fontawesome.min.css" media="all">
<link rel="stylesheet" href="/assets/css/emojipicker.css" media="all">
<script src="/assets/js/jquery/jquery.min.js"></script>

View File

@ -54,7 +54,7 @@ localStorage.setItem('setting_play_invidious','false');
localStorage.setItem('setting_play_vimeo','false');
localStorage.setItem('setting_post_privacy','".$profile["source"]["privacy"]."');
localStorage.setItem('setting_post_sensitive','".$profile["source"]["sensitive"]."');
$.cookie('darktheme','false',{path:'/',expires:3650});
$.cookie('darktheme','unset',{path:'/',expires:3650});
location.href = '/';
</script>
";

View File

@ -28,6 +28,11 @@
<div id="header_menu_wrap" class="header_box header_left_box">
<nav class="header_box_child nav_box">
<ul>
<a href="https://www.halcyon.social" class="no-underline">
<li>
<span><i class="fa fa-home" aria-hidden="true"></i><?=_('Website')?></span>
</li>
</a>
<a href="https://social.csswg.org/@halcyon" class="no-underline">
<li>
<span><i class="fa fa-newspaper-o" aria-hidden="true"></i><?=_('News')?></span>
@ -55,7 +60,7 @@
</li>
</a>
<?php } ?>
<a href="http://www.nikisoft.one/contact.php" class="no-underline">
<a href="https://www.nikisoft.one/contact.php" class="no-underline">
<li>
<span><i class="fa fa-envelope" aria-hidden="true"></i><?=_('Contact')?></span>
</li>

View File

@ -11,7 +11,7 @@ die();
} else {
try {
$client_id = $api->getInstance($URL)["client_id"];
$authorizeURL= $URL.'/oauth/authorize?client_id='.$client_id.'&response_type=code&scope=read+write+follow&website='.$api->clientWebsite.'&redirect_uri='.urlencode($api->clientWebsite.'/auth?&host='.$domain);
$authorizeURL= $URL.'/oauth/authorize?client_id='.$client_id.'&response_type=code&scope=read+write+follow&redirect_uri='.urlencode($api->clientWebsite.'/auth?&host='.$domain);
header("Location: {$authorizeURL}", true, 303);
die();
} catch (Exception $e) {

View File

@ -34,12 +34,15 @@
<h3><?=_('Enable dark theme')?></h3>
</div>
<div class="dark_theme_wrap" style="float:left;width:50%">
<div class="switch">
<input type="checkbox" id="setting_dark_theme" <?php if(array_key_exists('darktheme', $_COOKIE) && $_COOKIE['darktheme'] == "true") echo "checked='checked'" ?>>
<div class="switch" style="float:left">
<input type="checkbox" id="setting_dark_theme" <?php if(array_key_exists('darktheme',$_COOKIE)) {if($_COOKIE['darktheme'] == "true") echo "checked='checked'"; else if($_COOKIE['darktheme'] == "unset") echo "default='default'";} ?>>
<div class="switch-btn">
<span></span>
</div>
</div>
<a href="javascript:void(0)" id="setting_dark_theme_reset" style="float:left">
<i class="fa fa-2x fa-times" style="margin-top:8px"></i>
</a>
</div>
<div style="float:left;width:50%;text-align:right;margin-top:16px">
<h3><?=_('Enable link previews')?></h3>

View File

@ -1 +1 @@
2.2.2
2.2.3