diff --git a/.htaccess b/.htaccess index f93b035..9eb886e 100644 --- a/.htaccess +++ b/.htaccess @@ -31,6 +31,12 @@ RewriteBase /search RewriteRule ^search/?$ search_hash_tag\.php [NC,L,QSA] RewriteRule ^search/users/?$ search_user\.php [NC,L,QSA] +# Settings +RewriteBase /settings +RewriteRule ^settings/?$ settings_general\.php [NC,L] +RewriteRule ^settings/profile/?$ settings_profile\.php [NC,L] +RewriteRule ^settings/appearance/?$ settings_appearance\.php [NC,L] + # User RewriteBase / RewriteRule ^@(.+)@(.+)\.([a-z]+)/?$ user\.php?user=@$1@$2\.$3 [NC,L,QSA] @@ -51,3 +57,4 @@ RewriteRule ^404/?$ 404\.php [NC,L,QSA] ErrorDocument 404 /404 + diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..8407cbc --- /dev/null +++ b/Caddyfile @@ -0,0 +1,109 @@ +halcyon.domain.tld { +tls user@domain.tld +log /var/log/caddy/halcyon.log +fastcgi / 127.0.0.1:9000 php +root /opt/halcyon +status 404 { +/config.ini +/.bat +/.git +/.ini +/.sh +/.svn +/.txt +/.tpl +/.xml +} +rewrite { +r ^/home/?$ +to / +} +rewrite { +r ^/login/?$ +to /login/login.php +} +rewrite { +r ^/auth/?$ +to /login/auth.php +} +rewrite { +r ^/logout/?$ +to /login/logout.php +} +rewrite { +r ^/terms/?$ +to /login/terms.php +} +rewrite { +r ^/local/?$ +to /local.php +} +rewrite { +r ^/federated/?$ +to /federated.php +} +rewrite { +r ^/notifications/?$ +to /notifications.php +} +rewrite { +r ^/search/?$ +to /search_hash_tag.php +} +rewrite { +r ^/search/users/?$ +to /search_user.php +} +rewrite { +r ^/settings/?$ +to /settings_general.php +} +rewrite { +r ^/settings/profile/?$ +to /settings_profile.php +} +rewrite { +r ^/settings/appearance/?$ +to /settings_appearance.php +} +rewrite { +r ^/@(.+)@(.+).([a-z]+)/?$ +to /user.php?user=@{1}@{2}.{3} +} +rewrite { +r ^/@(.+)@(.+).([a-z]+)/status/(.+?)?$ +to /user.php?user=@{1}@{2}.{3}&status={4} +} +rewrite { +r ^/@(.+)@(.+).([a-z]+)/media/?$ +to /user_only_media.php?user=@{1}@{2}.{3} +} +rewrite { +r ^/@(.+)@(.+).([a-z]+)/with_replies/?$ +to /user_include_replies.php?user=@{1}@{2}.{3} +} +rewrite { +r ^/@(.+)@(.+).([a-z]+)/followers/?$ +to /user_followers.php?user=@{1}@{2}.{3} +} +rewrite { +r ^/@(.+)@(.+).([a-z]+)/following/?$ +to /user_following.php?user=@{1}@{2}.{3} +} +rewrite { +r ^/@(.+)@(.+).([a-z]+)/favourites/?$ +to /user_favorite.php?user=@{1}@{2}.{3} +} +rewrite { +r ^/avatars/original/missing.png$ +to /assets/images/missing.png +} +rewrite { +r ^/headers/original/missing.png$ +to /assets/images/missing_header.png +} +rewrite { +r ^/404/?$ +to /404.php +} +} diff --git a/README.md b/README.md index a229aaa..80cf0b1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Follow or Mastodon account and never miss an important update: [@halcyon@social. ## Instances These instances are publicly accessible and usable by everyone, no matter which Mastodon instance you use. - https://social.dev-wiki.de - 1.1.6 -- https://halcyon.toromino.de - 1.1.7 +- https://halcyon.toromino.de - 1.2.0 - https://itter.photog.social - 1.1.7 - https://halcyon.bka.li - 1.1.7 - https://halcyon.tilde.team - 1.1.7 @@ -21,6 +21,8 @@ These instances are publicly accessible and usable by everyone, no matter which You have your own Halcyon instance and want it to be listed here? Create an issue with the link and we will add it to the list. ## Blog +- Release of Version 1.2.0 - Bigger blog article with all changes and a future roadmap coming soon +- Moved from Github to NotABug - Blog article coming soon - Release of Version 1.1.7 - Fixed some bugs in compatibility with Pleroma,text fields now autoresizable,stopped undefined socket tries on profile pages - Release of Version 1.1.6 - Complete rewrite of the "who to follow" function using an API - Change of config.ini needed! - Release of Version 1.1.5 - Introduced the new Idempotency-Key Header and fixed an bug allowing XSS with the display name diff --git a/assets/css/style.css b/assets/css/style.css index 5d7f333..cdebfab 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -1305,20 +1305,20 @@ opacity: 1; margin-top: 16px; transition: 0.13s ease-out; } -.side_widget select, .side_widget input { -margin: 8px 0 16px; +.textfield { +margin: 10px; padding-left:5px; -width: 100%; +width: 50%; font-size: 14px; color: #66757F; box-sizing: border-box; height:30px; -border:1px solid #E8EEF1; +border:1px solid #AAB8C2; border-radius:2px; -background-color:#F5F8FA; +background-color:transparent; outline:0; } -.side_widget select:active, .side_widget input:focus { +.textfield:focus { outline:0; border:1px solid #189EFC; background-color:transparent; @@ -1804,15 +1804,15 @@ border-radius: 4px; font-size: 14px; font-weight: 700; } -#js-search_title_box { +#js-header_title_box { width: 100%; height: 64px; padding: 16px 0; - overflow: hidden; +overflow: hidden; box-sizing: border-box; background-color: #189EFC; } -#js-search_title_box h1 { +#js-header_title_box h1 { display: block; width: 1200px; margin: 0 auto; @@ -1823,14 +1823,14 @@ line-height: 32px; color: #fff; box-sizing: border-box; } -#main .search_nav_wrap { +#main .header_nav_wrap { height: 50px; width: 100%; background-color: #fff; box-shadow: 0 1px 3px 0 rgba(0,0,0,0.25); margin-bottom: 4px; } -#main .search_nav_wrap .search_nav { +#main .header_nav_wrap .header_nav { display: flex; flex-wrap: nowrap; width: 1200px; @@ -1839,27 +1839,26 @@ margin: auto; padding: 0 5px; box-sizing: border-box; } -#main .search_nav_wrap .search_nav .search_nav_left { +#main .header_nav_wrap .header_nav .header_nav_left { width: 900px; height: 100%; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list { display: flex; flex-wrap: nowrap; align-items: center; height: 100%; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list .search_nav_item { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list .header_nav_item { height: 100%; color: #66757F; /*! font-size: 13px; */ } -#main .search_nav_wrap #js-search_nav_peoples.view a , -#main .search_nav_wrap #js-search_nav_toots.view a { -border-top: 4px solid transparent; -border-bottom: 4px solid #189EFC; +#main .header_nav_wrap .header_nav_item.view a { +border-top: 4px solid transparent !important; +border-bottom: 4px solid #189EFC !important; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list .search_nav_item a { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list .header_nav_item a { display: flex; flex-direction: column; flex-wrap: nowrap; @@ -1872,38 +1871,38 @@ border-top: 0px solid transparent; border-bottom: 0px solid #189EFC; transition: 0.15s; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list .search_nav_item a:hover { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list .header_nav_item a:hover { color: #189EFC; text-decoration: none; border-top: 4px solid transparent; border-bottom: 4px solid #189EFC; transition: 0.15s; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list .search_nav_item a.view { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list .header_nav_item a.view { color: #189EFC; border-top: 4px solid transparent; border-bottom: 4px solid #189EFC; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list .search_nav_item a h2 { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list .header_nav_item a h2 { display: inline-block; font-size: 14px; font-weight: normal; color: #189EFC; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list .search_nav_item a span { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list .header_nav_item a span { display: inline-block; font-size: 18px; font-weight: 600; margin-top: 3px; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list .search_button_box { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list .header_button_box { display: flex; align-items: center; justify-content: flex-end; flex: 1; height: 100%; } -#main .search_nav_wrap .search_nav .search_nav_left .search_nav_list .search_button_box button { +#main .header_nav_wrap .header_nav .header_nav_left .header_nav_list .header_button_box button { float: right; padding: 9px 16px; border-radius: 4px; @@ -2360,11 +2359,9 @@ border-bottom: none; display: none; } .switch { -width: 60px; -height: 30px; -margin:auto; -margin-top:8px; -margin-bottom:16px; +width:60px; +height:30px; +margin:10px; } .switch input { width: 60px; @@ -2405,3 +2402,32 @@ left: 32px; .switch input:checked + .switch-btn { background: #189EFC; } +.radiobox { +margin: 10px; +} +.radiobox input[type="radio"] { +position: absolute; +opacity: 0; +} +.radiobox input[type="radio"] + .radiotext:before { +content: ''; +background: #ffffff; +border-radius: 100%; +border: 1px solid #AAB8C2; +display: inline-block; +width: 30px; +height: 30px; +margin-right: 3px; +vertical-align: top; +cursor: pointer; +text-align: center; +transition: all 250ms ease; +position: relative; +top: -8px; +} +.radiobox input[type="radio"]:checked + .radiotext:before { +background-color: #189EFC; +box-shadow: inset 0 0 0 4px #ffffff; +outline: none; +border-color: #189EFC; +} diff --git a/assets/js/halcyon/halcyonFunctions.js b/assets/js/halcyon/halcyonFunctions.js index e56b2be..74cae25 100644 --- a/assets/js/halcyon/halcyonFunctions.js +++ b/assets/js/halcyon/halcyonFunctions.js @@ -123,27 +123,27 @@ var posted_time_original = posted_time, posted_time = getConversionedDate(null, posted_time_original).getTime(), elapsedTime = Math.ceil((current_time-posted_time)/1000); if (elapsedTime < 60) { -const datetime ="・" + elapsedTime + "s"; +const datetime ="・" + elapsedTime + "s"; return datetime; } else if (elapsedTime < 120) { -const datetime ="・1m"; +const datetime ="・1m"; return datetime; } else if (elapsedTime < (60*60)) { -const datetime ="・" + (Math.floor(elapsedTime / 60) < 10 ? " " : "") + Math.floor(elapsedTime / 60) + "m"; +const datetime ="・" + (Math.floor(elapsedTime / 60) < 10 ? " " : "") + Math.floor(elapsedTime / 60) + "m"; return datetime; } else if (elapsedTime < (120*60)) { -const datetime ="・1h"; +const datetime ="・1h"; return datetime; } else if (elapsedTime < (24*60*60)) { -const datetime ="・" + (Math.floor(elapsedTime / 3600) < 10 ? " " : "") + Math.floor(elapsedTime / 3600) + "h"; +const datetime ="・" + (Math.floor(elapsedTime / 3600) < 10 ? " " : "") + Math.floor(elapsedTime / 3600) + "h"; return datetime; } else { -const datetime ="・" + calendar[posted_time_original.getMonth()] + " " + posted_time_original.getDate(); +const datetime ="・" + calendar[posted_time_original.getMonth()] + " " + posted_time_original.getDate(); return datetime; } } @@ -173,19 +173,19 @@ api = new MastodonAPI({ instance: 'https://'+current_instance, api_user_token: authtoken }); -api.get("accounts/verify_credentials", function(AccountObj) { -localStorage.setItem("current_display_name", AccountObj["display_name"]); -localStorage.setItem("current_acct", AccountObj["acct"]); -localStorage.setItem("current_url", getRelativeURL(AccountObj["url"],AccountObj["id"])); -localStorage.setItem("current_header", AccountObj["header"]); -localStorage.setItem("current_avatar", AccountObj["avatar"]); -localStorage.setItem("current_statuses_count", AccountObj["statuses_count"]); -localStorage.setItem("current_following_count", AccountObj["following_count"]); -localStorage.setItem("current_followers_count", AccountObj["followers_count"]); -localStorage.setItem("current_statuses_count_link", getRelativeURL(AccountObj["url"],AccountObj["id"])); -localStorage.setItem("current_following_count_link", getRelativeURL(AccountObj["url"],AccountObj["id"],'/following')); -localStorage.setItem("current_followers_count_link", getRelativeURL(AccountObj["url"],AccountObj["id"],'/followers')); -localStorage.setItem("current_favourites_link", getRelativeURL(AccountObj["url"],AccountObj["id"],'/favourites')); +api.get("accounts/verify_credentials",function(AccountObj) { +localStorage.setItem("current_display_name",AccountObj["display_name"]); +localStorage.setItem("current_acct",AccountObj["acct"]); +localStorage.setItem("current_url",getRelativeURL(AccountObj["url"],AccountObj["id"])); +localStorage.setItem("current_header",AccountObj["header"]); +localStorage.setItem("current_avatar",AccountObj["avatar"]); +localStorage.setItem("current_statuses_count",AccountObj["statuses_count"]); +localStorage.setItem("current_following_count",AccountObj["following_count"]); +localStorage.setItem("current_followers_count",AccountObj["followers_count"]); +localStorage.setItem("current_statuses_count_link",getRelativeURL(AccountObj["url"],AccountObj["id"])); +localStorage.setItem("current_following_count_link",getRelativeURL(AccountObj["url"],AccountObj["id"],'/following')); +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"); current_display_name = localStorage.getItem("current_display_name"); current_acct = localStorage.getItem("current_acct"); @@ -260,23 +260,15 @@ $(".js_current_followers_count").text(current_followers_count); $(".current_toots_count_link").attr("href", current_statuses_count_link); $(".current_following_count_link").attr("href", current_following_count_link); $(".current_followers_count_link").attr("href", current_followers_count_link); -if(localStorage.setting_link_previews == "true") { -$("#setting_link_previews")[0].checked = true; -} -if(localStorage.setting_desktop_notifications == "true") { -$("#setting_desktop_notifications")[0].checked = true; if (Notification.permission === 'default') { Notification.requestPermission(function(p) { if (p === 'denied') { localStorage.setItem("setting_desktop_notifications","false"); -$("#setting_desktop_notifications")[0].checked = false; } }); } else if(Notification.permission == "denied") { localStorage.setItem("setting_desktop_notifications","false"); -$("#setting_desktop_notifications")[0].checked = false; -} } if(localStorage.setting_who_to_follow == "true") { setWhoToFollow(); diff --git a/assets/js/halcyon/halcyonSettings.js b/assets/js/halcyon/halcyonSettings.js new file mode 100644 index 0000000..40f1148 --- /dev/null +++ b/assets/js/halcyon/halcyonSettings.js @@ -0,0 +1,204 @@ +if(window.location.pathname == "/settings") { +$('#js-settings_nav_general').toggleClass('view'); +$(function() { +$(".post_privacy_wrap input[name='post_privacy'][value='"+localStorage.getItem("setting_post_privacy")+"']")[0].checked = true; +$(".local_instance_wrap input[name='local_instance']").val(localStorage.getItem("setting_local_instance")); +$(".search_filter_wrap input[name='search_filter'][value='"+localStorage.getItem("setting_search_filter")+"']")[0].checked = true; +if(localStorage.setting_post_sensitive == "true") { +$("#setting_post_sensitive")[0].checked = true; +} +if(localStorage.setting_who_to_follow == "true") { +$("#setting_who_to_follow")[0].checked = true; +} +}); +$(document).on('change',".post_privacy_wrap input[name='post_privacy']:checked", function(e) { +localStorage.setItem("setting_post_privacy", $(this).val()); +putMessage("Changed setting to "+$(this).val()); +}); +$("#setting_post_sensitive").change(function() { +if(this.checked) { +localStorage.setItem("setting_post_sensitive","true"); +putMessage("Mark as NSFW by default enabled"); +} +else { +localStorage.setItem("setting_post_sensitive","false"); +putMessage("Mark as NSFW by default disabled"); +} +}); +$(document).on('change',".local_instance_wrap input[name='local_instance']", function(e) { +if($(this).val()) { +localStorage.setItem("setting_local_instance","https://"+$(this).val()); +} +else { +localStorage.setItem("setting_local_instance","default"); +} +putMessage("Changed setting to "+$(this).val()); +}); +$(document).on('change',".search_filter_wrap input[name='search_filter']:checked", function(e) { +localStorage.setItem("setting_search_filter", $(this).val()); +putMessage("Changed setting to "+$(this).val()); +}); +$("#setting_who_to_follow").change(function() { +if(this.checked) { +localStorage.setItem("setting_who_to_follow","true"); +putMessage("Who to follow enabled"); +} +else { +localStorage.setItem("setting_who_to_follow","false"); +putMessage("Who to follow disabled"); +} +}) +} +else if(window.location.pathname == "/settings/profile") { +$('#js-settings_nav_profile').toggleClass('view'); +$(function() { +api.get("accounts/verify_credentials",function(AccountObj) { +$(".display_name_wrap input[name='display_name']").val(AccountObj["display_name"]); +if(AccountObj["source"]["note"].length != 0) { +$(".about_me_wrap textarea[name='about_me']").val(AccountObj["source"]["note"]); +} +else { +$(".about_me_wrap textarea[name='about_me']").val(AccountObj["note"]); +} +if(AccountObj["locked"] == true) { +$("#setting_lock_account")[0].checked = true; +} +$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check"); +}); +}); +$(document).on('change',".display_name_wrap input[name='display_name']", function(e) { +$("#savestate").removeClass("fa-check").addClass("fa-spin").addClass("fa-circle-o-notch"); +api.patch("accounts/update_credentials","display_name="+$(this).val(),function() { +$.removeCookie("session"); +$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check"); +putMessage("Changed setting to "+$(this).val()); +}); +}); +$(document).on('change',".about_me_wrap textarea[name='about_me']", function(e) { +$("#savestate").removeClass("fa-check").addClass("fa-spin").addClass("fa-circle-o-notch"); +api.patch("accounts/update_credentials","note="+$(this).val(),function() { +$.removeCookie("session"); +$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check"); +putMessage("Changed about me setting"); +}); +}); +$("#setting_avatar").change(function() { +if($('#setting_avatar').prop('files')[0]) { +$("#savestate").removeClass("fa-check").addClass("fa-spin").addClass("fa-circle-o-notch"); +var formdata = new FormData(); +formdata.append('avatar',$('#setting_avatar').prop('files')[0]); +api.patch("accounts/update_credentials",formdata,function() { +$.removeCookie("session"); +$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check"); +putMessage("Uploaded new avatar"); +}) +} +}); +$("#setting_header").change(function() { +if($('#setting_header').prop('files')[0]) { +$("#savestate").removeClass("fa-check").addClass("fa-spin").addClass("fa-circle-o-notch"); +var formdata = new FormData(); +formdata.append('header',$('#setting_header').prop('files')[0]); +api.patch("accounts/update_credentials",formdata,function() { +$.removeCookie("session"); +$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check"); +putMessage("Uploaded new header"); +}) +} +}); +$("#setting_lock_account").change(function() { +$("#savestate").removeClass("fa-check").addClass("fa-spin").addClass("fa-circle-o-notch"); +if(this.checked) { +api.patch("accounts/update_credentials","locked=1",function() { +$.removeCookie("session"); +$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check"); +putMessage("Account locked"); +}); +} +else { +api.patch("accounts/update_credentials","locked=0",function() { +$.removeCookie("session"); +$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check"); +putMessage("Account unlocked"); +}); +} +}) +} +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(localStorage.setting_link_previews == "true") { +$("#setting_link_previews")[0].checked = true; +} +if(localStorage.setting_desktop_notifications == "true") { +$("#setting_desktop_notifications")[0].checked = true; +if (Notification.permission === 'default') { +Notification.requestPermission(function(p) { +if (p === 'denied') { +$("#setting_desktop_notifications")[0].checked = false; +} +}); +} +else if(Notification.permission == "denied") { +$("#setting_desktop_notifications")[0].checked = false; +} +} +if(localStorage.setting_show_replies == "true") { +$("#setting_show_replies")[0].checked = true; +} +}); +$(document).on('change',".post_streaming_wrap input[name='post_streaming']:checked", function(e) { +localStorage.setItem("setting_post_stream", $(this).val()); +putMessage("Changed setting to "+$(this).val()); +}); +$("#setting_link_previews").change(function() { +if(this.checked) { +localStorage.setItem("setting_link_previews","true"); +putMessage("Link previews enabled"); +} +else { +localStorage.setItem("setting_link_previews","false"); +putMessage("Link previews disabled"); +} +}); +$("#setting_desktop_notifications").change(function() { +if(this.checked) { +localStorage.setItem("setting_desktop_notifications","true"); +if (Notification.permission === 'default') { +Notification.requestPermission(function(p) { +if (p === 'denied') { +localStorage.setItem("setting_desktop_notifications","false"); +$("#setting_desktop_notifications")[0].checked = false; +putMessage("You didn't allow notifications"); +} +else { +putMessage("Desktop notifications enabled"); +} +}); +} +else if(Notification.permission == "denied") { +localStorage.setItem("setting_desktop_notifications","false"); +$("#setting_desktop_notifications")[0].checked = false; +putMessage("You didn't allow notifications"); +} +else { +putMessage("Desktop notifications enabled"); +} +} +else { +localStorage.setItem("setting_desktop_notifications","false"); +putMessage("Desktop notifications disabled"); +} +}); +$("#setting_show_replies").change(function() { +if(this.checked) { +localStorage.setItem("setting_show_replies","true"); +putMessage("Replies shown"); +} +else { +localStorage.setItem("setting_show_replies","false"); +putMessage("Replies hidden"); +} +}) +} diff --git a/assets/js/halcyon/halcyonTemplates.js b/assets/js/halcyon/halcyonTemplates.js new file mode 100644 index 0000000..49d114b --- /dev/null +++ b/assets/js/halcyon/halcyonTemplates.js @@ -0,0 +1,1169 @@ +function mediaattachments_template(status) { +let media_views = ""; +if(status.media_attachments[0].remote_url != null) { +status.media_attachments[0].url = status.media_attachments[0].remote_url; +} +if ( status.media_attachments[0].url === "/files/original/missing.png" ) { +return ""; +} else if ( !status.sensitive ) { +media_views = `
`; +} else { +media_views = ` +
+
+Sensitive content +Click to view +
`; +} +if ( status.media_attachments[0].type === "video" | status.media_attachments[0].type === "gifv" ) { +media_views += (` +
+ +
`); +} else { +if ( status.media_attachments.length <= 2 ) { +for ( let i in status.media_attachments ) { +if(status.media_attachments[i].remote_url != null) { +status.media_attachments[i].url = status.media_attachments[i].remote_url; +} +media_views += (` +
+ +
`); +} +} else { +for ( let i in status.media_attachments ) { +if (Number(i) === 1) { +if(status.media_attachments[i].remote_url != null) { +status.media_attachments[i].url = status.media_attachments[i].remote_url; +} +media_views += (` +
+
+ +
`); +} else { +media_views += (` +
+ +
`); +} +} +media_views += "
"; +} +media_views += "
"; +} +return media_views; +} +function timeline_template(status) { +if (status.reblog === null) { +for(i=0;i"); +} +const status_account_link= getRelativeURL(status.account.url, status.account.id), +status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.created_at)), +status_attr_datetime = getConversionedDate(null, status.created_at); +let alart_text= "", +article_option= "", +toot_reblogs_count= "", +toot_favourites_count = "", +media_views = ""; +if ( status.spoiler_text ) { +alart_text = ""+status.spoiler_text+"", +article_option = "content_warning"; +} +if (status.reblogs_count) { +toot_reblogs_count = status.reblogs_count; +} +if (status.favourites_count) { +toot_favourites_count = status.favourites_count; +} +if ( status.media_attachments.length ) { +media_views = mediaattachments_template(status); +} +if(status.account.display_name.length == 0) { +status.account.display_name = status.account.username; +} +switch(status.visibility) { +case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; +case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; +case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; +case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; +} +if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { +toot_footer_width = " style='width:320px'"; +toot_reblog_button = (`
+ +
`); +} +else { +toot_footer_width = ""; +toot_reblog_button = ""; +} +const html=(` +
  • +
    + +
    + +
    +
    +
    +
    + + +
    +
    +${alart_text} + +${status.content} + +${media_views} +
    +
    +
    + +
    +${toot_reblog_button} +
    + +
    +
    + +
    +
    +
    +
    +
  • `); +return $(html) +} else { +for(i=0;i"); +} +const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.reblog.created_at)), +status_attr_datetime = getConversionedDate(null, status.reblog.created_at), +status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), +status_account_link= getRelativeURL(status.account.url, status.account.id); +let alart_text= "", +article_option= "", +toot_reblogs_count= "", +toot_favourites_count = "", +media_views = ""; +if ( status.reblog.spoiler_text ) { +alart_text = ""+status.reblog.spoiler_text+"", +article_option = "content_warning"; +} +if (status.reblog.reblogs_count) { +toot_reblogs_count = status.reblog.reblogs_count; +} +if (status.reblog.favourites_count) { +toot_favourites_count = status.reblog.favourites_count; +} +if ( status.reblog.media_attachments.length ) { +media_views = mediaattachments_template(status.reblog); +} +if(status.account.display_name.length == 0) { +status.account.display_name = status.account.username; +} +if(status.reblog.account.display_name.length == 0) { +status.reblog.account.display_name = status.reblog.account.username; +} +switch(status.reblog.visibility) { +case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; +case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; +} +const html = (` +
  • + +
    + +
    + +
    +
    +
    +
    + + +
    +
    +${alart_text} + +${status.reblog.content} + +${media_views} +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
  • `); +return $(html) +} +} +function notifications_template(NotificationObj) { +const notice_author_link = getRelativeURL(NotificationObj.account.url, NotificationObj.account.id); +if(NotificationObj.account.display_name.length == 0) { +NotificationObj.account.display_name = NotificationObj.account.username; +} +if ( NotificationObj.type === 'favourite' | NotificationObj.type === 'reblog' ) { +const toot_author_link = getRelativeURL(NotificationObj.status.account.url, NotificationObj.status.account.id), +toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, NotificationObj.status.created_at)), +toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at); +if( NotificationObj.type=='favourite' ){ +for(i=0;i"); +} +const html = (` +
  • + +
    +
    +
    + +
    +
    +

    ${NotificationObj.status.content}

    +
    +
    +
    +
    +
  • `); +return $(html); +} else if ( NotificationObj.type === 'reblog' ) { +for(i=0;i"); +} +const sid= NotificationObj.status.id, +html = (` +
  • + +
    +
    +
    + +
    +
    +

    ${NotificationObj.status.content}

    +
    +
    +
    +
    +
  • `); +return $(html); +} +} else if ( NotificationObj.type === 'mention' ) { +const toot_author_link = getRelativeURL(NotificationObj.status.account.url, NotificationObj.status.account.id), +toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, NotificationObj.status.created_at)), +toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at); +let alart_text= "", +article_option= "", +toot_reblogs_count= "", +toot_favourites_count = "", +media_views = ""; +for(i=0;i"); +} +if (NotificationObj.status.spoiler_text) { +alart_text = ''+NotificationObj.status.spoiler_text+'', +article_option = 'content_warning'; +} +if (NotificationObj.status.reblogs_count) { +toot_reblogs_count = NotificationObj.status.reblogs_count; +} +if (NotificationObj.status.favourites_count) { +toot_favourites_count = NotificationObj.status.favourites_count; +} +if (NotificationObj.status.media_attachments.length) { +media_views = mediaattachments_template(NotificationObj.status); +} +if(NotificationObj.status.account.display_name.length == 0) { +NotificationObj.status.account.display_name = NotificationObj.status.account.username; +} +switch(NotificationObj.status.visibility) { +case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; +case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; +case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; +case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; +} +if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { +toot_footer_width = " style='width:320px'"; +toot_reblog_button = (`
    + +
    `); +} +else { +toot_footer_width = ""; +toot_reblog_button = ""; +} +const html=(` +
  • +
    + +
    + +
    +
    +
    +
    + + +
    +
    +${alart_text} + +${NotificationObj.status.content} + +${media_views} +
    +
    +
    + +
    +${toot_reblog_button} +
    + +
    +
    + +
    +
    +
    +
    +
  • `); +return $(html); +} else { +const html=(` +
  • + +
  • `); +return $(html); +} +} +function follows_template(AccountObj) { +const array = AccountObj.url.split('/'), +profile_link = '/'+array[array.length-1]+'@'+array[array.length-2]+'?mid='+AccountObj.id+'&'; +if(AccountObj.display_name.length == 0) { +AccountObj.display_name = AccountObj.username; +} +const html = (` +
    +
    + +
    +
    +
    + +
    + + +
    +

    ${AccountObj.note}

    +
    +
    +
    `); +return $(html) +} +function status_template(status, class_options) { +if ( status.reblog === null ) { +const status_account_link= getRelativeURL(status.account.url, status.account.id), +status_datetime= getConversionedDate(null, status.created_at), +status_attr_datetime = getConversionedDate(null, status.created_at); +let alart_text= "", +article_option= "", +toot_reblogs_count= "", +toot_favourites_count = "", +media_views = ""; +for(i=0;i"); +} +if (status.spoiler_text) { +alart_text = ''+status.spoiler_text+'', +article_option = 'content_warning'; +} +if (status.reblogs_count) { +toot_reblogs_count = status.reblogs_count; +} +if (status.favourites_count) { +toot_favourites_count = status.favourites_count; +} +if (status.media_attachments.length) { +media_views = mediaattachments_template(status); +} +if(status.account.display_name.length == 0) { +status.account.display_name = status.account.username; +} +checked_public = ""; +checked_unlisted = ""; +checked_private = ""; +checked_direct = ""; +switch(status.visibility) { +case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";checked_public=" checked";break; +case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";checked_unlisted=" checked";break; +case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";checked_private=" checked";break; +case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";checked_direct=" checked";break; +} +if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { +toot_footer_width = " style='width:320px'"; +toot_reblog_button = (`
    + +
    `); +} +else { +toot_footer_width = ""; +toot_reblog_button = ""; +} +const html=(` +
    +
    +
    +
    + +
    + + +${htmlEscape(status.account.display_name)} + + +@${status.account.acct} + + + +
    +
    +
    +${alart_text} + +${status.content} + +${media_views} +
    + +
    +
    +
    + +
    +${toot_reblog_button} +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    + +
    + +
    + + +
    +
    + +
    `); +history.pushState(null, null, getRelativeURL(status.account.url, status.account.id, '/status/'+status.id)); +return $(html) +} else { +const status_datetime= getConversionedDate(null, status.reblog.created_at), +status_attr_datetime = getConversionedDate(null, status.reblog.created_at), +status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), +status_account_link= getRelativeURL(status.reblog.account.url, status.reblog.account.id); +let alart_text= "", +article_option= "", +toot_reblogs_count= "", +toot_favourites_count = "", +media_views = ""; +for(i=0;i"); +} +if (status.spoiler_text) { +alart_text = ''+status.reblog.spoiler_text+'', +article_option = 'content_warning'; +} +if (status.reblog.reblogs_count) { +toot_reblogs_count = status.reblog.reblogs_count; +} +if (status.reblog.favourites_count) { +toot_favourites_count = status.reblog.favourites_count; +} +if(status.reblog.media_attachments.length){ +media_views = mediaattachments_template(status.reblog); +} +if(status.account.display_name.length == 0) { +status.account.display_name = status.account.username; +} +if(status.reblog.account.display_name.length == 0) { +status.reblog.account.display_name = status.reblog.account.username; +} +checked_public = ""; +checked_unlisted = ""; +switch(status.reblog.visibility) { +case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";checked_public=" checked";break; +case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";checked_unlisted=" checked";break; +} +const html=(` +
    +
    +
    +
    + +
    + + +${htmlEscape(status.reblog.account.display_name)} + + +@${status.reblog.account.acct} + + + +
    +
    +
    +${alart_text} + +${status.reblog.content} + +${media_views} +
    + +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    + +
    + +
    + + +
    +
    + +
    +`); +history.pushState(null, null, getRelativeURL(status.reblog.account.url, status.reblog.id, '/status/'+status.reblog.id)); +return $(html) +} +} +function media_template(status, mediaURL) { +if ( !status ) { +const html = (` +
    +
    + +
    +
    `); +return $(html) +} else { +const status_template = timeline_template(status).html(), +html = (` +
    +
    + +
    +
    +${status_template} +
    +
    `); +return $(html) +} +} +function context_template(status, class_options) { +if ( status.reblog === null ) { +const status_account_link= getRelativeURL(status.account.url, status.account.id), +status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.created_at)), +status_attr_datetime = getConversionedDate(null, status.created_at); +let alart_text= "", +article_option= "", +toot_reblogs_count= "", +toot_favourites_count = "", +media_views = ""; +for(i=0;i"); +} +if ( status.spoiler_text ) { +alart_text = ''+status.spoiler_text+'', +article_option = 'content_warning'; +} +if (status.reblogs_count) { +toot_reblogs_count = status.reblogs_count; +} +if (status.favourites_count) { +toot_favourites_count = status.favourites_count; +} +if( status.media_attachments.length) { +media_views = mediaattachments_template(status); +} +if(status.account.display_name.length == 0) { +status.account.display_name = status.account.username; +} +switch(status.visibility) { +case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; +case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; +case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; +case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; +} +if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { +toot_footer_width = " style='width:320px'"; +toot_reblog_button = (`
    + +
    `); +} +else { +toot_footer_width = ""; +toot_reblog_button = ""; +} +const html=(` +
    +
    +
    + +
    +
    +
    + + +${htmlEscape(status.account.display_name)} + + +@${status.account.acct} + + + + +
    +
    +${alart_text} + +${status.content} + +${media_views} +
    +
    +
    + +
    +${toot_reblog_button} +
    + +
    +
    + +
    +
    +
    +
    +
    `); +return $(html) +} else { +const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.reblog.created_at)), +status_attr_datetime = getConversionedDate(null, status.reblog.created_at), +status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), +status_account_link= getRelativeURL(status.account.url, status.account.id); +let alart_text= "", +article_option= "", +toot_reblogs_count= "", +toot_favourites_count = "", +media_views = ""; +for(i=0;i"); +} +if ( status.spoiler_text ) { +alart_text = ''+status.reblog.spoiler_text+'', +article_option = 'content_warning'; +} +if (status.reblog.reblogs_count) { +toot_reblogs_count = status.reblog.reblogs_count; +} +if (status.reblog.favourites_count) { +toot_favourites_count = status.reblog.favourites_count; +} +if (status.reblog.media_attachments.length) { +media_views = mediaattachments_template(status.reblog); +} +if(status.account.display_name.length == 0) { +status.account.display_name = status.account.username; +} +if(status.reblog.account.display_name.length == 0) { +status.reblog.account.display_name = status.reblog.account.username; +} +switch(status.reblog.visibility) { +case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; +case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; +} +const html=(` +
    + +
    +
    + +
    +
    +
    + + +${htmlEscape(status.reblog.account.display_name)} + + +@${status.reblog.account.acct} + + + + +
    +
    +${alart_text} + +${status.reblog.content} + +${media_views} +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    `); +return $(html) +} +} diff --git a/assets/js/halcyon/halcyonUI.js b/assets/js/halcyon/halcyonUI.js index f573beb..b0d9799 100644 --- a/assets/js/halcyon/halcyonUI.js +++ b/assets/js/halcyon/halcyonUI.js @@ -152,1186 +152,19 @@ $('.header_my_account_nav').addClass('invisible'); $('.expand_menu').addClass('invisible'); }); }); -function mediaattachments_template(status) { -let media_views = ""; -if(status.media_attachments[0].remote_url != null) { -status.media_attachments[0].url = status.media_attachments[0].remote_url; -} -if ( status.media_attachments[0].url === "/files/original/missing.png" ) { -return ""; -} else if ( !status.sensitive ) { -media_views = `
    `; -} else { -media_views = ` -
    -
    -Sensitive content -Click to view -
    `; -} -if ( status.media_attachments[0].type === "video" | status.media_attachments[0].type === "gifv" ) { -media_views += (` -
    - -
    `); -} else { -if ( status.media_attachments.length <= 2 ) { -for ( let i in status.media_attachments ) { -if(status.media_attachments[i].remote_url != null) { -status.media_attachments[i].url = status.media_attachments[i].remote_url; -} -media_views += (` -
    - -
    `); -} -} else { -for ( let i in status.media_attachments ) { -if (Number(i) === 1) { -if(status.media_attachments[i].remote_url != null) { -status.media_attachments[i].url = status.media_attachments[i].remote_url; -} -media_views += (` -
    -
    - -
    `); -} else { -media_views += (` -
    - -
    `); -} -} -media_views += "
    "; -} -media_views += "
    "; -} -return media_views; -} -function timeline_template(status) { -if (status.reblog === null) { -for(i=0;i"); -} -const status_account_link= getRelativeURL(status.account.url, status.account.id), -status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.created_at)), -status_attr_datetime = getConversionedDate(null, status.created_at); -let alart_text= "", -article_option= "", -toot_reblogs_count= "", -toot_favourites_count = "", -media_views = ""; -if ( status.spoiler_text ) { -alart_text = ""+status.spoiler_text+"", -article_option = "content_warning"; -} -if (status.reblogs_count) { -toot_reblogs_count = status.reblogs_count; -} -if (status.favourites_count) { -toot_favourites_count = status.favourites_count; -} -if ( status.media_attachments.length ) { -media_views = mediaattachments_template(status); -} -if(status.account.display_name.length == 0) { -status.account.display_name = status.account.username; -} -switch(status.visibility) { -case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; -case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; -case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; -case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; -} -if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { -toot_footer_width = " style='width:320px'"; -toot_reblog_button = (`
    - -
    `); -} -else { -toot_footer_width = ""; -toot_reblog_button = ""; -} -const html=(` -
  • -
    - -
    - -
    -
    -
    -
    - - -
    -
    -${alart_text} - -${status.content} - -${media_views} -
    -
    -
    - -
    -${toot_reblog_button} -
    - -
    -
    - -
    -
    -
    -
    -
  • `); -return $(html) -} else { -for(i=0;i"); -} -const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.reblog.created_at)), -status_attr_datetime = getConversionedDate(null, status.reblog.created_at), -status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), -status_account_link= getRelativeURL(status.account.url, status.account.id); -let alart_text= "", -article_option= "", -toot_reblogs_count= "", -toot_favourites_count = "", -media_views = ""; -if ( status.reblog.spoiler_text ) { -alart_text = ""+status.reblog.spoiler_text+"", -article_option = "content_warning"; -} -if (status.reblog.reblogs_count) { -toot_reblogs_count = status.reblog.reblogs_count; -} -if (status.reblog.favourites_count) { -toot_favourites_count = status.reblog.favourites_count; -} -if ( status.reblog.media_attachments.length ) { -media_views = mediaattachments_template(status.reblog); -} -if(status.account.display_name.length == 0) { -status.account.display_name = status.account.username; -} -if(status.reblog.account.display_name.length == 0) { -status.reblog.account.display_name = status.reblog.account.username; -} -switch(status.reblog.visibility) { -case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; -case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; -} -const html = (` -
  • - -
    - -
    - -
    -
    -
    -
    - - -
    -
    -${alart_text} - -${status.reblog.content} - -${media_views} -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
  • `); -return $(html) -} -} -function notifications_template(NotificationObj) { -const notice_author_link = getRelativeURL(NotificationObj.account.url, NotificationObj.account.id); -if(NotificationObj.account.display_name.length == 0) { -NotificationObj.account.display_name = NotificationObj.account.username; -} -if ( NotificationObj.type === 'favourite' | NotificationObj.type === 'reblog' ) { -const toot_author_link = getRelativeURL(NotificationObj.status.account.url, NotificationObj.status.account.id), -toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, NotificationObj.status.created_at)), -toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at); -if( NotificationObj.type=='favourite' ){ -for(i=0;i"); -} -const html = (` -
  • - -
    -
    -
    - -
    -
    -

    ${NotificationObj.status.content}

    -
    -
    -
    -
    -
  • `); -return $(html); -} else if ( NotificationObj.type === 'reblog' ) { -for(i=0;i"); -} -const sid= NotificationObj.status.id, -html = (` -
  • - -
    -
    -
    - -
    -
    -

    ${NotificationObj.status.content}

    -
    -
    -
    -
    -
  • `); -return $(html); -} -} else if ( NotificationObj.type === 'mention' ) { -const toot_author_link = getRelativeURL(NotificationObj.status.account.url, NotificationObj.status.account.id), -toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, NotificationObj.status.created_at)), -toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at); -let alart_text= "", -article_option= "", -toot_reblogs_count= "", -toot_favourites_count = "", -media_views = ""; -for(i=0;i"); -} -if (NotificationObj.status.spoiler_text) { -alart_text = ''+NotificationObj.status.spoiler_text+'', -article_option = 'content_warning'; -} -if (NotificationObj.status.reblogs_count) { -toot_reblogs_count = NotificationObj.status.reblogs_count; -} -if (NotificationObj.status.favourites_count) { -toot_favourites_count = NotificationObj.status.favourites_count; -} -if (NotificationObj.status.media_attachments.length) { -media_views = mediaattachments_template(NotificationObj.status); -} -if(NotificationObj.status.account.display_name.length == 0) { -NotificationObj.status.account.display_name = NotificationObj.status.account.username; -} -switch(NotificationObj.status.visibility) { -case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; -case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; -case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; -case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; -} -if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { -toot_footer_width = " style='width:320px'"; -toot_reblog_button = (`
    - -
    `); -} -else { -toot_footer_width = ""; -toot_reblog_button = ""; -} -const html=(` -
  • -
    - -
    - -
    -
    -
    -
    - - -
    -
    -${alart_text} - -${NotificationObj.status.content} - -${media_views} -
    -
    -
    - -
    -${toot_reblog_button} -
    - -
    -
    - -
    -
    -
    -
    -
  • `); -return $(html); -} else { -const html=(` -
  • - -
  • `); -return $(html); -} -} -function follows_template(AccountObj) { -const array = AccountObj.url.split('/'), -profile_link = '/'+array[array.length-1]+'@'+array[array.length-2]+'?mid='+AccountObj.id+'&'; -if(AccountObj.display_name.length == 0) { -AccountObj.display_name = AccountObj.username; -} -const html = (` -
    -
    - -
    -
    -
    - -
    - - -
    -

    ${AccountObj.note}

    -
    -
    -
    `); -return $(html) -} -function status_template(status, class_options) { -if ( status.reblog === null ) { -const status_account_link= getRelativeURL(status.account.url, status.account.id), -status_datetime= getConversionedDate(null, status.created_at), -status_attr_datetime = getConversionedDate(null, status.created_at); -let alart_text= "", -article_option= "", -toot_reblogs_count= "", -toot_favourites_count = "", -media_views = ""; -for(i=0;i"); -} -if (status.spoiler_text) { -alart_text = ''+status.spoiler_text+'', -article_option = 'content_warning'; -} -if (status.reblogs_count) { -toot_reblogs_count = status.reblogs_count; -} -if (status.favourites_count) { -toot_favourites_count = status.favourites_count; -} -if (status.media_attachments.length) { -media_views = mediaattachments_template(status); -} -if(status.account.display_name.length == 0) { -status.account.display_name = status.account.username; -} -checked_public = ""; -checked_unlisted = ""; -checked_private = ""; -checked_direct = ""; -switch(status.visibility) { -case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";checked_public=" checked";break; -case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";checked_unlisted=" checked";break; -case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";checked_private=" checked";break; -case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";checked_direct=" checked";break; -} -if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { -toot_footer_width = " style='width:320px'"; -toot_reblog_button = (`
    - -
    `); -} -else { -toot_footer_width = ""; -toot_reblog_button = ""; -} -const html=(` -
    -
    -
    -
    - -
    - - -${htmlEscape(status.account.display_name)} - - -@${status.account.acct} - - - -
    -
    -
    -${alart_text} - -${status.content} - -${media_views} -
    - -
    -
    -
    - -
    -${toot_reblog_button} -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    - -
    - -
    - -
    - - -
    -
    - -
    `); -history.pushState(null, null, getRelativeURL(status.account.url, status.account.id, '/status/'+status.id)); -return $(html) -} else { -const status_datetime= getConversionedDate(null, status.reblog.created_at), -status_attr_datetime = getConversionedDate(null, status.reblog.created_at), -status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), -status_account_link= getRelativeURL(status.reblog.account.url, status.reblog.account.id); -let alart_text= "", -article_option= "", -toot_reblogs_count= "", -toot_favourites_count = "", -media_views = ""; -for(i=0;i"); -} -if (status.spoiler_text) { -alart_text = ''+status.reblog.spoiler_text+'', -article_option = 'content_warning'; -} -if (status.reblog.reblogs_count) { -toot_reblogs_count = status.reblog.reblogs_count; -} -if (status.reblog.favourites_count) { -toot_favourites_count = status.reblog.favourites_count; -} -if(status.reblog.media_attachments.length){ -media_views = mediaattachments_template(status.reblog); -} -if(status.account.display_name.length == 0) { -status.account.display_name = status.account.username; -} -if(status.reblog.account.display_name.length == 0) { -status.reblog.account.display_name = status.reblog.account.username; -} -checked_public = ""; -checked_unlisted = ""; -switch(status.reblog.visibility) { -case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";checked_public=" checked";break; -case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";checked_unlisted=" checked";break; -} -const html=(` -
    -
    -
    -
    - -
    - - -${htmlEscape(status.reblog.account.display_name)} - - -@${status.reblog.account.acct} - - - -
    -
    -
    -${alart_text} - -${status.reblog.content} - -${media_views} -
    - -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    - -
    - -
    - -
    - - -
    -
    - -
    -`); -history.pushState(null, null, getRelativeURL(status.reblog.account.url, status.reblog.id, '/status/'+status.reblog.id)); -return $(html) -} -} -function media_template(status, mediaURL) { -if ( !status ) { -const html = (` -
    -
    - -
    -
    `); -return $(html) -} else { -const status_template = timeline_template(status).html(), -html = (` -
    -
    - -
    -
    -${status_template} -
    -
    `); -return $(html) -} -} -function context_template(status, class_options) { -if ( status.reblog === null ) { -const status_account_link= getRelativeURL(status.account.url, status.account.id), -status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.created_at)), -status_attr_datetime = getConversionedDate(null, status.created_at); -let alart_text= "", -article_option= "", -toot_reblogs_count= "", -toot_favourites_count = "", -media_views = ""; -for(i=0;i"); -} -if ( status.spoiler_text ) { -alart_text = ''+status.spoiler_text+'', -article_option = 'content_warning'; -} -if (status.reblogs_count) { -toot_reblogs_count = status.reblogs_count; -} -if (status.favourites_count) { -toot_favourites_count = status.favourites_count; -} -if( status.media_attachments.length) { -media_views = mediaattachments_template(status); -} -if(status.account.display_name.length == 0) { -status.account.display_name = status.account.username; -} -switch(status.visibility) { -case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; -case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; -case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; -case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; -} -if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { -toot_footer_width = " style='width:320px'"; -toot_reblog_button = (`
    - -
    `); -} -else { -toot_footer_width = ""; -toot_reblog_button = ""; -} -const html=(` -
    -
    -
    - -
    -
    -
    - - -${htmlEscape(status.account.display_name)} - - -@${status.account.acct} - - - - -
    -
    -${alart_text} - -${status.content} - -${media_views} -
    -
    -
    - -
    -${toot_reblog_button} -
    - -
    -
    - -
    -
    -
    -
    -
    `); -return $(html) -} else { -const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.reblog.created_at)), -status_attr_datetime = getConversionedDate(null, status.reblog.created_at), -status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), -status_account_link= getRelativeURL(status.account.url, status.account.id); -let alart_text= "", -article_option= "", -toot_reblogs_count= "", -toot_favourites_count = "", -media_views = ""; -for(i=0;i"); -} -if ( status.spoiler_text ) { -alart_text = ''+status.reblog.spoiler_text+'', -article_option = 'content_warning'; -} -if (status.reblog.reblogs_count) { -toot_reblogs_count = status.reblog.reblogs_count; -} -if (status.reblog.favourites_count) { -toot_favourites_count = status.reblog.favourites_count; -} -if (status.reblog.media_attachments.length) { -media_views = mediaattachments_template(status.reblog); -} -if(status.account.display_name.length == 0) { -status.account.display_name = status.account.username; -} -if(status.reblog.account.display_name.length == 0) { -status.reblog.account.display_name = status.reblog.account.username; -} -switch(status.reblog.visibility) { -case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; -case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; -} -const html=(` -
    - -
    -
    - -
    -
    -
    - - -${htmlEscape(status.reblog.account.display_name)} - - -@${status.reblog.account.acct} - - - - -
    -
    -${alart_text} - -${status.reblog.content} - -${media_views} -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    `); -return $(html) -} -} function setTimeline(level,load_options) { +var show_replies = localStorage.setting_show_replies; let isSyncing = true; -if ( load_options === undefined ) { +if(load_options === undefined) { var load_options = []; } api.get(level, load_options, function(statuses) { let reply_sources = {}; -for ( let i in statuses ) { +for(let i in statuses) { +if(!(show_replies == "false" && statuses[i].in_reply_to_id)) { timeline_template(statuses[i]).appendTo("#js-timeline"); -if (statuses[i].in_reply_to_id && level === "timelines/home" | level === "timelines/public" ) { -if (!reply_sources[statuses[i].in_reply_to_id] & !$(".toot_entry[sid='"+statuses[i].in_reply_to_id+"']").length ) { +if(statuses[i].in_reply_to_id && level === "timelines/home" | level === "timelines/public") { +if(!reply_sources[statuses[i].in_reply_to_id] & !$(".toot_entry[sid='"+statuses[i].in_reply_to_id+"']").length) { reply_sources[statuses[i].in_reply_to_id] = statuses[i].id; api.get('statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) { $("#js-timeline .toot_entry[sid='"+reply_sources[in_reply_statuses.id]+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding')); @@ -1339,7 +172,8 @@ replace_emoji(); }); } } -}; +} +} links = getLinkFromXHRHeader(responce_headers); replaceInternalLink(); replace_emoji(); @@ -1356,10 +190,11 @@ load_options.unshift( {name:"max_id",data:links['next'].match(/max_id=(.+)&?/)[1 api.get(level, load_options, function(statuses) { if (statuses.length) { let reply_sources = {}; -for ( let i in statuses ) { +for(let i in statuses) { +if(!(show_replies == "false" && statuses[i].in_reply_to_id)) { timeline_template(statuses[i]).appendTo("#js-timeline"); -if (statuses[i].in_reply_to_id && level === "timelines/home" | level === "timelines/public" ) { -if (!reply_sources[statuses[i].in_reply_to_id] & !$(".toot_entry[sid='"+statuses[i].in_reply_to_id+"']").length) { +if(statuses[i].in_reply_to_id && level === "timelines/home" | level === "timelines/public") { +if(!reply_sources[statuses[i].in_reply_to_id] & !$(".toot_entry[sid='"+statuses[i].in_reply_to_id+"']").length) { reply_sources[statuses[i].in_reply_to_id] = statuses[i].id; api.get('statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) { $("#js-timeline .toot_entry[sid='"+reply_sources[in_reply_statuses.id]+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding')); @@ -1367,14 +202,15 @@ replace_emoji(); }); } } -}; +} +} links = getLinkFromXHRHeader(responce_headers); replaceInternalLink(); replace_emoji(); isSyncing = false; } else { $('.timeline_footer > i').css({"display":"none"}); -$('.timeline_footer').append(''); +$('.timeline_footer').append(''); isSyncing = true; } }); @@ -1397,23 +233,27 @@ let statuses = []; const original_title = $('title').text(); if(streamscope) { api.stream(streamscope, function(userstream) { -if (userstream.event === "update") { +if(userstream.event === "update") { const streaming_option = localStorage.getItem("setting_post_stream"); -if ( streaming_option === "manual" ) { -if ( !$('.toot_entry[sid="'+userstream.payload.id+'"]').length ) { +if(streaming_option === "manual") { +if(!$('.toot_entry[sid="'+userstream.payload.id+'"]').length) { +if(!(show_replies == "false" && userstream.payload.in_reply_to_id)) { $('#js-stream_update').css({'display':'block','height':'auto','padding':'10px'}); statuses.unshift(userstream.payload); $('#js-stream_update > button > span').text(statuses.length); $('title').text("("+statuses.length+") "+original_title); $('#header .header_nav_list .'+scope+'_badge').removeClass('invisible'); } -} else if ( streaming_option === "auto" ) { -if ( !$('.toot_entry[sid="'+userstream.payload.id+'"]').length ) { +} +} +else if (streaming_option === "auto") { +if(!$('.toot_entry[sid="'+userstream.payload.id+'"]').length) { +if(!(show_replies == "false" && userstream.payload.in_reply_to_id)) { timeline_template(userstream.payload).prependTo("#js-timeline"); replaceInternalLink(); replace_emoji(); -if ( level === "timelines/home" | level === "timelines/public" ) { -if (userstream.payload.in_reply_to_id & !$(".toot_entry[sid='"+userstream.in_reply_to_id+"']").length) { +if(level === "timelines/home" | level === "timelines/public") { +if(userstream.payload.in_reply_to_id & !$(".toot_entry[sid='"+userstream.in_reply_to_id+"']").length) { let reply_source = userstream.payload.id; api.get('statuses/'+userstream.payload.in_reply_to_id, function(in_reply_statuses) { $("#js-timeline .toot_entry[sid='"+reply_source+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding')); @@ -1425,13 +265,14 @@ replace_emoji(); } } } +} }); } $(document).on('click','#js-stream_update', function(e) { $('#header .header_nav_list .'+scope+'_badge').addClass('invisible'); $('#js-stream_update').css({'display':'none','height':'0','padding':'0px'}); statuses.reverse(); -for ( let i in statuses ) { +for(let i in statuses) { timeline_template(statuses[i]).prependTo("#js-timeline"); replace_emoji(); if ( level === "timelines/home" | level === "timelines/public" ) { @@ -1450,17 +291,19 @@ statuses = []; }); }; function setOtherTimeline(instance, load_options) { +var show_replies = localStorage.setting_show_replies; let isSyncing = true; -if ( load_options === undefined ) { +if(load_options === undefined) { var load_options = []; } const loadstatus = instance + "timelines/public" api.getOther(loadstatus, load_options, function(statuses) { let reply_sources = {}; -for ( let i in statuses ) { +for(let i in statuses) { +if(!(show_replies == "false" && statuses[i].in_reply_to_id)) { timeline_template(statuses[i]).appendTo("#js-timeline"); -if (statuses[i].in_reply_to_id ) { -if (!reply_sources[statuses[i].in_reply_to_id]) { +if(statuses[i].in_reply_to_id ) { +if(!reply_sources[statuses[i].in_reply_to_id]) { reply_sources[statuses[i].in_reply_to_id] = statuses[i].id; api.getOther(instance + 'statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) { $("#js-timeline .toot_entry[sid='"+reply_sources[in_reply_statuses.id]+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding')); @@ -1468,7 +311,8 @@ replace_emoji(); }); } } -}; +} +} $('.toot_entry .toot_footer').addClass('invisible'); links = getLinkFromXHRHeader(responce_headers); replaceInternalLink(); @@ -1479,17 +323,18 @@ $('#js-timeline_footer > i').css({"display":"none"}); isSyncing = false; }); $(window).scroll(function () { -if ( $(window).scrollTop()+window.innerHeight >= $(document).height()-700 ) { -if (!isSyncing) { +if($(window).scrollTop()+window.innerHeight >= $(document).height()-700) { +if(!isSyncing) { isSyncing = true; load_options.unshift( {name:"max_id",data:links['next'].match(/max_id=(.+)&?/)[1]} ); api.getOther(loadstatus, load_options, function(statuses) { -if (statuses.length) { +if(statuses.length) { let reply_sources = {}; -for ( let i in statuses ) { +for(let i in statuses) { +if(!(show_replies == "false" && statuses[i].in_reply_to_id)) { timeline_template(statuses[i]).appendTo("#js-timeline"); -if (statuses[i].in_reply_to_id ) { -if (!reply_sources[statuses[i].in_reply_to_id]) { +if(statuses[i].in_reply_to_id ) { +if(!reply_sources[statuses[i].in_reply_to_id]) { reply_sources[statuses[i].in_reply_to_id] = statuses[i].id; api.getOther(instance+'statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) { $("#js-timeline .toot_entry[sid='"+reply_sources[in_reply_statuses.id]+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding')); @@ -1497,15 +342,17 @@ replace_emoji(); }); } } -}; +} +} $('.toot_entry .toot_footer').addClass('invisible'); links = getLinkFromXHRHeader(responce_headers); replaceInternalLink(); replace_emoji(); isSyncing = false; -} else { +} +else { $('.timeline_footer > i').css({"display":"none"}); -$('.timeline_footer').append(''); +$('.timeline_footer').append(''); isSyncing = true; } }); @@ -1647,7 +494,7 @@ $("#js_profile_bio").html(AccountObj.note); console.log(AccountObj.id); console.log(current_id); if( AccountObj.id == current_id ) { -$(` +$(` i').attr('class', "fa fa-" + picon); $('#overlay_status_form .character_count').html(current_instance_charlimit); +if(localStorage.setting_post_sensitive == "true") { +$("#overlay_status_nsfw")[0].checked = true; +$('#overlay_status_form .media_attachments_preview_area').addClass('nsfw'); +} }); $(document).on('change keyup','#overlay_status_form textarea, #overlay_status_form .status_spoiler', function(e) { if ( @@ -2000,6 +851,10 @@ autosize($('#header_status_form .status_textarea textarea')); $('#header_status_form .status_bottom').removeClass('invisible'); $('#header_status_form .submit_status_label').addClass('active_submit_button'); $('#header_status_form .character_count').html(current_instance_charlimit); +if(localStorage.setting_post_sensitive == "true") { +$("#header_status_nsfw")[0].checked = true; +$('#header_status_form .media_attachments_preview_area').addClass('nsfw'); +} } }); $(document).on('change','#header_status_media_atta', function(e) { @@ -2099,6 +954,10 @@ $('#reply_status_form .status_bottom').removeClass('invisible'); $('#reply_status_form .submit_status_label').addClass('active_submit_button'); $('#reply_status_form textarea').val("@"+$('#reply_status_form').attr('username')+" "); $('#reply_status_form .character_count').html(current_instance_charlimit); +if(localStorage.setting_post_sensitive == "true") { +$("#reply_status_nsfw")[0].checked = true; +$('#reply_status_form .media_attachments_preview_area').addClass('nsfw'); +} } }); $(document).on('change keyup','#reply_status_form textarea, #reply_status_form .status_spoiler', function(e) { @@ -2253,6 +1112,10 @@ $('#single_reply_status_form').attr('tid',sid); $('.single_reply_status .single_reply_status_header span').text("Reply to "+display_name); $('#single_reply_status_form textarea').val(acct+" "); $('#single_reply_status_form .character_count').html(current_instance_charlimit); +if(localStorage.setting_post_sensitive == "true") { +$("#single_reply_status_nsfw")[0].checked = true; +$('#single_reply_status_form .media_attachments_preview_area').addClass('nsfw'); +} api.get('statuses/'+sid+'/', function(status) { timeline_template(status).appendTo(".single_reply_status .status_preview"); replace_emoji(); @@ -2420,102 +1283,6 @@ history.pushState(null, null, current_file); } }); }) -$(function () { -$(document).on('click','.side_widget.stream_options .form_title button', function(e) { -$(this).parent().next('.pulldown_form').toggleClass('view'); -if ( $(this).text() === "SHOW" ) { -$(this).text("HIDE"); -} else { -$(this).text("SHOW"); -} -const html_post_steraming = $(``) -const html_post_privacy = $(``) -const html_local_instance = $(``) -const html_search_filter = $(``) -html_post_steraming.val(localStorage.getItem("setting_post_stream")); -html_post_privacy.val(localStorage.getItem("setting_post_privacy")); -html_local_instance.val(localStorage.getItem("setting_local_instance")); -html_search_filter.val(localStorage.getItem("setting_search_filter")); -$('.post_steraming_wrap').html(html_post_steraming) -$('.post_privacy_wrap').html(html_post_privacy); -$('.local_instance_wrap').html(html_local_instance); -$('.search_filter_wrap').html(html_search_filter); -return false; -}); -$(document).on('change',".post_steraming_wrap select[name='post_steraming']", function(e) { -localStorage.setItem("setting_post_stream", $(this).val() ); -putMessage("Changed setting to "+$(this).val() ); -}); -$(document).on('change', ".post_privacy_wrap select[name='post_privacy']", function(e) { -localStorage.setItem("setting_post_privacy", $(this).val() ); -putMessage("Changed setting to "+$(this).val() ); -}); -$(document).on('change',".search_filter_wrap select[name='search_filter']", function(e) { -localStorage.setItem("setting_search_filter", $(this).val() ); -putMessage("Changed setting to "+$(this).val() ); -}); -$(document).on('focus',".local_instance_wrap input[name='local_instance']", function(e) { -$(this).attr("placeholder","https://"+current_instance); -}); -$(document).on('change',".local_instance_wrap input[name='local_instance']", function(e) { -if ( $(this).val() ) { -localStorage.setItem("setting_local_instance", $(this).val() ); -} else { -localStorage.setItem("setting_local_instance", "default" ); -} -putMessage("Changed setting to "+$(this).val() ); -}); -$("#setting_link_previews").change(function() { -if(this.checked) { -localStorage.setItem("setting_link_previews","true"); -putMessage("Link previews enabled"); -} -else { -localStorage.setItem("setting_link_previews","false"); -putMessage("Link previews disabled"); -} -}); -$("#setting_desktop_notifications").change(function() { -if(this.checked) { -localStorage.setItem("setting_desktop_notifications","true"); -if (Notification.permission === 'default') { -Notification.requestPermission(function(p) { -if (p === 'denied') { -localStorage.setItem("setting_desktop_notifications","false"); -$("#setting_desktop_notifications")[0].checked = false; -putMessage("You didn't allow notifications"); -} -else { -putMessage("Desktop notifications enabled"); -} -}); -} -else if(Notification.permission == "denied") { -localStorage.setItem("setting_desktop_notifications","false"); -$("#setting_desktop_notifications")[0].checked = false; -putMessage("You didn't allow notifications"); -} -else { -putMessage("Desktop notifications enabled"); -} -} -else { -localStorage.setItem("setting_desktop_notifications","false"); -putMessage("Desktop notifications disabled"); -} -}); -}) $(function() { $("#enable_follow").click(function() { localStorage.setItem("setting_who_to_follow","true"); diff --git a/assets/js/mastodon.js/mastodon.js b/assets/js/mastodon.js/mastodon.js index 974dab6..23e6d22 100644 --- a/assets/js/mastodon.js/mastodon.js +++ b/assets/js/mastodon.js/mastodon.js @@ -249,6 +249,40 @@ location.href = "/logout"; } }); }, +patch: function (endpoint) { +var postData, callback; +if (typeof arguments[1] === "function") { +postData = {}; +callback = arguments[1]; +} else { +postData = arguments[1]; +callback = arguments[2]; +} +var requestHeaders = {"Authorization":"Bearer "+config.api_user_token}; +$.ajax({ +url: apiBase + endpoint, +type: "PATCH", +data: postData, +headers: requestHeaders, +contentType: false, +processData: false, +success: function(data, textStatus) { +console.log("Successful PATCH API request to " +apiBase+endpoint); +callback(data,textStatus) +}, +error: function(xhr, textStatus, errorThrown) { +if(xhr.readyState == 0) { +api.patch(endpoint,postData,callback); +} +else { +putMessage(`[${xhr.status}] ${xhr.responseJSON['error']}`); +if ( xhr.status === 401 ) { +location.href = "/logout"; +} +} +} +}); +}, stream: function (streamType, onData) { var es = new WebSocket("wss://" + apiBase.substr(8) + "streaming?access_token=" + config.api_user_token + "&stream=" + streamType); var listener = function (event) { diff --git a/federated.php b/federated.php index dbc1a04..a014d0e 100644 --- a/federated.php +++ b/federated.php @@ -3,7 +3,6 @@
    @@ -34,4 +33,4 @@ setTimeline("timelines/public"); $("#federated_nav").addClass('view'); $('title').text('Halcyon / Federated'); - \ No newline at end of file + diff --git a/footer.php b/footer.php index 32b5ab5..e9ad06b 100644 --- a/footer.php +++ b/footer.php @@ -18,7 +18,6 @@ setOverlayStatus(''); badges_update(); -$('.header_settings_link').attr('href','https://'+current_instance+'/settings/preferences'); $('.footer_widget_about').attr('href','https://'+current_instance+'/about'); $('.footer_widget_instance').attr('href','https://'+current_instance+'/about/more'); $('.footer_widget_terms').attr('href','https://'+current_instance+'/terms'); diff --git a/header.php b/header.php index 09e3202..745ff99 100644 --- a/header.php +++ b/header.php @@ -1,3 +1,7 @@ + @@ -15,19 +19,18 @@ + - \ No newline at end of file + diff --git a/local.php b/local.php index 7400664..00c2b2f 100644 --- a/local.php +++ b/local.php @@ -3,7 +3,6 @@
    diff --git a/login/auth.php b/login/auth.php index 84c5350..96d1267 100644 --- a/login/auth.php +++ b/login/auth.php @@ -22,7 +22,8 @@ $api->selectInstance($URL); $response = $api->get_access_token($api->clientWebsite.'/auth?&host='.$domain, htmlspecialchars((string)filter_input(INPUT_GET, 'code'), ENT_QUOTES)); if ($response['html']["access_token"]) { $access_token = $response['html']["access_token"]; -$account_id = $api->accounts_verify_credentials()['html']['id']; +$profile = $api->accounts_verify_credentials()['html']; +$account_id = $profile['id']; echo " "; diff --git a/nginx.conf b/nginx.conf index e7ecc16..9c2aaaf 100644 --- a/nginx.conf +++ b/nginx.conf @@ -33,6 +33,9 @@ rewrite ^/federated/?$ /federated.php last; rewrite ^/notifications/?$ /notifications.php last; rewrite ^/search/?$ /search_hash_tag.php last; rewrite ^/search/users/?$ /search_user.php last; +rewrite ^/settings/?$ /settings_general.php last; +rewrite ^/settings/profile/?$ /settings_profile.php last; +rewrite ^/settings/appearance/?$ /settings_appearance.php last; rewrite ^/@(.+)@(.+).([a-z]+)/?$ /user.php?user=@$1@$2.$3 last; rewrite ^/@(.+)@(.+).([a-z]+)/status/(.+?)?$ /user.php?user=@$1@$2.$3&status=$4 last; rewrite ^/@(.+)@(.+).([a-z]+)/media/?$ /user_only_media.php?user=@$1@$2.$3 last; diff --git a/notifications.php b/notifications.php index 44d9baa..b07cd32 100644 --- a/notifications.php +++ b/notifications.php @@ -26,7 +26,7 @@ View new notitification
    @@ -39,4 +39,4 @@ localStorage.setItem("notification_count", 0); setNotifications(); $('title').text('Halcyon / Notifications') - \ No newline at end of file + diff --git a/search_hash_tag.php b/search_hash_tag.php index e40b2f8..ee6fa25 100644 --- a/search_hash_tag.php +++ b/search_hash_tag.php @@ -3,7 +3,6 @@
    @@ -34,15 +33,16 @@ current_file = location.pathname+location.search; $(function() { const query = ""; $('#main > .article_wrap > .center_column > .timeline_header > .header_items > .item').text("#"+query); -$('#js-search_title_box > h1').text(query); +$('#js-header_title_box > h1').text(query); $('title').text('#'+query+' - Halcyon Search'); $('#js-search_nav_toots').toggleClass('view'); $('#js-search_nav_toots a ').attr('href','/search'+location.search); $('#js-search_nav_peoples a ').attr('href','/search/users'+location.search) -if ( localStorage.getItem("setting_search_filter") === "all" ) { +if(localStorage.getItem("setting_search_filter") === "all") { setTimeline("timelines/tag/"+query); -} else if ( localStorage.getItem("setting_search_filter") === "local" ) { -setTimeline("timelines/tag/"+query, [{name:"local",data:"ture"}]); +} +else if(localStorage.getItem("setting_search_filter") === "local") { +setTimeline("timelines/tag/"+query,[{name:"local",data:"true"}]); } replace_emoji(); }); diff --git a/search_user.php b/search_user.php index 1b7d7c2..f836936 100644 --- a/search_user.php +++ b/search_user.php @@ -20,7 +20,7 @@ current_file = location.pathname+location.search; const query = ""; $('title').text(query+' - Halcyon Search'); -$('#js-search_title_box > h1').text(query); +$('#js-header_title_box > h1').text(query); $('#js-search_nav_peoples').toggleClass('view'); $('#js-search_nav_toots a ').attr('href','/search'+location.search); $('#js-search_nav_peoples a ').attr('href','/search/users'+location.search); diff --git a/settings_appearance.php b/settings_appearance.php new file mode 100644 index 0000000..6dfeea3 --- /dev/null +++ b/settings_appearance.php @@ -0,0 +1,68 @@ + +
    + +
    + +
    +
    +
      +
    • Appearance settings
    • +
    +
    +
    +
    +

    New posts streaming

    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +

    Enable link previews

    +
    + +
    +

    Desktop notifications

    +
    +
    +
    + +
    + +
    +
    +
    +
    +

    Show replies

    +
    +
    +
    + +
    + +
    +
    +
    +- +
    +
    +
    +
    + + diff --git a/settings_general.php b/settings_general.php new file mode 100644 index 0000000..e0a348e --- /dev/null +++ b/settings_general.php @@ -0,0 +1,84 @@ + +
    + +
    + +
    +
    +
      +
    • General settings
    • +
    +
    +
    +
    +

    Default post privacy

    +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +

    Mark as NSFW by default

    +
    +
    +
    + +
    + +
    +
    +
    +
    +

    Local instance

    +
    +
    + +
    +
    +

    Hashtag search filter

    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +

    Who to follow

    +
    +
    +
    + +
    + +
    +
    +
    +- +
    +
    +
    +
    + + diff --git a/settings_profile.php b/settings_profile.php new file mode 100644 index 0000000..cbd1b8d --- /dev/null +++ b/settings_profile.php @@ -0,0 +1,75 @@ + + +
    + +
    + +
    +
    +
      +
    • Profile settings
    • +
    +
    +
    +
    +

    Display name

    +
    +
    + +
    +
    +

    About me

    +
    +
    + +
    +
    +

    Avatar

    +
    +
    + + + +
    +
    +

    Header

    +
    +
    + + + +
    +
    +

    Lock account

    +
    + +- +
    +
    + +
    +
    +
    +
    + + diff --git a/version.txt b/version.txt index 2bf1ca5..26aaba0 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.1.7 +1.2.0 diff --git a/widgets/search_header.php b/widgets/search_header.php index 2a6124e..2b283e8 100644 --- a/widgets/search_header.php +++ b/widgets/search_header.php @@ -1,16 +1,16 @@ -
    +

    -
    -
    - diff --git a/widgets/settings_header.php b/widgets/settings_header.php new file mode 100644 index 0000000..0a83294 --- /dev/null +++ b/widgets/settings_header.php @@ -0,0 +1,26 @@ +
    +

    Settings

    +
    +
    diff --git a/widgets/side_footer.php b/widgets/side_footer.php index a0e16e1..7754a5e 100644 --- a/widgets/side_footer.php +++ b/widgets/side_footer.php @@ -13,7 +13,7 @@ Halcyon for Mastodon Apps
  • -Source code +Source code
  • Other instances diff --git a/widgets/side_load_options.php b/widgets/side_load_options.php deleted file mode 100644 index 05464bb..0000000 --- a/widgets/side_load_options.php +++ /dev/null @@ -1,34 +0,0 @@ -
    -
    -

    Preferences

    - -
    -
    -

    New posts streaming

    -
    -
    -

    Default post privacy

    -
    -
    -

    Local instance

    -
    -
    -

    Hashtag search filter

    -
    -
    -

    Enable link previews

    -
    - -
    - -
    -
    -

    Desktop notifications

    -
    - -
    - -
    -
    -
    -