Complete remake of the settings with many new options, added support for Caddy server, updated repository link in footer

This commit is contained in:
nipos 2018-06-09 17:29:25 +02:00
parent 1bf3b0d761
commit 64f18146a2
27 changed files with 1959 additions and 1424 deletions

View File

@ -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
</IfModule>

109
Caddyfile Normal file
View File

@ -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
}
}

View File

@ -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

View File

@ -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;
}

View File

@ -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();

View File

@ -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");
}
})
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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) {

View File

@ -3,7 +3,6 @@
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_current_user.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_load_options.php'); ?>
</aside>
<article class="center_column">
<header class="timeline_header">
@ -34,4 +33,4 @@ setTimeline("timelines/public");
$("#federated_nav").addClass('view');
$('title').text('Halcyon / Federated');
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -18,7 +18,6 @@
setOverlayStatus('<?php echo $_GET['status']; ?>');
<?php endif; ?>
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');

View File

@ -1,3 +1,7 @@
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
@ -15,19 +19,18 @@
<script src="/assets/js/autosize/autosize.js"></script>
<script src="/assets/js/shortcut.js"></script>
<script src="/assets/js/replace_emoji.js"></script>
<script src="/assets/js/halcyon/halcyonTemplates.js"></script>
<script src="/assets/js/halcyon/halcyonUI.js"></script>
<script src="//cdn.staticfile.org/twemoji/2.2.5/twemoji.min.js"></script>
<script>
if (
!localStorage.getItem("current_id") |
!localStorage.getItem("current_instance") |
!localStorage.getItem("current_authtoken")
){
if(!localStorage.getItem("current_id") | !localStorage.getItem("current_instance") | !localStorage.getItem("current_authtoken")) {
location.href = "/login";
} else {
if( $.cookie("session") === "true" ) {
}
else {
if($.cookie("session") === "true") {
refreshApp();
} else if ( $.cookie("session") === undefined ) {
}
else if($.cookie("session") === undefined) {
resetApp();
}
}
@ -104,7 +107,7 @@ resetApp();
</ul>
<ul>
<li>
<a class="header_settings_link" href="">Settings</a>
<a href="/settings">Settings</a>
</li>
<li>
<a href="/logout">Log out</a>

View File

@ -3,7 +3,6 @@
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_current_user.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_load_options.php'); ?>
</aside>
<article class="center_column">
<header class="timeline_header">
@ -34,4 +33,4 @@ setTimeline("timelines/home");
$("#home_nav").addClass('view');
$('title').text('Halcyon');
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -3,7 +3,6 @@
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_current_user.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_load_options.php'); ?>
</aside>
<article class="center_column">
<header class="timeline_header">

View File

@ -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 "
<script>
localStorage.setItem('current_id','$account_id');
@ -35,6 +36,9 @@ localStorage.setItem('setting_search_filter', 'all');
localStorage.setItem('setting_link_previews', 'true');
localStorage.setItem('setting_desktop_notifications', 'true');
localStorage.setItem('setting_who_to_follow', 'false');
localStorage.setItem('setting_show_replies', 'true');
localStorage.setItem('setting_post_privacy','".$profile["source"]["privacy"]."');
localStorage.setItem('setting_post_sensitive','".$profile["source"]["sensitive"]."');
location.href = '/';
</script>
";

View File

@ -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;

View File

@ -26,7 +26,7 @@ View <span></span> new notitification
</article>
<aside class="right_column">
<section class="side_widgets_wrap">
<?php include dirname(__FILE__).('/widgets/side_what_to_follow.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_who_to_follow.php'); ?>
</section>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>
@ -39,4 +39,4 @@ localStorage.setItem("notification_count", 0);
setNotifications();
$('title').text('Halcyon / Notifications')
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -3,7 +3,6 @@
<?php include dirname(__FILE__).('/widgets/search_header.php'); ?>
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_load_options.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_who_to_follow.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>
@ -34,15 +33,16 @@ current_file = location.pathname+location.search;
$(function() {
const query = "<?= htmlspecialchars((string)filter_input(INPUT_GET, 'q'), ENT_QUOTES) ?>";
$('#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();
});

View File

@ -20,7 +20,7 @@ current_file = location.pathname+location.search;
<?php if(isset($_GET['q'])): ?>
const query = "<?= htmlspecialchars((string)filter_input(INPUT_GET, 'q'), ENT_QUOTES) ?>";
$('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);

68
settings_appearance.php Normal file
View File

@ -0,0 +1,68 @@
<?php include ('header.php'); ?>
<main id="main">
<?php include dirname(__FILE__).('/widgets/settings_header.php'); ?>
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_current_user.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>
<article class="center_column">
<header class="timeline_header">
<ul class="header_items">
<li class="item toots view">Appearance settings</li>
</ul>
</header>
<div class="timeline">
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>New posts streaming</h3>
</div>
<div class="post_streaming_wrap" style="float:left;width:75%;margin-top:8px;margin-bottom:-8px">
<div class="radiobox">
<input id="streaming-1" name="post_streaming" type="radio" value="auto">
<label for="streaming-1" class="radiotext">Auto update</label>
</div>
<div class="radiobox">
<input id="streaming-2" name="post_streaming" type="radio" value="manual">
<label for="streaming-2" class="radiotext">Manual update</label>
</div>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Enable link previews</h3>
</div>
<div class="link_previews_wrap" style="float:left;width:75%">
<div class="switch">
<input type="checkbox" id="setting_link_previews">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Desktop notifications</h3>
</div>
<div class="desktop_notifications_wrap" style="float:left;width:75%">
<div class="switch">
<input type="checkbox" id="setting_desktop_notifications">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Show replies</h3>
</div>
<div class="show_replies_wrap" style="float:left;width:75%">
<div class="switch">
<input type="checkbox" id="setting_show_replies">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<span style="visibility:hidden">-</span>
</div>
</article>
</div>
</main>
<script src="/assets/js/halcyon/halcyonSettings.js"></script>
<?php include ('footer.php'); ?>

84
settings_general.php Normal file
View File

@ -0,0 +1,84 @@
<?php include ('header.php'); ?>
<main id="main">
<?php include dirname(__FILE__).('/widgets/settings_header.php'); ?>
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_current_user.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>
<article class="center_column">
<header class="timeline_header">
<ul class="header_items">
<li class="item toots view">General settings</li>
</ul>
</header>
<div class="timeline">
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Default post privacy</h3>
</div>
<div class="post_privacy_wrap" style="float:left;width:75%;margin-top:8px;margin-bottom:-8px">
<div class="radiobox">
<input id="privacy-1" name="post_privacy" type="radio" value="public">
<label for="privacy-1" class="radiotext">Public</label>
</div>
<div class="radiobox">
<input id="privacy-2" name="post_privacy" type="radio" value="unlisted">
<label for="privacy-2" class="radiotext">Unlisted</label>
</div>
<div class="radiobox">
<input id="privacy-3" name="post_privacy" type="radio" value="private">
<label for="privacy-3" class="radiotext">Followers-only</label>
</div>
<div class="radiobox">
<input id="privacy-4" name="post_privacy" type="radio" value="direct">
<label for="privacy-4" class="radiotext">Direct</label>
</div>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Mark as NSFW by default</h3>
</div>
<div class="post_sensitive_wrap" style="float:left;width:75%">
<div class="switch">
<input type="checkbox" id="setting_post_sensitive">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Local instance</h3>
</div>
<div class="local_instance_wrap" style="float:left;width:75%">
<input name="local_instance" placeholder="default" type="text" class="disallow_enter textfield" id="setting_local_instance">
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Hashtag search filter</h3>
</div>
<div class="search_filter_wrap" style="float:left;width:75%;margin-top:8px;margin-bottom:-8px">
<div class="radiobox">
<input id="locinstance-1" name="search_filter" type="radio" value="all">
<label for="locinstance-1" class="radiotext">All instances</label>
</div>
<div class="radiobox">
<input id="locinstance-2" name="search_filter" type="radio" value="local">
<label for="locinstance-2" class="radiotext">Local only</label>
</div>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Who to follow</h3>
</div>
<div class="who_to_follow_wrap" style="float:left;width:75%">
<div class="switch">
<input type="checkbox" id="setting_who_to_follow">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<span style="visibility:hidden">-</span>
</div>
</article>
</div>
</main>
<script src="/assets/js/halcyon/halcyonSettings.js"></script>
<?php include ('footer.php'); ?>

75
settings_profile.php Normal file
View File

@ -0,0 +1,75 @@
<?php include ('header.php'); ?>
<style>
.uploadbtn:before {
position:absolute;
left:0;
right:0;
text-align:center;
font-size:12px;
font-weight:600;
content:"Select file and upload";
}
</style>
<main id="main">
<?php include dirname(__FILE__).('/widgets/settings_header.php'); ?>
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_current_user.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>
<article class="center_column">
<header class="timeline_header">
<ul class="header_items">
<li class="item toots view">Profile settings</li>
</ul>
</header>
<div class="timeline">
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Display name</h3>
</div>
<div class="display_name_wrap" style="float:left;width:75%">
<input name="display_name" type="text" class="disallow_enter textfield" id="setting_display_name" maxlength="30">
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>About me</h3>
</div>
<div class="about_me_wrap" style="float:left;width:75%">
<textarea name="about_me" class="disallow_enter textfield" id="setting_about_me" maxlength="160" style="resize:none;height:100px;font-family:arial;padding:5px"></textarea>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Avatar</h3>
</div>
<div class="avatar_wrap" style="float:left;width:75%">
<span class="halcyon_button uploadbtn" style="width:calc(50% - 2px);margin:10px;padding:0;height:28px;position:relative">
<input name="avatar" type="file" id="setting_avatar" style="opacity:0;width:100%;height:100%;float:left">
</span>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Header</h3>
</div>
<div class="header_wrap" style="float:left;width:75%">
<span class="halcyon_button uploadbtn" style="width:calc(50% - 2px);margin:10px;padding:0;height:28px;position:relative">
<input name="header" type="file" id="setting_header" style="opacity:0;width:100%;height:100%;float:left">
</span>
</div>
<div style="float:left;width:25%;text-align:right;margin-top:16px">
<h3>Lock account</h3>
</div>
<div class="lock_account_wrap" style="float:left;width:75%">
<div class="switch">
<input type="checkbox" id="setting_lock_account">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<span style="visibility:hidden">-</span>
</div>
<footer id="js-timeline_footer" class="timeline_footer">
<i id="savestate" class="fa fa-spin fa-circle-o-notch" aria-hidden="true"></i>
</footer>
</article>
</div>
</main>
<script src="/assets/js/halcyon/halcyonSettings.js"></script>
<?php include ('footer.php'); ?>

View File

@ -1 +1 @@
1.1.7
1.2.0

View File

@ -1,16 +1,16 @@
<div id="js-search_title_box">
<div id="js-header_title_box">
<h1></h1>
</div>
<div class="search_nav_wrap">
<div class="search_nav">
<div class="search_nav_left">
<ul class="search_nav_list">
<li id="js-search_nav_toots" class="search_nav_item search_toots">
<div class="header_nav_wrap">
<div class="header_nav">
<div class="header_nav_left">
<ul class="header_nav_list">
<li id="js-search_nav_toots" class="header_nav_item search_toots">
<a>
<h2>TOOTS</h2>
</a>
</li>
<li id="js-search_nav_peoples" class="search_nav_item search_following">
<li id="js-search_nav_peoples" class="header_nav_item search_following">
<a>
<h2>PEOPLE</h2>
</a>
@ -18,4 +18,4 @@
</ul>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,26 @@
<div id="js-header_title_box">
<h1>Settings</h1>
</div>
<div class="header_nav_wrap">
<div class="header_nav">
<div class="header_nav_left">
<ul class="header_nav_list">
<li id="js-settings_nav_general" class="header_nav_item settings_general">
<a href="/settings">
<h2>GENERAL</h2>
</a>
</li>
<li id="js-settings_nav_profile" class="header_nav_item settings_profile">
<a href="/settings/profile">
<h2>PROFILE</h2>
</a>
</li>
<li id="js-settings_nav_appearance" class="header_nav_item settings_appearance">
<a href="/settings/appearance">
<h2>APPEARANCE</h2>
</a>
</li>
</ul>
</div>
</div>
</div>

View File

@ -13,7 +13,7 @@ Halcyon for <a href="https://github.com/tootsuite/mastodon">Mastodon</a>
<a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md">Apps</a>
</li>
<li>
<a href="https://github.com/halcyon-suite/halcyon">Source code</a>
<a href="https://notabug.org/halcyon-suite/halcyon">Source code</a>
</li>
<li>
<a href="http://instances.social">Other instances</a>

View File

@ -1,34 +0,0 @@
<div class="side_widget stream_options">
<div class="form_title">
<h2>Preferences</h2>
<button>SHOW</button>
</div>
<form name="stream_options_form" class="pulldown_form">
<h3>New posts streaming</h3>
<div class="post_steraming_wrap">
</div>
<h3>Default post privacy</h3>
<div class="post_privacy_wrap">
</div>
<h3>Local instance</h3>
<div class="local_instance_wrap">
</div>
<h3>Hashtag search filter</h3>
<div class="search_filter_wrap">
</div>
<h3>Enable link previews</h3>
<div class="switch">
<input type="checkbox" id="setting_link_previews">
<div class="switch-btn">
<span></span>
</div>
</div>
<h3>Desktop notifications</h3>
<div class="switch">
<input type="checkbox" id="setting_desktop_notifications">
<div class="switch-btn">
<span></span>
</div>
</div>
</form>
</div>