Some bug fixes and added a config file for nginx

This commit is contained in:
nipos 2018-04-15 19:21:52 +02:00
parent 5407f0320d
commit d054979598
11 changed files with 89 additions and 15 deletions

View File

@ -9,6 +9,7 @@ A Mastodon web client that looks like Twitter
Follow or Mastodon account and never miss an important update: [@halcyon@social.csswg.org](https://social.csswg.org/@halcyon)
## Blog
- Release of Version 1.1.1 - Fixed error 404 when viewing profile of own instance,numbers below profile on the left do now change during session,added nginx config
- [Release of Version 1.1.0 and upcoming features](http://nikisoft.myblog.de/nikisoft/art/11389499/Halcyon-What-we-did-and-what-we-will-do)
- Release of Version 1.0.3 - "Who to follow" doesn't show people you already follow anymore and design of preferences and search bar is now much better
- Release of Version 1.0.2 - Fixed a Firefox-only bug and some wrong links, added version info and an annoying cookie notice (sorry, but that's EU law)
@ -17,7 +18,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://halcyon.toromino.de - 1.1.0
- https://halcyon.toromino.de - 1.1.1
- https://social.dev-wiki.de - 1.1.0
- https://itter.photog.social - 1.1.0
- https://halcyon.cybre.space - Outdated

View File

@ -1579,6 +1579,9 @@ $('#header .header_nav_list .notification_badge').removeClass('invisible');
$('#header .header_nav_list .notification_badge').text( current_count );
}
api.stream("user", function(userstream) {
if(userstream.event == "notification" && userstream.payload.type == "follow") {
$(".js_current_followers_count").html(++localStorage.current_followers_count);
}
if (userstream.event === "update" & location.pathname !== "/" ) {
$('#header .header_nav_list .home_badge').removeClass('invisible');
} else if (userstream.event === "notification" & location.pathname !== "/notifications") {

View File

@ -136,6 +136,15 @@ type: "POST",
data: postData,
headers: {"Authorization": "Bearer " + config.api_user_token},
success: function(data, textStatus) {
if(endpoint == "statuses") {
$(".js_current_toots_count").html(++localStorage.current_statuses_count);
}
else if(endpoint.indexOf("/follow") != -1) {
$(".js_current_following_count").html(++localStorage.current_following_count);
}
else if(endpoint.indexOf("/unfollow") != -1) {
$(".js_current_following_count").html(--localStorage.current_following_count);
}
console.log("Successful POST API request to " +apiBase+endpoint);
callback(data,textStatus)
},
@ -181,6 +190,9 @@ url: apiBase + endpoint,
type: "DELETE",
headers: {"Authorization": "Bearer " + config.api_user_token},
success: function(data, textStatus) {
if(endpoint.indexOf("statuses") != -1) {
$(".js_current_toots_count").html(--localStorage.current_statuses_count);
}
console.log("Successful DELETE API request to " +apiBase+endpoint);
callback(data,textStatus)
},
@ -204,4 +216,4 @@ onData(event);
es.onmessage = listener;
}
};
};
};

58
nginx.conf Normal file
View File

@ -0,0 +1,58 @@
server {
listen 80;
server_name YOUR_DOMAIN;
location / { return 301 https://$host$request_uri; }
}
server {
listen 443 ssl;
server_name YOUR_DOMAIN;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_certificate /etc/CHANGE_THIS/fullchain.pem;
ssl_certificate_key /etc/CHANGE_THIS/privkey.pem;
keepalive_timeout 70;
sendfile on;
client_max_body_size 0;
root /srv/http;
index index.php;
location ~* (?:DESIGN|(?:gpl|README|LICENSE)[^.]*|LEGALNOTICE)(?:\.txt)*$ {
return 302 /;
}
location ~* \.(?:bat|git|ini|sh|svn[^.]*|txt|tpl|xml)$ {
return 404;
}
rewrite ^/home/?$ / permanent;
rewrite ^/login/?$ /login/login.php last;
rewrite ^/auth/?$ /login/auth.php last;
rewrite ^/logout/?$ /login/logout.php last;
rewrite ^/terms/?$ /login/terms.php last;
rewrite ^/local/?$ /local.php last;
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 ^/@(.+)@(.+).([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;
rewrite ^/@(.+)@(.+).([a-z]+)/with_replies/?$ /user_include_replies.php?user=@$1@$2.$3 last;
rewrite ^/@(.+)@(.+).([a-z]+)/followers/?$ /user_followers.php?user=@$1@$2.$3 last;
rewrite ^/@(.+)@(.+).([a-z]+)/following/?$ /user_following.php?user=@$1@$2.$3 last;
rewrite ^/@(.+)@(.+).([a-z]+)/favourites/?$ /user_favorite.php?user=@$1@$2.$3 last;
rewrite ^/avatars/original/missing.png$ /assets/images/missing.png last;
rewrite ^/headers/original/missing.png$ /assets/images/missing_header.png last;
rewrite ^/404/?$ /404.php last;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}

View File

@ -91,7 +91,7 @@ const query = '<?= htmlspecialchars((string)filter_input(INPUT_GET, 'user'), ENT
api.get('search', [{name:'q',data:query},{name:'resolve',data:'true'}], function(search) {
if ( !search.accounts.length ) {
location.href = "/404.php";
} else if ( "@"+search.accounts[0].acct === query ) {
} else if ("@"+search.accounts[0].acct === query || "@"+search.accounts[0].acct+"@"+localStorage.current_instance === query) {
$('title').text(replaced_emoji_return(search.accounts[0].display_name)+' (@'+search.accounts[0].acct+') | Halcyon');
setAccount(search.accounts[0]);
setTimeline("accounts/"+search.accounts[0].id+"/statuses",[{name:'exclude_replies',data:'true'}]);
@ -103,4 +103,4 @@ location.href = "/404.php";
})
<?php endif; ?>
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -77,7 +77,7 @@ const query = '<?= htmlspecialchars((string)filter_input(INPUT_GET, 'user'), ENT
api.get('search', [{name:'q',data:query},{name:'resolve',data:'true'}], function(search) {
if ( !search.accounts.length ) {
location.href="/404.php";
} else if ( "@"+search.accounts[0].acct === query ) {
} else if ("@"+search.accounts[0].acct === query || "@"+search.accounts[0].acct+"@"+localStorage.current_instance === query) {
setAccount(search.accounts[0]);
setTimeline("favourites");
setRecentImages(search.accounts[0]);
@ -88,4 +88,4 @@ location.href="/404.php";
})
<?php endif; ?>
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -59,7 +59,7 @@ const query = '<?= htmlspecialchars((string)filter_input(INPUT_GET, 'user'), ENT
api.get('search', [{name:'q',data:query},{name:'resolve',data:'true'}], function(search) {
if ( !search.accounts.length ) {
location.href="/404.php";
} else if ( "@"+search.accounts[0].acct === query ) {
} else if ("@"+search.accounts[0].acct === query || "@"+search.accounts[0].acct+"@"+localStorage.current_instance === query) {
setAccount(search.accounts[0]);
setFollows(search.accounts[0].id,'followers',[{name:'limit',data:18}]);
setRecentImages(search.accounts[0].id);
@ -70,4 +70,4 @@ location.href="/404.php";
})
<?php endif; ?>
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -59,7 +59,7 @@ const query = '<?= htmlspecialchars((string)filter_input(INPUT_GET, 'user'), ENT
api.get('search', [{name:'q',data:query},{name:'resolve',data:'true'}], function(search) {
if ( !search.accounts.length ) {
location.href="/404.php";
} else if ( "@"+search.accounts[0].acct === query ) {
} else if ("@"+search.accounts[0].acct === query || "@"+search.accounts[0].acct+"@"+localStorage.current_instance === query) {
setAccount(search.accounts[0]);
setFollows(search.accounts[0].id,'following',[{name:'limit',data:18}]);
setRecentImages(search.accounts[0].id);
@ -70,4 +70,4 @@ location.href="/404.php";
})
<?php endif; ?>
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -90,7 +90,7 @@ const query = '<?= htmlspecialchars((string)filter_input(INPUT_GET, 'user'), ENT
api.get('search', [{name:'q',data:query},{name:'resolve',data:'true'}], function(search) {
if ( !search.accounts.length ) {
location.href = "/404.php";
} else if ( "@"+search.accounts[0].acct === query ) {
} else if ("@"+search.accounts[0].acct === query || "@"+search.accounts[0].acct+"@"+localStorage.current_instance === query) {
setAccount(search.accounts[0]);
setTimeline("accounts/"+search.accounts[0].id+"/statuses");
setRecentImages(search.accounts[0].id);
@ -101,4 +101,4 @@ location.href = "/404.php";
})
<?php endif; ?>
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -90,7 +90,7 @@ const query = '<?= htmlspecialchars((string)filter_input(INPUT_GET, 'user'), ENT
api.get('search', [{name:'q',data:query},{name:'resolve',data:'true'}], function(search) {
if ( !search.accounts.length ) {
location.href="/404.php";
} else if ( "@"+search.accounts[0].acct === query ) {
} else if ("@"+search.accounts[0].acct === query || "@"+search.accounts[0].acct+"@"+localStorage.current_instance === query) {
setAccount(search.accounts[0]);
setTimeline("accounts/"+search.accounts[0].id+"/statuses",[{name:'only_media',data:'true'}]);
setRecentImages(search.accounts[0].id);
@ -101,4 +101,4 @@ location.href="/404.php";
})
<?php endif; ?>
</script>
<?php include ('footer.php'); ?>
<?php include ('footer.php'); ?>

View File

@ -1 +1 @@
1.1.0
1.1.1