diff --git a/.freshrss.env.sample b/.freshrss.env.sample new file mode 100644 index 0000000..68c8ad3 --- /dev/null +++ b/.freshrss.env.sample @@ -0,0 +1,2 @@ +CRON_MIN=*/10 +TZ=America/New_York \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b4ddabf --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +volumes/ +data/conf/traefik/acme.json +*.env \ No newline at end of file diff --git a/.mariadb.env.sample b/.mariadb.env.sample new file mode 100644 index 0000000..2b1b863 --- /dev/null +++ b/.mariadb.env.sample @@ -0,0 +1 @@ +MYSQL_ROOT_PASSWORD= \ No newline at end of file diff --git a/.wallabag.env.sample b/.wallabag.env.sample new file mode 100644 index 0000000..2541a83 --- /dev/null +++ b/.wallabag.env.sample @@ -0,0 +1,12 @@ +MYSQL_ROOT_PASSWORD= +SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql +SYMFONY__ENV__DATABASE_HOST=mariadb +SYMFONY__ENV__DATABASE_PORT=3306 +SYMFONY__ENV__DATABASE_NAME= +SYMFONY__ENV__DATABASE_USER= +SYMFONY__ENV__SECRET= +SYMFONY__ENV__DATABASE_PASSWORD= +SYMFONY__ENV__DATABASE_CHARSET=utf8mb4 +SYMFONY__ENV__FOSUSER_REGISTRATION=false +SYMFONY__ENV__FOSUSER_CONFIRMATION=false +SYMFONY__ENV__DOMAIN_NAME=https://[your site here] \ No newline at end of file diff --git a/.yourls.env.sample b/.yourls.env.sample new file mode 100644 index 0000000..20a25f8 --- /dev/null +++ b/.yourls.env.sample @@ -0,0 +1,7 @@ +YOURLS_DB_HOST=mariadb +YOURLS_DB_USER= +YOURLS_DB_PASS= +YOURLS_DB_NAME= +YOURLS_SITE=https://[your site here] +YOURLS_USER= +YOURLS_PASS= \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ba603b2 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +Self Hosted Configuration +----- + +A self-hosted configuration to help escape big tech. + +* Wallabag +* Yourls +* FreshRSS +* NextCloud diff --git a/Slides.pdf b/Slides.pdf new file mode 100644 index 0000000..49fec2b Binary files /dev/null and b/Slides.pdf differ diff --git a/data/conf/traefik/traefik.toml b/data/conf/traefik/traefik.toml new file mode 100644 index 0000000..3771ccd --- /dev/null +++ b/data/conf/traefik/traefik.toml @@ -0,0 +1,19 @@ +[log] + level = "ERROR" + +[providers.docker] + exposedByDefault = false + endpoint = "tcp://dockerproxy:2375" + network = "traefik" + +[entryPoints] + [entryPoints.web] + address = ":80" + [entryPoints.web-secure] + address = ":443" + +[certificatesResolvers] + [certificatesResolvers.default.acme] + email = "my@email.address" + storage = "acme.json" + [certificatesResolvers.default.acme.tlsChallenge] diff --git a/data/conf/yourls/plugins/fallback-url/plugin.php b/data/conf/yourls/plugins/fallback-url/plugin.php new file mode 100644 index 0000000..da73166 --- /dev/null +++ b/data/conf/yourls/plugins/fallback-url/plugin.php @@ -0,0 +1,60 @@ +Fallback URL Plugin Config +

Here you can configure the URL to redirect in case the keyword is not found in database.

+
+

+

+
+HTML; +} + +// Update option in database +function dp_config_update_option() { + $in = $_POST['fallback_url']; + + if( $in ) { + // Validate test_option. ALWAYS validate and sanitize user input. + // Here, we want an string + $in = strval( $in); + + // Update value in database + yourls_update_option( 'fallback_url', $in ); + } +} diff --git a/data/conf/yourls/plugins/hyphens-in-urls/README.md b/data/conf/yourls/plugins/hyphens-in-urls/README.md new file mode 100644 index 0000000..ba72883 --- /dev/null +++ b/data/conf/yourls/plugins/hyphens-in-urls/README.md @@ -0,0 +1,6 @@ +Hyphens in URLs +=============== +This is a core plugin, bundled with YOURLS. +Don't modify this plugin. Instead, copy its folder +and modify your own copy. This way, your code won't +be overwritten when you upgrade YOURLS. \ No newline at end of file diff --git a/data/conf/yourls/plugins/hyphens-in-urls/plugin.php b/data/conf/yourls/plugins/hyphens-in-urls/plugin.php new file mode 100644 index 0000000..3803412 --- /dev/null +++ b/data/conf/yourls/plugins/hyphens-in-urls/plugin.php @@ -0,0 +1,19 @@ +http://sho.rt/hello-world) +Version: 1.0 +Author: Ozh +Author URI: http://ozh.org/ +*/ + +// No direct call +if( !defined( 'YOURLS_ABSPATH' ) ) die(); + +yourls_add_filter( 'get_shorturl_charset', 'ozh_hyphen_in_charset' ); +function ozh_hyphen_in_charset( $in ) { + return $in.'-'; +} + + diff --git a/data/conf/yourls/plugins/index.html b/data/conf/yourls/plugins/index.html new file mode 100644 index 0000000..cfce37c --- /dev/null +++ b/data/conf/yourls/plugins/index.html @@ -0,0 +1,8 @@ + + + + + +YOURLS has nothing for you to see here. + + \ No newline at end of file diff --git a/data/conf/yourls/plugins/random-bg/README.md b/data/conf/yourls/plugins/random-bg/README.md new file mode 100644 index 0000000..f3867fa --- /dev/null +++ b/data/conf/yourls/plugins/random-bg/README.md @@ -0,0 +1,6 @@ +Random Background +================= +This is a sample plugin, for illustration purpose. +Don't modify this plugin. Instead, copy its folder +and modify your own copy. This way, your code won't +be overwritten when you upgrade YOURLS. \ No newline at end of file diff --git a/data/conf/yourls/plugins/random-bg/img/bg_ants.png b/data/conf/yourls/plugins/random-bg/img/bg_ants.png new file mode 100644 index 0000000..1b736b0 Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_ants.png differ diff --git a/data/conf/yourls/plugins/random-bg/img/bg_boobs.png b/data/conf/yourls/plugins/random-bg/img/bg_boobs.png new file mode 100644 index 0000000..09d2dd4 Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_boobs.png differ diff --git a/data/conf/yourls/plugins/random-bg/img/bg_circles.png b/data/conf/yourls/plugins/random-bg/img/bg_circles.png new file mode 100644 index 0000000..27c2884 Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_circles.png differ diff --git a/data/conf/yourls/plugins/random-bg/img/bg_cross.png b/data/conf/yourls/plugins/random-bg/img/bg_cross.png new file mode 100644 index 0000000..3129cdd Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_cross.png differ diff --git a/data/conf/yourls/plugins/random-bg/img/bg_diag.png b/data/conf/yourls/plugins/random-bg/img/bg_diag.png new file mode 100644 index 0000000..f3c5fb7 Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_diag.png differ diff --git a/data/conf/yourls/plugins/random-bg/img/bg_fuzzy.png b/data/conf/yourls/plugins/random-bg/img/bg_fuzzy.png new file mode 100644 index 0000000..6850ca4 Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_fuzzy.png differ diff --git a/data/conf/yourls/plugins/random-bg/img/bg_fuzzy_bits.png b/data/conf/yourls/plugins/random-bg/img/bg_fuzzy_bits.png new file mode 100644 index 0000000..91ff805 Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_fuzzy_bits.png differ diff --git a/data/conf/yourls/plugins/random-bg/img/bg_life.png b/data/conf/yourls/plugins/random-bg/img/bg_life.png new file mode 100644 index 0000000..7d3e54f Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_life.png differ diff --git a/data/conf/yourls/plugins/random-bg/img/bg_yourls.png b/data/conf/yourls/plugins/random-bg/img/bg_yourls.png new file mode 100644 index 0000000..d96cde8 Binary files /dev/null and b/data/conf/yourls/plugins/random-bg/img/bg_yourls.png differ diff --git a/data/conf/yourls/plugins/random-bg/plugin.php b/data/conf/yourls/plugins/random-bg/plugin.php new file mode 100644 index 0000000..a6768ff --- /dev/null +++ b/data/conf/yourls/plugins/random-bg/plugin.php @@ -0,0 +1,27 @@ + + body {background:#e3f3ff url($rnd) repeat;} + + +CSS; +} + diff --git a/data/conf/yourls/plugins/random-keywords/LICENSE.md b/data/conf/yourls/plugins/random-keywords/LICENSE.md new file mode 100644 index 0000000..c9dd08b --- /dev/null +++ b/data/conf/yourls/plugins/random-keywords/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 YOURLS + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/data/conf/yourls/plugins/random-keywords/README.md b/data/conf/yourls/plugins/random-keywords/README.md new file mode 100644 index 0000000..380f1b6 --- /dev/null +++ b/data/conf/yourls/plugins/random-keywords/README.md @@ -0,0 +1,20 @@ +Random Keywords +=============== + +Plugin for [YOURLS](http://yourls.org) `1.5+`. + +Description +----------- +Assign random keywords to shorturls, like bitly (ie http://sho.rt/hJudjK). + +Installation +------------ +1. In `/user/plugins`, create a new folder named `random-keywords`. +2. Drop these files in that directory. +3. Go to the Plugins administration page ( *eg* `http://sho.rt/admin/plugins.php` ) and activate the plugin. +4. Have fun! + +License +------- +YOURLS' license, aka *"Do whatever the hell you want with it"*. +_YOURLS MIT License_ diff --git a/data/conf/yourls/plugins/random-keywords/plugin.php b/data/conf/yourls/plugins/random-keywords/plugin.php new file mode 100644 index 0000000..68066c5 --- /dev/null +++ b/data/conf/yourls/plugins/random-keywords/plugin.php @@ -0,0 +1,42 @@ +Random ShortURLs plugin cannot function unless Random Keywords is removed first." ); +} else { + // filter registration happens conditionally, to avoid conflicts + // settings action is left out here, as it allows checking settings before deleting the old plugin + yourls_add_filter( 'random_keyword', 'ozh_random_shorturl' ); + yourls_add_filter( 'get_next_decimal', 'ozh_random_shorturl_next_decimal' ); +} + +// Generate a random keyword +function ozh_random_shorturl() { + $possible = yourls_get_shorturl_charset() ; + $str=''; + while( strlen( $str ) < yourls_get_option( 'random_shorturls_length', 5 ) ) { + $str .= substr($possible, rand( 0, strlen( $possible ) - 1 ), 1 ); + } + return $str; +} + +// Don't increment sequential keyword tracker +function ozh_random_shorturl_next_decimal( $next ) { + return ( $next - 1 ); +} + +// Plugin settings page etc. +yourls_add_action( 'plugins_loaded', 'ozh_random_shorturl_add_settings' ); +function ozh_random_shorturl_add_settings() { + yourls_register_plugin_page( 'random_shorturl_settings', 'Random ShortURLs Settings', 'ozh_random_shorturl_settings_page' ); +} + +function ozh_random_shorturl_settings_page() { + // Check if form was submitted + if( isset( $_POST['random_length'] ) ) { + // If so, verify nonce + yourls_verify_nonce( 'random_shorturl_settings' ); + // and process submission if nonce is valid + ozh_random_shorturl_settings_update(); + } + + $random_length = yourls_get_option('random_shorturls_length'); + $nonce = yourls_create_nonce( 'random_shorturl_settings' ); + + echo << +

Random ShortURLs Settings

+
+ +

+ + +

+

+
+ +HTML; +} + +function ozh_random_shorturl_settings_update() { + $random_length = $_POST['random_length']; + + if( $random_length ) { + if( is_numeric( $random_length ) ) { + yourls_update_option( 'random_shorturls_length', intval( $random_length ) ); + } else { + echo "Error: Length given was not a number."; + } + } else { + echo "Error: No length value given."; + } +} diff --git a/data/conf/yourls/plugins/sample-page/README.md b/data/conf/yourls/plugins/sample-page/README.md new file mode 100644 index 0000000..5bba6de --- /dev/null +++ b/data/conf/yourls/plugins/sample-page/README.md @@ -0,0 +1,6 @@ +Sample Page +=========== +This is a sample plugin, for illustration purpose. +Don't modify this plugin. Instead, copy its folder +and modify your own copy. This way, your code won't +be overwritten when you upgrade YOURLS. \ No newline at end of file diff --git a/data/conf/yourls/plugins/sample-page/plugin.php b/data/conf/yourls/plugins/sample-page/plugin.php new file mode 100644 index 0000000..717961d --- /dev/null +++ b/data/conf/yourls/plugins/sample-page/plugin.php @@ -0,0 +1,63 @@ +Sample Plugin Administration Page +

This plugin stores an integer in the option database

+
+ +

+

+
+ +HTML; +} + +// Update option in database +function ozh_yourls_samplepage_update_option() { + $in = $_POST['test_option']; + + if( $in ) { + // Validate test_option. ALWAYS validate and sanitize user input. + // Here, we want an integer + $in = intval( $in); + + // Update value in database + yourls_update_option( 'test_option', $in ); + } +} \ No newline at end of file diff --git a/data/conf/yourls/plugins/sample-plugin/README.md b/data/conf/yourls/plugins/sample-plugin/README.md new file mode 100644 index 0000000..720c698 --- /dev/null +++ b/data/conf/yourls/plugins/sample-plugin/README.md @@ -0,0 +1,6 @@ +Sample Plugin +============= +This is a sample plugin, for illustration purpose. +Don't modify this plugin. Instead, copy its folder +and modify your own copy. This way, your code won't +be overwritten when you upgrade YOURLS. \ No newline at end of file diff --git a/data/conf/yourls/plugins/sample-plugin/plugin.php b/data/conf/yourls/plugins/sample-plugin/plugin.php new file mode 100644 index 0000000..40dc1ab --- /dev/null +++ b/data/conf/yourls/plugins/sample-plugin/plugin.php @@ -0,0 +1,61 @@ +Plugin API documentation for more details. +Version: 0.1 +Author: Ozh +Author URI: http://ozh.org/ +*/ + +// No direct call +if( !defined( 'YOURLS_ABSPATH' ) ) die(); + +/* Example of an action + * + * We're going to add an entry to the menu. + * + * The menu is drawn by function yourls_html_menu() in file includes/functions-html.php. + * Right before the function outputs the closing , notice the following function call: + * yourls_do_action( 'admin_menu' ); + * This function says: "hey, for your information, I've just done something called 'admin menu', thought I'd let you know..." + * + * We're going to hook into this action and add our menu entry + */ + +yourls_add_action( 'admin_menu', 'ozh_sample_add_menu' ); +/* This says: when YOURLS does action 'admin_menu', call function 'ozh_sample_add_menu' + */ + +function ozh_sample_add_menu() { + echo '
  • Ozh
  • '; +} +/* And that's it. Activate the plugin and notice the new menu entry. + */ + + + +/* Example of a filter + * + * We're going to modify the of pages in the admin area + * + * The <title> tag is generated by function yourls_html_head() in includes/functions-html.php + * Notice the following function call: + * $title = yourls_apply_filter( 'html_title', 'YOURLS: Your Own URL Shortener' ); + * This function means: give $title the value "YOURLS: Your Own URL Shortener", unless a + * filter modifies this value. + * + * We're going to hook into this filter and modify this value. + */ + +yourls_add_filter( 'html_title', 'ozh_sample_change_title' ); +/* This says: when filter 'html_title' is triggered, send its value to function 'ozh_sample_change_title' + * and use what this function will return. + */ + +function ozh_sample_change_title( $value ) { + $value = $value . ' -- the sample plugin is activated'; + return $value; // a filter *always* has to return a value +} +/* And that's it. Activate the plugin and notice how the page title changes */ + diff --git a/data/conf/yourls/plugins/sample-toolbar/README.md b/data/conf/yourls/plugins/sample-toolbar/README.md new file mode 100644 index 0000000..a7bae40 --- /dev/null +++ b/data/conf/yourls/plugins/sample-toolbar/README.md @@ -0,0 +1,6 @@ +Sample Toolbar +============== +This is a sample plugin, for illustration purpose. +Don't modify this plugin. Instead, copy its folder +and modify your own copy. This way, your code won't +be overwritten when you upgrade YOURLS. \ No newline at end of file diff --git a/data/conf/yourls/plugins/sample-toolbar/css/toolbar.css b/data/conf/yourls/plugins/sample-toolbar/css/toolbar.css new file mode 100644 index 0000000..59c7607 --- /dev/null +++ b/data/conf/yourls/plugins/sample-toolbar/css/toolbar.css @@ -0,0 +1,79 @@ +body { + margin:0; + overflow:hidden; + background-color:#fff; + font-size:12px; + font-family: Verdana, Arial; + padding:35px 0 0; +} + +#yourls-frame { + width: 100%; + height:100%; + z-index: 1; +} + +#yourls-bar { + font-family: Verdana, Arial; + font-size: 12px; + position:absolute; + top:0; + height:35px; + width:100%; + background:#e3f3ff url(../img/toolbar_bg.png) repeat-x bottom center; + color:#2A85B3; + -moz-box-shadow: 0 1px 5px rgba(0,0,0,0.5); + -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5); + z-index: 900000; +} + +#yourls-bar a { + text-decoration:none; + color:#2A85B3; +} + +#yourls-bar a:hover { + text-decoration:underline; +} + +#yourls-about, #yourls-topsy, #yourls-delicious, #yourls-selfclose { + margin-left:10px; + float:left; + display:block; + top:5px; + position:relative; +} + +#yourls-about a { + background:transparent url(../img/favicon.gif) center left no-repeat; + padding-left:20px; + color:inherit; + font-weight:bold; +} + +#yourls-topsy { + width:300px; +} + +#yourls-selfclose { + float:right; + margin-right:10px; +} + +#yourls-once { + display:block; + text-indent:-9999px; + background:transparent url(../img/close_button.gif) center center no-repeat; + width:20px; + height:20px; + float:left; +} + +#yourls-always { + display:none; + text-indent:-9999px; + background:transparent url(../img/close_button_red.gif) center center no-repeat; + width:20px; + height:20px; + float:left; +} diff --git a/data/conf/yourls/plugins/sample-toolbar/img/close_button.gif b/data/conf/yourls/plugins/sample-toolbar/img/close_button.gif new file mode 100644 index 0000000..95d286c Binary files /dev/null and b/data/conf/yourls/plugins/sample-toolbar/img/close_button.gif differ diff --git a/data/conf/yourls/plugins/sample-toolbar/img/close_button_red.gif b/data/conf/yourls/plugins/sample-toolbar/img/close_button_red.gif new file mode 100644 index 0000000..b443f12 Binary files /dev/null and b/data/conf/yourls/plugins/sample-toolbar/img/close_button_red.gif differ diff --git a/data/conf/yourls/plugins/sample-toolbar/img/favicon.gif b/data/conf/yourls/plugins/sample-toolbar/img/favicon.gif new file mode 100644 index 0000000..8681802 Binary files /dev/null and b/data/conf/yourls/plugins/sample-toolbar/img/favicon.gif differ diff --git a/data/conf/yourls/plugins/sample-toolbar/img/toolbar_bg.png b/data/conf/yourls/plugins/sample-toolbar/img/toolbar_bg.png new file mode 100644 index 0000000..0fb3cec Binary files /dev/null and b/data/conf/yourls/plugins/sample-toolbar/img/toolbar_bg.png differ diff --git a/data/conf/yourls/plugins/sample-toolbar/js/toolbar.js b/data/conf/yourls/plugins/sample-toolbar/js/toolbar.js new file mode 100644 index 0000000..bfa249a --- /dev/null +++ b/data/conf/yourls/plugins/sample-toolbar/js/toolbar.js @@ -0,0 +1,22 @@ + +// If javascript is enabled, display the button +document.getElementById('yourls-always').style.display = 'block'; + +// When button clicked, store a cookie that says the user doesn't want a toolbar +document.getElementById('yourls-always').onclick = yourls_cookie_no_toolbar_please; +function yourls_cookie_no_toolbar_please() { + var exdate=new Date(); + exdate.setDate( exdate.getDate()+365 ); // store 365 days + document.cookie = "yourls_no_toolbar=1;expires="+exdate.toUTCString() ; +} + +// Get the number of delicious bookmarks +function yourls_get_books(json) { + if( json.length ) { + var books = json[0].total_posts.toString(); + if( books ) { + document.getElementById('yourls-delicious-link').innerHTML = ' <b>'+books+'</b> bookmarks'; + } + } +} + diff --git a/data/conf/yourls/plugins/sample-toolbar/plugin.php b/data/conf/yourls/plugins/sample-toolbar/plugin.php new file mode 100644 index 0000000..2467bb9 --- /dev/null +++ b/data/conf/yourls/plugins/sample-toolbar/plugin.php @@ -0,0 +1,126 @@ +<?php +/* +Plugin Name: YOURLS Toolbar +Plugin URI: http://yourls.org/ +Description: Add a social toolbar to your redirected short URLs. Fork this plugin if you want to make your own toolbar. +Version: 1.0 +Author: Ozh +Author URI: http://ozh.org/ +Disclaimer: Toolbars ruin the user experience. Be warned. +*/ + +// No direct call +if( !defined( 'YOURLS_ABSPATH' ) ) die(); + +global $ozh_toolbar; +$ozh_toolbar['do'] = false; +$ozh_toolbar['keyword'] = ''; + +// When a redirection to a shorturl is about to happen, register variables +yourls_add_action( 'redirect_shorturl', 'ozh_toolbar_add' ); +function ozh_toolbar_add( $args ) { + global $ozh_toolbar; + $ozh_toolbar['do'] = true; + $ozh_toolbar['keyword'] = $args[1]; +} + +// On redirection, check if this is a toolbar and draw it if needed +yourls_add_action( 'pre_redirect', 'ozh_toolbar_do' ); +function ozh_toolbar_do( $args ) { + global $ozh_toolbar; + + // Does this redirection need a toolbar? + if( !$ozh_toolbar['do'] ) + return; + + // Do we have a cookie stating the user doesn't want a toolbar? + if( isset( $_COOKIE['yourls_no_toolbar'] ) && $_COOKIE['yourls_no_toolbar'] == 1 ) + return; + + // Get URL and page title + $url = $args[0]; + $pagetitle = yourls_get_keyword_title( $ozh_toolbar['keyword'] ); + + // Update title if it hasn't been stored yet + if( $pagetitle == '' ) { + $pagetitle = yourls_get_remote_title( $url ); + yourls_edit_link_title( $ozh_toolbar['keyword'], $pagetitle ); + } + $_pagetitle = htmlentities( yourls_get_remote_title( $url ) ); + + $www = YOURLS_SITE; + $ver = YOURLS_VERSION; + $md5 = md5( $url ); + $sql = yourls_get_num_queries(); + + // When was the link created (in days) + $diff = abs( time() - strtotime( yourls_get_keyword_timestamp( $ozh_toolbar['keyword'] ) ) ); + $days = floor( $diff / (60*60*24) ); + if( $days == 0 ) { + $created = 'today'; + } else { + $created = $days . ' ' . yourls_n( 'day', 'days', $days ) . ' ago'; + } + + // How many hits on the page + $hits = 1 + yourls_get_keyword_clicks( $ozh_toolbar['keyword'] ); + $hits = $hits . ' ' . yourls_n( 'view', 'views', $hits ); + + // Plugin URL (no URL is hardcoded) + $pluginurl = YOURLS_PLUGINURL . '/'.yourls_plugin_basename( __DIR__ ); + + // All set. Draw the toolbar itself. + echo <<<PAGE +<html> +<head> + <title>$pagetitle — YOURLS + + + + + + + + +
    +
    + Short link powered by YOURLS and created $created. $hits. + +
    + +
    + Delicious + Bookmark on Delicious +
    + + +
    + +
    + +
    + close + close + +
    +
    + + + + + + + +PAGE; + + // Don't forget to die, to interrupt the flow of normal events (ie redirecting to long URL) + die(); +} \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2071372 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,182 @@ +version: "3" + +networks: + default: + driver: bridge + traefik: + internal: true + +services: + watchtower: + command: --label-enable --cleanup --interval 300 + image: containrrr/watchtower + labels: + - "com.centurylinklabs.watchtower.enable=true" + network_mode: none + restart: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock + + dockerproxy: + depends_on: + - watchtower + environment: + CONTAINERS: 1 + image: tecnativa/docker-socket-proxy + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - traefik + ports: + - 2375 + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + + traefik: + depends_on: + - dockerproxy + - watchtower + image: traefik:2.1 + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + - traefik + ports: + - 80:80 + - 443:443 + restart: always + volumes: + - ./data/conf/traefik/acme.json:/acme.json + - ./data/conf/traefik/traefik.toml:/traefik.toml + - ./data/volumes/traefik/tmp:/tmp + + mariadb: + depends_on: + - watchtower + env_file: .mariadb.env + image: mariadb:10 + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + ports: + - 3306:3306 + restart: always + volumes: + - ./data/volumes/mariadb:/var/lib/mysql + + redis: + depends_on: + - watchtower + image: redis:5 + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + restart: always + volumes: + - ./data/volumes/redis:/data + + freshrss: + depends_on: + - mariadb + - traefik + - watchtower + env_file: .freshrss.env + image: freshrss/freshrss + labels: + - "traefik.enable=true" + - "traefik.http.middlewares.freshrss-https.redirectscheme.scheme=https" + - "traefik.http.routers.freshrss-http.entrypoints=web" + - "traefik.http.routers.freshrss-http.rule=Host(`my.freshrss.url`)" + - "traefik.http.routers.freshrss-http.middlewares=freshrss-https@docker" + - "traefik.http.routers.freshrss.entrypoints=web-secure" + - "traefik.http.routers.freshrss.rule=Host(`my.freshrss.url`)" + - "traefik.http.routers.freshrss.tls=true" + - "traefik.http.routers.freshrss.tls.certresolver=default" + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + restart: always + volumes: + - ./data/volumes/freshrss:/var/www/FreshRSS/data + + nextcloud: + depends_on: + - mariadb + - redis + - traefik + - watchtower + image: nextcloud:18 + labels: + - "traefik.enable=true" + - "traefik.http.middlewares.nextcloud-caldav.redirectregex.permanent=true" + - "traefik.http.middlewares.nextcloud-caldav.redirectregex.regex=^https://(.*)/.well-known/(card|cal)dav" + - "traefik.http.middlewares.nextcloud-caldav.redirectregex.replacement=https://$${1}/remote.php/dav/" + - "traefik.http.middlewares.nextcloud-https.redirectscheme.scheme=https" + - "traefik.http.routers.nextcloud-http.entrypoints=web" + - "traefik.http.routers.nextcloud-http.rule=Host(`my.nextcloud.url`)" + - "traefik.http.routers.nextcloud-http.middlewares=nextcloud-https@docker" + - "traefik.http.routers.nextcloud.entrypoints=web-secure" + - "traefik.http.routers.nextcloud.rule=Host(`my.nextcloud.url`)" + - "traefik.http.routers.nextcloud.middlewares=nextcloud-caldav@docker" + - "traefik.http.routers.nextcloud.tls=true" + - "traefik.http.routers.nextcloud.tls.certresolver=default" + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + restart: always + volumes: + - ./data/volumes/nextcloud/html:/var/www/html + + wallabag: + depends_on: + - mariadb + - redis + - traefik + - watchtower + env_file: .wallabag.env + image: wallabag/wallabag:2.3.8 + labels: + - "traefik.enable=true" + - "traefik.http.middlewares.wallabag-https.redirectscheme.scheme=https" + - "traefik.http.routers.wallabag-http.entrypoints=web" + - "traefik.http.routers.wallabag-http.rule=Host(`my.wallabag.url`)" + - "traefik.http.routers.wallabag-http.middlewares=wallabag-https@docker" + - "traefik.http.routers.wallabag.entrypoints=web-secure" + - "traefik.http.routers.wallabag.rule=Host(`my.wallabag.url`)" + - "traefik.http.routers.wallabag.tls=true" + - "traefik.http.routers.wallabag.tls.certresolver=default" + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + restart: always + volumes: + - ./data/volumes/wallabag/images:/var/www/wallabag/web/assets/images + - ./data/volumes/wallabag/data:/var/www/wallabag/data + + yourls: + depends_on: + - mariadb + - traefik + - watchtower + env_file: .yourls.env + image: yourls:1.7 + labels: + - "traefik.enable=true" + - "traefik.http.middlewares.yourls-https.redirectscheme.scheme=https" + - "traefik.http.routers.yourls-http.entrypoints=web" + - "traefik.http.routers.yourls-http.rule=Host(`my.yourls.url`)" + - "traefik.http.routers.yourls-http.middlewares=yourls-https@docker" + - "traefik.http.routers.yourls.entrypoints=web-secure" + - "traefik.http.routers.yourls.rule=Host(`my.yourls.url`)" + - "traefik.http.routers.yourls.tls=true" + - "traefik.http.routers.yourls.tls.certresolver=default" + - "com.centurylinklabs.watchtower.enable=true" + networks: + - default + restart: always + volumes: + - ./data/conf/yourls/plugins:/var/www/html/user/plugins + - ./data/volumes/yourls/html:/var/www/html