Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
afa89836d2 | ||
![]() |
d25b53ab33 | ||
![]() |
f17219d054 | ||
![]() |
1583120679 | ||
![]() |
5651c47b1d |
10 changed files with 86 additions and 38 deletions
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
github: [ m1k1o ]
|
58
.github/workflows/build.yml
vendored
58
.github/workflows/build.yml
vendored
|
@ -2,10 +2,13 @@ name: "CI for builds"
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
DOCKER_IMAGE: m1k1o/blog:latest
|
||||
IMAGE_NAME: m1k1o/blog
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -15,18 +18,41 @@ jobs:
|
|||
#
|
||||
if: github.repository_owner == 'm1k1o'
|
||||
steps:
|
||||
- name: Check Out Repo
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
run: |
|
||||
docker login --username "${DOCKER_USERNAME}" --password-stdin "${DOCKER_REGISTRY}" <<< "${DOCKER_TOKEN}"
|
||||
env:
|
||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Build blog
|
||||
run: |
|
||||
docker build -t ${DOCKER_IMAGE} .
|
||||
docker push ${DOCKER_IMAGE}
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
-
|
||||
name: Available platforms
|
||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
-
|
||||
name: Extract metadata (tags, labels) for Docker
|
||||
uses: docker/metadata-action@v3
|
||||
id: meta
|
||||
with:
|
||||
images: ${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
-
|
||||
name: Log in to the Container registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
push: true
|
||||
|
|
|
@ -208,9 +208,10 @@ To check if your server is set up correctly, turn on a debug mode (in config add
|
|||
* Upload images using CTRL + V *(paste it into textarea)*.
|
||||
* Highlight code in post using `[code]..your code..[/code]`.
|
||||
* Highlight your goal using `[goal]Text of your goal.[/goal]`.
|
||||
* Use tags in posts (allowed characters `A-Za-z0-9-_` terminated by space or EOL): `#song`
|
||||
* Sort posts by hashtags: `http://blog/#tag=songs`
|
||||
* Sort posts by location in url using: `http://blog/#loc=Vienna`.
|
||||
* Use tags in posts (allowed characters `A-Za-z0-9-_` terminated by space or EOL): `#song`.
|
||||
* Sort posts in reverse order (oldest first): `http://blog/#sort=reverse`.
|
||||
* Filter posts by hashtags: `http://blog/#tag=songs`.
|
||||
* Filter posts by location in url using: `http://blog/#loc=Vienna`.
|
||||
* 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`.
|
||||
|
|
|
@ -449,7 +449,7 @@ class Post
|
|||
($loc ? "`location` $like_match AND " : "").
|
||||
($person ? "`persons` $like_match AND " : "").
|
||||
"`status` <> 5
|
||||
ORDER BY `posts`.`datetime` DESC
|
||||
ORDER BY `posts`.`datetime` ".(@$r["sort"] == 'reverse' ? "ASC" : "DESC")."
|
||||
LIMIT ? OFFSET ?
|
||||
", $from, $to, $id, $tag, $loc, $person, $r["limit"], $r["offset"]
|
||||
)->all();
|
||||
|
|
|
@ -72,6 +72,6 @@ logs_path = data/logs/
|
|||
|
||||
[system]
|
||||
;timezone = Europe/Vienna
|
||||
version = 1.41
|
||||
version = 1.42
|
||||
debug = false
|
||||
logs = false
|
||||
|
|
22
index.php
22
index.php
|
@ -13,12 +13,6 @@ if(empty($_SESSION['token'])){
|
|||
function escape($str) {
|
||||
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
function encodeURIComponent($str) {
|
||||
return rawurlencode($str);
|
||||
}
|
||||
function encodeURI($str) {
|
||||
return implode('/', array_map('rawurlencode', explode('/', $str)));
|
||||
}
|
||||
|
||||
//$.ajaxSetup({headers:{'Csrf-Token':'token'}});
|
||||
|
||||
|
@ -50,7 +44,7 @@ if(!empty($styles)){
|
|||
}
|
||||
|
||||
$styles = array_unique($styles);
|
||||
$styles = array_map('encodeURI', $styles);
|
||||
$styles = array_map('escape', $styles);
|
||||
$styles_html = '<link href="'.implode('" rel="stylesheet" type="text/css"/>'.PHP_EOL.'<link href="', $styles).'" rel="stylesheet" type="text/css"/>'.PHP_EOL;
|
||||
}
|
||||
|
||||
|
@ -63,14 +57,14 @@ if(!empty($scripts)){
|
|||
}
|
||||
|
||||
$scripts = array_unique($scripts);
|
||||
$scripts = array_map('encodeURI', $scripts);
|
||||
$scripts = array_map('escape', $scripts);
|
||||
$scripts_html = '<script src="'.implode('" type="text/javascript"></script>'.PHP_EOL.'<script src="', $scripts).'" type="text/javascript"></script>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// Use version suffix in URLs to prevent cache
|
||||
$versionSuffix = '';
|
||||
if (Config::get_safe("version", false)) {
|
||||
$versionSuffix = '?v='.encodeURIComponent(Config::get("version"));
|
||||
$versionSuffix = '?v='.rawurlencode(Config::get("version"));
|
||||
}
|
||||
|
||||
?><!DOCTYPE html>
|
||||
|
@ -85,7 +79,7 @@ if (Config::get_safe("version", false)) {
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
|
||||
<link href="static/styles/main.css<?php echo $versionSuffix?>" rel="stylesheet" type="text/css" />
|
||||
<link href="static/styles/<?php echo encodeURI(Config::get_safe("theme", "theme01")); ?>.css<?php echo $versionSuffix?>" rel="stylesheet" type="text/css" />
|
||||
<link href="static/styles/<?php echo rawurlencode(Config::get_safe("theme", "theme01")); ?>.css<?php echo $versionSuffix?>" rel="stylesheet" type="text/css" />
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans&subset=all" rel="stylesheet">
|
||||
|
||||
|
@ -187,7 +181,7 @@ if (Config::get_safe("version", false)) {
|
|||
<div class="modal-body drop_space">
|
||||
<div class="e_drag"><span><?php echo __("Drag photos here"); ?></span></div>
|
||||
<div class="e_drop"><span><?php echo __("Drop photos here"); ?></span></div>
|
||||
<img src="<?php echo encodeURI(Config::get("pic_small")); ?>" width="40" height="40" class="e_profile">
|
||||
<img src="<?php echo escape(Config::get("pic_small")); ?>" width="40" height="40" class="e_profile">
|
||||
<!--<div class="e_text" contenteditable="true"></div>-->
|
||||
<div class="t_area">
|
||||
<textarea class="e_text" placeholder="<?php echo __("What's on your mind?"); ?>"></textarea>
|
||||
|
@ -299,7 +293,7 @@ if (Config::get_safe("version", false)) {
|
|||
<a class="button"><?php echo __("Show hidden content"); ?></a>
|
||||
</div>
|
||||
<div class="b_header">
|
||||
<img src="<?php echo encodeURI(Config::get("pic_small")); ?>" width="40" height="40" class="b_profile">
|
||||
<img src="<?php echo escape(Config::get("pic_small")); ?>" width="40" height="40" class="b_profile">
|
||||
<div class="b_desc">
|
||||
<div class="b_sharer">
|
||||
<span class="b_name"><?php echo escape(Config::get("name")); ?></span><span class="b_options"> - </span><span class="b_feeling"></span><span class="b_with"> <?php echo __("with"); ?> </span><span class="b_persons"></span><span class="b_here"> <?php echo __("here:"); ?> </span><span class="b_location"></span>
|
||||
|
@ -329,9 +323,9 @@ if (Config::get_safe("version", false)) {
|
|||
<div class="cover">
|
||||
<?php echo $header; ?>
|
||||
<div class="overlay"></div>
|
||||
<?php echo (Config::get_safe("cover", false) ? '<img src="'.encodeURI(Config::get("cover")).'">' : (empty($header) ? '<div style="padding-bottom: 37%;"></div>' : '')); ?>
|
||||
<?php echo (Config::get_safe("cover", false) ? '<img src="'.escape(Config::get("cover")).'">' : (empty($header) ? '<div style="padding-bottom: 37%;"></div>' : '')); ?>
|
||||
<div class="profile">
|
||||
<img src="<?php echo encodeURI(Config::get("pic_big")); ?>">
|
||||
<img src="<?php echo escape(Config::get("pic_big")); ?>">
|
||||
</div>
|
||||
<div class="name"><?php echo escape(Config::get("name")); ?></div>
|
||||
</div>
|
||||
|
|
|
@ -13,6 +13,7 @@ var posts = {
|
|||
|
||||
limit: 5, // Limit posts per load
|
||||
offset: 0, // Current offset
|
||||
sort: "default", // Default is from newest to oldest posts (use reverse for oldest to newest)
|
||||
|
||||
filter: {
|
||||
from: null, // Show posts from specified date
|
||||
|
@ -34,6 +35,10 @@ var posts = {
|
|||
|
||||
// Update ID hash
|
||||
location.hash.replace(/([a-z]+)\=([^\&]+)/g, function(_, key, value){
|
||||
if (key == "sort") {
|
||||
posts.sort = decodeURIComponent(value);
|
||||
return;
|
||||
}
|
||||
posts.filter[key] = decodeURIComponent(value);
|
||||
$(".more_posts").show();
|
||||
});
|
||||
|
@ -72,6 +77,7 @@ var posts = {
|
|||
action: "load",
|
||||
limit: posts.limit,
|
||||
offset: posts.offset,
|
||||
sort: posts.sort,
|
||||
filter: posts.filter
|
||||
},
|
||||
success: function(posts_data){
|
||||
|
|
|
@ -51,9 +51,11 @@ var datepick = function(container) {
|
|||
var thead = $(
|
||||
'<thead>' +
|
||||
'<tr>' +
|
||||
'<th><button type="button" class="button blue prev_y" title="Previous Year"><<</button></th>' +
|
||||
'<th><button type="button" class="button blue prev" title="Previous Month"><</button></th>' +
|
||||
'<th class="month-pick" colspan="5" title="Select Month">'+this.months[this.m]+' '+this.y+'</th>' +
|
||||
'<th class="month-pick" colspan="3" title="Select Month">'+this.months[this.m]+' '+this.y+'</th>' +
|
||||
'<th><button type="button" class="button blue next" title="Next Month">></button></th>' +
|
||||
'<th><button type="button" class="button blue next_y" title="Next Year">>></button></th>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<th>Mo</th>' +
|
||||
|
@ -68,12 +70,22 @@ var datepick = function(container) {
|
|||
);
|
||||
|
||||
var x = this;
|
||||
$(thead).find(".prev_y").click(function(){
|
||||
x.dec_y();
|
||||
x.load_table();
|
||||
$(thead).find(".month-pick").text(x.months[x.m]+' '+x.y);
|
||||
});
|
||||
$(thead).find(".prev").click(function(){
|
||||
x.dec_m();
|
||||
x.load_table();
|
||||
$(thead).find(".month-pick").text(x.months[x.m]+' '+x.y);
|
||||
});
|
||||
|
||||
$(thead).find(".next_y").click(function(){
|
||||
x.inc_y();
|
||||
x.load_table();
|
||||
$(thead).find(".month-pick").text(x.months[x.m]+' '+x.y);
|
||||
});
|
||||
$(thead).find(".next").click(function(){
|
||||
x.inc_m();
|
||||
x.load_table();
|
||||
|
|
|
@ -1055,7 +1055,8 @@ code {
|
|||
text-align: center;
|
||||
}
|
||||
.datepicker table {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.datepicker th,
|
||||
|
@ -1063,6 +1064,9 @@ code {
|
|||
width: 12.5%;
|
||||
}
|
||||
|
||||
.datepicker th {
|
||||
padding: 5px 0;
|
||||
}
|
||||
.datepicker td {
|
||||
color: #999;
|
||||
padding: 5px;
|
||||
|
|
|
@ -1173,7 +1173,8 @@ code {
|
|||
text-align: center;
|
||||
}
|
||||
.datepicker table {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.datepicker th,
|
||||
|
@ -1181,6 +1182,9 @@ code {
|
|||
width: 12.5%;
|
||||
}
|
||||
|
||||
.datepicker th {
|
||||
padding: 5px 0;
|
||||
}
|
||||
.datepicker td {
|
||||
color: var(--datepicker-inactive-month);
|
||||
padding: 5px;
|
||||
|
|
Loading…
Add table
Reference in a new issue