View state of ongoing polls,Fix some links,fix search for urls,add Chinese translation,update media API

This commit is contained in:
nipos 2020-07-22 16:11:54 +00:00
parent eabad44fea
commit 82ae0882d1
214 changed files with 1050 additions and 26 deletions

2
.gitignore vendored Normal file → Executable file
View File

@ -1,4 +1,4 @@
config.ini config.ini
.ftpconfig .ftpconfig
data/ data/
.htpasswd

0
.htaccess Normal file → Executable file
View File

0
404.php Normal file → Executable file
View File

0
Caddyfile Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
assets/css/404.css Normal file → Executable file
View File

0
assets/css/cookieconsent.min.css vendored Normal file → Executable file
View File

0
assets/css/dark.css Normal file → Executable file
View File

0
assets/css/emojipicker.css Normal file → Executable file
View File

0
assets/css/fontawesome.min.css vendored Normal file → Executable file
View File

0
assets/css/sharebox.css Normal file → Executable file
View File

0
assets/css/sharebox_dark.css Normal file → Executable file
View File

0
assets/css/style.css Normal file → Executable file
View File

0
assets/fonts/MIT-LICENSE.txt Normal file → Executable file
View File

0
assets/fonts/SIL-OFL-LICENSE.txt Normal file → Executable file
View File

0
assets/fonts/fontawesome.eot Normal file → Executable file
View File

0
assets/fonts/fontawesome.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

0
assets/fonts/fontawesome.ttf Normal file → Executable file
View File

0
assets/fonts/fontawesome.woff Normal file → Executable file
View File

0
assets/fonts/fontawesome.woff2 Normal file → Executable file
View File

0
assets/images/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

0
assets/images/halcyon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

0
assets/images/halcyon_logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

0
assets/images/halcyon_w.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
assets/images/mastodon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

0
assets/images/mastodon.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
assets/images/missing.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 70 B

0
assets/images/missing_header.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 70 B

0
assets/images/robot.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
assets/images/self_auth.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

0
assets/images/self_auth_min.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
assets/js/autocomplete/license-textarea.txt Normal file → Executable file
View File

0
assets/js/autocomplete/search.js Normal file → Executable file
View File

0
assets/js/autocomplete/textarea.js Normal file → Executable file
View File

0
assets/js/autosize/LICENSE Normal file → Executable file
View File

0
assets/js/autosize/autosize.js Normal file → Executable file
View File

0
assets/js/blurhash.js Normal file → Executable file
View File

0
assets/js/clipboard.js/LICENSE Normal file → Executable file
View File

0
assets/js/clipboard.js/clipboard.min.js vendored Normal file → Executable file
View File

0
assets/js/cookieconsent/cookieconsent.min.js vendored Normal file → Executable file
View File

0
assets/js/cookieconsent/licence Normal file → Executable file
View File

0
assets/js/emojipicker/LICENSE Normal file → Executable file
View File

0
assets/js/emojipicker/emojidata.js Normal file → Executable file
View File

0
assets/js/emojipicker/emojipicker.js Normal file → Executable file
View File

10
assets/js/halcyon/halcyonFunctions.js Normal file → Executable file
View File

@ -234,10 +234,10 @@ api.get("instance",function(data) {
if(!data.max_toot_chars) data.max_toot_chars = 500; if(!data.max_toot_chars) data.max_toot_chars = 500;
if(!data.poll_limits) { if(!data.poll_limits) {
data.poll_limits = new Object(); data.poll_limits = new Object();
data.poll_limits.max_options = 4; data.poll_limits.max_options = 4;
data.poll_limits.max_option_chars = 25; data.poll_limits.max_option_chars = 25;
data.poll_limits.min_expiration = 300; data.poll_limits.min_expiration = 300;
data.poll_limits.max_expiration = 2629746; data.poll_limits.max_expiration = 2629746;
} }
localStorage.setItem("current_instance_charlimit",data.max_toot_chars); localStorage.setItem("current_instance_charlimit",data.max_toot_chars);
current_instance_charlimit = data.max_toot_chars; current_instance_charlimit = data.max_toot_chars;
@ -460,7 +460,7 @@ ctx.fillText("😗",-2,4);
return ctx.getImageData(0,0,1,1).data[3] > 0; return ctx.getImageData(0,0,1,1).data[3] > 0;
} }
function openStatus(link) { function openStatus(link) {
api.search("q="+encodeURIComponent(link),function(response) { api.search("q="+encodeURIComponent(link)+"&resolve=true",function(response) {
if(response.statuses.length > 0) { if(response.statuses.length > 0) {
var data = response.statuses[0]; var data = response.statuses[0];
if(data.account.acct.indexOf("@") == -1) { if(data.account.acct.indexOf("@") == -1) {

0
assets/js/halcyon/halcyonLists.js Normal file → Executable file
View File

0
assets/js/halcyon/halcyonSettings.js Normal file → Executable file
View File

0
assets/js/halcyon/halcyonSharebox.js Normal file → Executable file
View File

21
assets/js/halcyon/halcyonTemplates.js Normal file → Executable file
View File

@ -131,8 +131,9 @@ else if(expires_at.getUTCMinutes() == 1) expires_string = "1 "+__("minute");
else if(expires_at.getUTCMinutes() > 1) expires_string = expires_at.getUTCMinutes()+" "+__("minutes"); else if(expires_at.getUTCMinutes() > 1) expires_string = expires_at.getUTCMinutes()+" "+__("minutes");
else if(expires_at.getUTCSeconds() == 1) expires_string = "1 "+__("second"); else if(expires_at.getUTCSeconds() == 1) expires_string = "1 "+__("second");
else expires_string = expires_at.getUTCSeconds()+" "+__("seconds"); else expires_string = expires_at.getUTCSeconds()+" "+__("seconds");
if(poll.voted || poll.expired) { const poll_random = Math.round(Math.random()*1000);
poll_html = (`<div class="poll_box">`); if(poll.voted || poll.expired || poll.seeresult) {
poll_html = (`<div class="poll_box poll_${poll.id}" data-poll="${poll.id}" data-random="${poll_random}" id="poll_${poll.id}_${poll_random}">`);
optionsort = [...poll.options]; optionsort = [...poll.options];
optionsort.sort(function(a,b) {return a.votes_count - b.votes_count}); optionsort.sort(function(a,b) {return a.votes_count - b.votes_count});
optionsort.reverse(); optionsort.reverse();
@ -143,11 +144,11 @@ if(poll.options[i].winner) winner = " poll_winner";
poll_html += (`<div class="poll_result_option"><span class="poll_bar${winner}" style="width:${poll.options[i].votes_count/poll.votes_count*100}%"></div> poll_html += (`<div class="poll_result_option"><span class="poll_bar${winner}" style="width:${poll.options[i].votes_count/poll.votes_count*100}%"></div>
<label class="poll_result_label"><strong>${Math.round(poll.options[i].votes_count/poll.votes_count*100) || 0}%</strong> <span class="emoji_poss">${poll.options[i].title}</span></label>`); <label class="poll_result_label"><strong>${Math.round(poll.options[i].votes_count/poll.votes_count*100) || 0}%</strong> <span class="emoji_poss">${poll.options[i].title}</span></label>`);
} }
if(poll.expired) poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} &bull; ${__("Final results")}</span>`); if(poll.expired) poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} &bull; ${__("Final results")} &bull; <a href="javascript:void(0)" class="poll_refresh">${__("Refresh")}</a></span></span>`);
else poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} &bull; ${expires_string} ${__("left")}</span>`); else if(poll.seeresult) poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} &bull; ${expires_string} ${__("left")} &bull; <a href="javascript:void(0)" class="poll_refresh">${__("Back")}</a></span>`);
else poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} &bull; ${expires_string} ${__("left")} &bull; <a href="javascript:void(0)" class="poll_refresh">${__("Refresh")}</a></span>`);
} }
else { else {
const poll_random = Math.round(Math.random()*1000);
poll_html = (`<div class="poll_box poll_box_form poll_${poll.id}" data-poll="${poll.id}" data-random="${poll_random}" id="poll_${poll.id}_${poll_random}">`); poll_html = (`<div class="poll_box poll_box_form poll_${poll.id}" data-poll="${poll.id}" data-random="${poll_random}" id="poll_${poll.id}_${poll_random}">`);
for(var i=0;i<poll.options.length;i++) { for(var i=0;i<poll.options.length;i++) {
if(poll.multiple) { if(poll.multiple) {
@ -160,7 +161,7 @@ poll_html += (`<div class="radiobox"><input type="radio" id="poll_${poll.id}_${p
} }
} }
poll_html += (`<button class="halcyon_button poll_vote"><span>${__("Vote")}</span></button> poll_html += (`<button class="halcyon_button poll_vote"><span>${__("Vote")}</span></button>
${poll.votes_count} ${__("votes")} &bull; ${expires_string} ${__("left")}`); ${poll.votes_count} ${__("votes")} &bull; ${expires_string} ${__("left")} &bull; <a href="javascript:void(0)" class="poll_show_result">${__("Show results")}</a>`);
} }
poll_html += (`</div>`); poll_html += (`</div>`);
return poll_html; return poll_html;
@ -289,7 +290,7 @@ const html = (`
<section class="toot_content"> <section class="toot_content">
<header class="toot_header"> <header class="toot_header">
<div class="text_ellipsis"> <div class="text_ellipsis">
<a href="${NotificationObj.status.halcyon.author_link}"> <a href="${NotificationObj.status.halcyon.account_link}">
<span class="displayname emoji_poss"> <span class="displayname emoji_poss">
${NotificationObj.status.account.display_name} ${NotificationObj.status.account.display_name}
</span> </span>
@ -327,7 +328,7 @@ html = (`
<section class="toot_content"> <section class="toot_content">
<header class="toot_header"> <header class="toot_header">
<div class="text_ellipsis"> <div class="text_ellipsis">
<a href="${NotificationObj.status.halcyon.author_link}"> <a href="${NotificationObj.status.halcyon.account_link}">
<span class="displayname emoji_poss"> <span class="displayname emoji_poss">
${NotificationObj.status.account.display_name} ${NotificationObj.status.account.display_name}
</span> </span>
@ -366,7 +367,7 @@ const html = (`
<section class="toot_content"> <section class="toot_content">
<header class="toot_header"> <header class="toot_header">
<div class="text_ellipsis"> <div class="text_ellipsis">
<a href="${NotificationObj.status.halcyon.author_link}"> <a href="${NotificationObj.status.halcyon.account_link}">
<span class="displayname emoji_poss"> <span class="displayname emoji_poss">
${NotificationObj.status.account.display_name} ${NotificationObj.status.account.display_name}
</span> </span>
@ -474,7 +475,7 @@ html.find(".toot_article").append(NotificationObj.status.halcyon.poll_object);
return html; return html;
} else if(NotificationObj.type === 'follow') { } else if(NotificationObj.type === 'follow') {
const html=(` const html=(`
<li sid="${NotificationObj.id}" class="notice_entry fol toot_entry"> <li class="notice_entry fol toot_entry">
<div class="notice_author_box"> <div class="notice_author_box">
<a href="${notice_author_link}"> <a href="${notice_author_link}">
<div class="icon_box"> <div class="icon_box">

25
assets/js/halcyon/halcyonUI.js Normal file → Executable file
View File

@ -1316,7 +1316,7 @@ $(document).on('click','.player',function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
$(document).on('click','.toot_entry', function(e) { $(document).on('click','.toot_entry', function(e) {
setOverlayStatus($(this).attr('sid')); if($(this).attr('sid')) setOverlayStatus($(this).attr('sid'));
}); });
}) })
function setOverlayMedia(sid,mediacount) { function setOverlayMedia(sid,mediacount) {
@ -2298,6 +2298,29 @@ $(".poll_"+poll_id).remove();
} }
return false; return false;
}); });
$(document).on('click','.poll_show_result',function(e) {
var poll_id = $(this).parent().data('poll');
var poll_random = $(this).parent().data('random');
if(poll_id !== null && poll_random !== null) {
api.get('polls/'+poll_id,function(data) {
data.seeresult = true;
$("#poll_"+poll_id+"_"+poll_random).after(poll_template(data));
$("#poll_"+poll_id+"_"+poll_random).remove();
});
}
return false;
});
$(document).on('click','.poll_refresh',function(e) {
var poll_id = $(this).parent().parent().data('poll');
var poll_random = $(this).parent().parent().data('random');
if(poll_id !== null && poll_random !== null) {
api.get('polls/'+poll_id,function(data) {
$("#poll_"+poll_id+"_"+poll_random).after(poll_template(data));
$("#poll_"+poll_id+"_"+poll_random).remove();
});
}
return false;
});
$(document).on('click','.link_preview',function(e) { $(document).on('click','.link_preview',function(e) {
e.stopPropagation(); e.stopPropagation();
const ytcom = $(this).data("url").match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/); const ytcom = $(this).data("url").match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/);

0
assets/js/halcyon/halcyonWorker.js Normal file → Executable file
View File

0
assets/js/jquery-cookie/MIT-LICENSE.txt Normal file → Executable file
View File

0
assets/js/jquery-cookie/src/jquery.cookie.js Normal file → Executable file
View File

0
assets/js/jquery/LICENSE.txt Normal file → Executable file
View File

0
assets/js/jquery/jquery.min.js vendored Normal file → Executable file
View File

0
assets/js/mastodon.js/LICENSE Normal file → Executable file
View File

4
assets/js/mastodon.js/mastodon.js Normal file → Executable file
View File

@ -218,14 +218,14 @@ postData = arguments[1];
callback = arguments[2]; callback = arguments[2];
} }
$.ajax({ $.ajax({
url: apiBase + endpoint, url: config.instance + "/api/v2/" + endpoint,
type: "POST", type: "POST",
data: postData, data: postData,
contentType: false, contentType: false,
processData: false, processData: false,
headers: {"Authorization": "Bearer " + config.api_user_token}, headers: {"Authorization": "Bearer " + config.api_user_token},
success: function(data, textStatus) { success: function(data, textStatus) {
console.log("Successful POST API request to " +apiBase+endpoint); console.log("Successful POST API request to " +config.instance + "/api/v2/"+endpoint);
callback(data,textStatus) callback(data,textStatus)
}, },
error: function(xhr, textStatus, errorThrown) { error: function(xhr, textStatus, errorThrown) {

0
assets/js/player/LICENSE-audio.txt Normal file → Executable file
View File

0
assets/js/player/LICENSE-soundmanager.txt Normal file → Executable file
View File

0
assets/js/player/LICENSE-youplay.txt Normal file → Executable file
View File

0
assets/js/player/audio.js Normal file → Executable file
View File

0
assets/js/player/soundmanager.js Normal file → Executable file
View File

0
assets/js/player/youplay.js Normal file → Executable file
View File

0
assets/js/pomo/LICENSE.txt Normal file → Executable file
View File

0
assets/js/pomo/pomo.js Normal file → Executable file
View File

0
assets/js/replace_emoji.js Normal file → Executable file
View File

0
assets/js/shortcut.js Normal file → Executable file
View File

0
assets/js/twemoji/LICENSE Normal file → Executable file
View File

0
assets/js/twemoji/twemoji.min.js vendored Normal file → Executable file
View File

0
authorize/.htaccess Normal file → Executable file
View File

0
authorize/mastodon-api/LICENSE Normal file → Executable file
View File

0
authorize/mastodon-api/mastodon.php Normal file → Executable file
View File

0
authorize/mastodon.php Normal file → Executable file
View File

0
bookmarks.php Normal file → Executable file
View File

12
config/config.ini.sample Normal file → Executable file
View File

@ -19,15 +19,15 @@ url_unshortener = true
youplay = true youplay = true
vimeo = true vimeo = true
youplay_fallback = true youplay_fallback = true
invidious = invidiou.sh invidious = invidious.snopyta.org
nitter = nitter.13ad.de nitter = nitter.13ad.de
bibliogram = bibliogram.dsrev.ru bibliogram = bibliogram.ggc-project.de
; The proxy can be used optionally to resolve data for privacy-friendly media embeds on the server side - It is not used for Mastodon API requests on login ; The proxy can be used optionally to resolve data for privacy-friendly media embeds on the server side - It is not used for Mastodon API requests on login
; Proxy type can be set to none, socks5, socks4, http or https - Example settings for locally installed Tor client ; Proxy type can be set to none, socks5, socks4, http or https
[Proxy] [Proxy]
type = socks5 type = none
domain = 127.0.0.1 domain =
port = 9050 port =
username = username =
password = password =

0
config/footerlinks.txt.sample Normal file → Executable file
View File

0
config/imprint.txt.sample Normal file → Executable file
View File

0
config/privacy.txt Normal file → Executable file
View File

0
config/terms.txt Normal file → Executable file
View File

0
data/.htaccess Normal file → Executable file
View File

0
direct.php Normal file → Executable file
View File

0
docker/.dockerignore Normal file → Executable file
View File

0
docker/.gitignore vendored Normal file → Executable file
View File

0
docker/Dockerfile Normal file → Executable file
View File

0
docker/README.md Normal file → Executable file
View File

0
docker/etc/supervisord.conf Normal file → Executable file
View File

0
docker/locale/default Normal file → Executable file
View File

0
docker/locale/locale.gen Normal file → Executable file
View File

0
docker/usr/local/etc/php-fpm.d/50-clear-env.conf Normal file → Executable file
View File

0
docker/usr/local/etc/php-fpm.d/50-no-access-log.conf Normal file → Executable file
View File

0
docker/usr/local/etc/php-fpm.d/50-socket.conf Normal file → Executable file
View File

0
docker/usr/local/etc/php/conf.d/00-best-practices.ini Normal file → Executable file
View File

0
docker/usr/local/etc/php/conf.d/00-performance.ini Normal file → Executable file
View File

0
docker/usr/local/etc/php/conf.d/00-security.ini Normal file → Executable file
View File

0
federated.php Normal file → Executable file
View File

0
footer.php Normal file → Executable file
View File

0
header.php Normal file → Executable file
View File

0
home.php Normal file → Executable file
View File

0
index.php Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More