Merge branch 'master' of github.com:m1k1o/blog into Phundrak-dev

This commit is contained in:
Miroslav Šedivý 2020-04-07 17:30:56 +02:00
commit a55ad19c9c
7 changed files with 165 additions and 22 deletions

View file

@ -129,12 +129,11 @@ To check if your server is set up correctly, turn on a debug mode (in config add
# Features
* Dark mode, retina ready, legacy theme available.
* Create own language mutations, available: **English** and **German**.
* Use BBcode in texts.
* Make posts available for **everyone**, **only you** or just for **friends**.
* Extra fields in post: **Feeling**, **With** and **At**.
* Hide posts from timeline so they are visible only when you need them to be.
* All pasted links will get preview with page title, description and image.
* All pasted links will get preview with page title, description and image (can be configured proxy).
* Upload images using button *(for mobile)*.
* Upload images using drag & drop *(drop it into textarea)*.
* Upload images using CTRL + V *(paste it into textarea)*.
@ -146,3 +145,10 @@ To check if your server is set up correctly, turn on a debug mode (in config add
* Display posts from chosen date using (format YYYY-MM-DD or YYY-MM): `http://blog/#from=2017-06`.
* Display posts to chosen date using (format YYYY-MM-DD or YYY-MM): `http://blog/#to=2017-06`.
* Combine parameters in url using `&`, e.g. show posts between dates: `http://blog/#from=2017-06&to=2017-08`.
## Language support
Feel free to create new PR and add a new language. Specify language in config or in url: `http://blog/?hl=sk`.
* en - 🇬🇧 English
* de - 🇩🇪 German
* sk - 🇸🇰 Slovak

67
app/lang/sk.ini Normal file
View file

@ -0,0 +1,67 @@
; index.html
Show More = "Zobraziť viac"
Login = "Prihlásiť sa"
Logout = "Odhlásiť sa"
Nick = "Prihlasovacie meno"
Password = "Heslo"
Cancel = "Zrušiť"
Post = "Nový príspevok"
Edit Post = "Upraviť príspevok"
Change Date = "Zmeniť dátum"
Hide from Timeline = "Skryť na časovej osi"
Show on Timeline = "Zobraziť na časovej osi"
Delete Post = "Odstrániť príspevok"
Drag photos here = "Sem presuňte fotografie"
Drop photos here = "Tu vložte fotografie"
What's on your mind? = "Na čo myslíš?"
Feeling = "Pocit"
How are you feeling? = "Ako sa cítiš?"
With = "Spolu s"
Who are you with? = "S kým si?"
At = "Miesto"
Where are you? = "Kde si?"
Save = "Uložiť"
January = "Január"
February = "Február"
March = "Marec"
April = "Apríl"
May = "Máj"
June = "Jún"
July = "Júl"
August = "August"
September = "September"
October = "Október"
November = "November"
December = "December"
Time: = "Čas:"
Hour: = "Hodnia:"
Minute: = "Minúta:"
This post will be deleted and you'll no longer be able to find it. You can also edit this post if you just want to change something. = "Tento príspevok bude odstránený a už ho nebudete môcť nájsť. Tento príspevok môžete tiež upraviť, ak chcete niečo zmeniť."
with = "s"
here: = "tu:"
Public = "Verejné"
Friends = "Priatelia"
Only me = "Iba ja"
Show hidden content = "Zobraziť skrytý obsah"
Show all posts = "Zobraziť všetky príspevky"
; user.class.php
You are already logged in. = "Už si prihlásený."
The nick or password is incorrect. = "Prihlasovacie meno alebo heslo je nesprávne."
You can't log out. There is no account. = "Nemôžeš sa odhlásiť. Neexistuje žiadny účet."
You are not even logged in. = "Nie si ani prihlásený."
; post.class.php
You need to be logged in to perform this action. = "Na vykonanie tejto akcie musíš byť prihlásený."
No data. = "Žiadne dáta."

View file

@ -244,15 +244,53 @@ class Post
}
preg_match('/^https?:\/\/(www\.)?([^:\/\s]+)(.*)?$/i', $l, $url);
$curl_request_url = $l;
// Get content
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_ENCODING , "");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $l);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Proxycat/1.1)");
curl_setopt($ch, CURLOPT_REFERER, '');
curl_setopt($ch, CURLOPT_TIMEOUT, 7); // 7sec
// Proxy settings
if($proxy = Config::get_safe("proxy", false)){
$proxytype = Config::get_safe("proxytype", false);
$proxyauth = Config::get_safe("proxyauth", false);
if($proxytype === 'URL_PREFIX'){
$curl_request_url = $proxy.$curl_request_url;
if($proxyauth){
curl_setopt($ch, CURLOPT_USERPWD, $proxyauth);
}
} else {
curl_setopt($ch, CURLOPT_PROXY, $proxy);
if($proxyauth){
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
}
switch ($proxytype) {
case 'CURLPROXY_SOCKS4':
$proxytype = CURLPROXY_SOCKS4;
break;
case 'CURLPROXY_SOCKS5':
$proxytype = CURLPROXY_SOCKS5;
break;
case 'CURLPROXY_HTTP':
default:
$proxytype = CURLPROXY_HTTP;
break;
}
curl_setopt($ch, CURLOPT_PROXYTYPE, $proxytype);
}
}
curl_setopt($ch, CURLOPT_URL, $curl_request_url);
$html = curl_exec($ch);
curl_close($ch);
@ -298,7 +336,22 @@ class Post
}
if($n == 'twitter:image:src' || $p == 'og:image'){
$content["thumb"] = $c;
// Absolute url
if(preg_match("/^(https?:)?\/\//", $c)) {
$content["thumb"] = $c;
}
// Relative url from root
elseif(preg_match("/^\//", $c)) {
preg_match("/^((?:https?:)?\/\/([^\/]+))(\/|$)/", $l, $m);
$content["thumb"] = $m[1].'/'.$c;
}
// Relative url from current directory
else {
preg_match("/^((?:https?:)?\/\/[^\/]+.*?)(\/[^\/]*)?$/", $l, $m);
$content["thumb"] = $m[1].'/'.$c;
}
}
if($n == 'twitter:domain'){

View file

@ -43,8 +43,20 @@ images_path = data/i/
thumbnails_path = data/t/
logs_path = data/logs/
[proxy]
;proxy = hostname:port
;proxyauth = username:password
;proxytype = CURLPROXY_HTTP ; default, if not set
;proxytype = CURLPROXY_SOCKS4
;proxytype = CURLPROXY_SOCKS5
;URL_PREFIX type:
;proxy = http://your.page.com/proxy.cgi?
;proxyauth = username:password
;proxytype = URL_PREFIX
[system]
system_name = blog
version = 1.25
version = 1.253
debug = false
logs = false

View file

@ -6,12 +6,13 @@ $("#dd_mask").click(function(){
// Posts loading functions
var posts = {
first: false, // Is first loaded?
last: false, // Is last loaded?
loading: false, // Is something loading right now?
initialized: false, // Is initialized?
first: false, // Is first loaded?
last: false, // Is last loaded?
loading: false, // Is something loading right now?
limit: 5, // Limit posts per load
offset: 0, // Current offset
limit: 5, // Limit posts per load
offset: 0, // Current offset
filter: {
from: null, // Show posts from specified date
@ -57,7 +58,7 @@ var posts = {
load: function(){
// If is something loading now or is loading done
if(posts.loading || posts.last)
if(!posts.initialized || posts.loading || posts.last)
return ;
// Now is
@ -111,6 +112,8 @@ var posts = {
init: function(){
posts.hash_update();
posts.initialized = true;
posts.load();
}
};
@ -742,7 +745,7 @@ $.fn.post_fill = function(data){
*/
var height = 200;
if(data.text.length > 400){
if(data.text.length > 400 && post.find(".show_more").length == 0){
post.find(".b_text").css("max-height", height+"px");
var show_more = $('#prepared .show_more').clone();
show_more.insertAfter(post.find(".b_text"));
@ -750,6 +753,8 @@ $.fn.post_fill = function(data){
$(this).remove();
post.find(".b_text").css("max-height", '');
});
} else if(post.find(".show_more").length != 0) {
post.find(".show_more").remove();
}
// Highlight

View file

@ -156,10 +156,6 @@ body {
background: white;
}
.b_post.is_hidden {
border-color: black;
}
.b_post.is_hidden .b_overlay {
display: flex;
}

View file

@ -28,6 +28,7 @@
--filter: none;
--filter-hover: invert(0.25);
--overlay-background: rgba(0, 0, 0, .25);
--overlay-fallback-background: #ccc;
}
@media (prefers-color-scheme: dark) {
@ -61,6 +62,7 @@
--filter: invert(0.62) sepia(0.98) saturate(0.12) hue-rotate(175deg) brightness(0.9) contrast(0.96);
--filter-hover: invert(1);
--overlay-background: rgba(255, 255, 255, .25);
--overlay-fallback-background: #555;
}
}
@ -212,18 +214,20 @@ body {
height: 100%;
border-radius: 8px;
z-index: 1;
backdrop-filter: blur(25px);
background: var(--overlay-background);
background: var(--overlay-fallback-background);
}
@supports (backdrop-filter: blur(25px)) {
.b_overlay {
backdrop-filter: blur(25px);
background: var(--overlay-background);
}
}
.b_overlay .button {
background: var(--primary-background);
}
.b_post.is_hidden {
box-shadow: inset 0px 0px 9px -1px var(--primary-text)
}
.b_post.is_hidden .b_overlay {
display: flex;
}