Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Initial commit

  • Loading branch information
ChrisWiegman committed Feb 13, 2020
0 parents commit b4932fafdd0c4e423d1126f6544062319153a020
Showing with 912 additions and 0 deletions.
  1. +2 −0 .freshrss.env.sample
  2. +3 −0 .gitignore
  3. +1 −0 .mariadb.env.sample
  4. +12 −0 .wallabag.env.sample
  5. +7 −0 .yourls.env.sample
  6. +9 −0 README.md
  7. BIN Slides.pdf
  8. +19 −0 data/conf/traefik/traefik.toml
  9. +60 −0 data/conf/yourls/plugins/fallback-url/plugin.php
  10. +6 −0 data/conf/yourls/plugins/hyphens-in-urls/README.md
  11. +19 −0 data/conf/yourls/plugins/hyphens-in-urls/plugin.php
  12. +8 −0 data/conf/yourls/plugins/index.html
  13. +6 −0 data/conf/yourls/plugins/random-bg/README.md
  14. BIN data/conf/yourls/plugins/random-bg/img/bg_ants.png
  15. BIN data/conf/yourls/plugins/random-bg/img/bg_boobs.png
  16. BIN data/conf/yourls/plugins/random-bg/img/bg_circles.png
  17. BIN data/conf/yourls/plugins/random-bg/img/bg_cross.png
  18. BIN data/conf/yourls/plugins/random-bg/img/bg_diag.png
  19. BIN data/conf/yourls/plugins/random-bg/img/bg_fuzzy.png
  20. BIN data/conf/yourls/plugins/random-bg/img/bg_fuzzy_bits.png
  21. BIN data/conf/yourls/plugins/random-bg/img/bg_life.png
  22. BIN data/conf/yourls/plugins/random-bg/img/bg_yourls.png
  23. +27 −0 data/conf/yourls/plugins/random-bg/plugin.php
  24. +20 −0 data/conf/yourls/plugins/random-keywords/LICENSE.md
  25. +20 −0 data/conf/yourls/plugins/random-keywords/README.md
  26. +42 −0 data/conf/yourls/plugins/random-keywords/plugin.php
  27. +7 −0 data/conf/yourls/plugins/random-shorturls/README.md
  28. +93 −0 data/conf/yourls/plugins/random-shorturls/plugin.php
  29. +6 −0 data/conf/yourls/plugins/sample-page/README.md
  30. +63 −0 data/conf/yourls/plugins/sample-page/plugin.php
  31. +6 −0 data/conf/yourls/plugins/sample-plugin/README.md
  32. +61 −0 data/conf/yourls/plugins/sample-plugin/plugin.php
  33. +6 −0 data/conf/yourls/plugins/sample-toolbar/README.md
  34. +79 −0 data/conf/yourls/plugins/sample-toolbar/css/toolbar.css
  35. BIN data/conf/yourls/plugins/sample-toolbar/img/close_button.gif
  36. BIN data/conf/yourls/plugins/sample-toolbar/img/close_button_red.gif
  37. BIN data/conf/yourls/plugins/sample-toolbar/img/favicon.gif
  38. BIN data/conf/yourls/plugins/sample-toolbar/img/toolbar_bg.png
  39. +22 −0 data/conf/yourls/plugins/sample-toolbar/js/toolbar.js
  40. +126 −0 data/conf/yourls/plugins/sample-toolbar/plugin.php
  41. +182 −0 docker-compose.yaml
@@ -0,0 +1,2 @@
CRON_MIN=*/10
TZ=America/New_York
@@ -0,0 +1,3 @@
volumes/
data/conf/traefik/acme.json
*.env
@@ -0,0 +1 @@
MYSQL_ROOT_PASSWORD=
@@ -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]
@@ -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=
@@ -0,0 +1,9 @@
Self Hosted Configuration
-----

A self-hosted configuration to help escape big tech.

* Wallabag
* Yourls
* FreshRSS
* NextCloud
BIN +813 KB Slides.pdf
Binary file not shown.
@@ -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]
@@ -0,0 +1,60 @@
<?php
/*
Plugin Name: Fallback URL
Plugin URI: http://diegopeinador.com/fallback-url-yourls-plugin
Description: This plugin allows you to define a fallback URL in case there isn't a match for your short URL, so you can specify something different than $YOURLS_HOME.
Version: 1.0
Author: Diego Peinador
Author URI: http://diegopeinador.com
*/

// No direct call
if( !defined( 'YOURLS_ABSPATH' ) ) die();

yourls_add_action( 'redirect_keyword_not_found', 'dp_fallback_url' );
function dp_fallback_url() {
// Get value from database
$fallback_url = yourls_get_option( 'fallback_url' );
yourls_redirect( $fallback_url, 302 ); //Use a temporal redirect in case there is a valid keyword in the future
}

// Register our plugin config page
yourls_add_action( 'plugins_loaded', 'dp_config_add_page' );
function dp_config_add_page() {
yourls_register_plugin_page( 'fallback_url_config', 'Fallback URL Plugin Config', 'dp_config_do_page' );
// parameters: page slug, page title, and function that will display the page itself
}

// Display config page
function dp_config_do_page() {

// Check if a form was submitted
if( isset( $_POST['fallback_url'] ) )
dp_config_update_option();

// Get value from database
$fallback_url = yourls_get_option( 'fallback_url' );

echo <<<HTML
<h2>Fallback URL Plugin Config</h2>
<p>Here you can configure the URL to redirect in case the keyword is not found in database.</p>
<form method="post">
<p><label for="fallback_url">URL to fallback to</label> <input type="text" id="fallback_url" name="fallback_url" value="$fallback_url" size="40" /></p>
<p><input type="submit" value="Update value" /></p>
</form>
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 );
}
}
@@ -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.
@@ -0,0 +1,19 @@
<?php
/*
Plugin Name: Allow Hyphens in Short URLs
Plugin URI: http://yourls.org/
Description: Allow hyphens in short URLs (like <tt>http://sho.rt/hello-world</tt>)
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.'-';
}


@@ -0,0 +1,8 @@
<!-- This page hides the content of the /pages/ directory and sends to YOURLS root -->
<html>
<head>
<meta http-equiv="refresh" content="0;url=../"></head>
<body>
YOURLS has nothing for you to see here.
</body>
</html>
@@ -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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,27 @@
<?php
/*
Plugin Name: Random Backgrounds
Plugin URI: http://yourls.org/
Description: Pretty random background patterns
Version: 1.0
Author: Ozh
Author URI: http://ozh.org/
*/

// No direct call
if( !defined( 'YOURLS_ABSPATH' ) ) die();

// Add the inline style
yourls_add_action( 'html_head', 'ozh_yourls_randombg' );
function ozh_yourls_randombg() {
$bg = glob( __DIR__.'/img/*png' );
$url = yourls_plugin_url( __DIR__ );
$rnd = yourls_plugin_url( $bg[ mt_rand( 0, count( $bg ) - 1 ) ] );
echo <<<CSS
<style type="text/css">
body {background:#e3f3ff url($rnd) repeat;}
</style>
CSS;
}

@@ -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.
@@ -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_
@@ -0,0 +1,42 @@
<?php
/*
Plugin Name: Random Keywords
Plugin URI: http://yourls.org/
Description: Assign random keywords to shorturls, like bitly (sho.rt/hJudjK)
Version: 1.1
Author: Ozh
Author URI: http://ozh.org/
*/

/* Release History:
*
* 1.0 Initial release
* 1.1 Added: don't increment sequential keyword counter & save one SQL query
* Fixed: plugin now complies to character set defined in config.php
*/

global $ozh_random_keyword;

/*
* CONFIG: EDIT THIS
*/

/* Length of random keyword */
$ozh_random_keyword['length'] = 5;

/*
* DO NOT EDIT FARTHER
*/

// Generate a random keyword
yourls_add_filter( 'random_keyword', 'ozh_random_keyword' );
function ozh_random_keyword() {
global $ozh_random_keyword;
return yourls_rnd_string( $ozh_random_keyword['length'] );
}

// Don't increment sequential keyword tracker
yourls_add_filter( 'get_next_decimal', 'ozh_random_keyword_next_decimal' );
function ozh_random_keyword_next_decimal( $next ) {
return ( $next - 1 );
}
@@ -0,0 +1,7 @@
Random ShortURLs
================

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.
@@ -0,0 +1,93 @@
<?php
/*
Plugin Name: Random ShortURLs
Plugin URI: https://yourls.org/
Description: Assign random keywords to shorturls, like bitly (sho.rt/hJudjK)
Version: 1.2
Author: Ozh
Author URI: https://ozh.org/
*/

/* Release History:
*
* 1.0 Initial release
* 1.1 Added: don't increment sequential keyword counter & save one SQL query
* Fixed: plugin now complies to character set defined in config.php
* 1.2 Adopted as YOURLS core plugin under a new name
* Now configured via YOURLS options instead of editing plugin file
*/

// No direct call
if( !defined( 'YOURLS_ABSPATH' ) ) die();

// Only register things if the old third-party plugin is not present
if( function_exists('ozh_random_keyword') ) {
yourls_add_notice( "<b>Random ShortURLs</b> plugin cannot function unless <b>Random Keywords</b> 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 <<<HTML
<main>
<h2>Random ShortURLs Settings</h2>
<form method="post">
<input type="hidden" name="nonce" value="$nonce" />
<p>
<label>Random Keyword Length</label>
<input type="number" name="random_length" min="1" max="128" value="$random_length" />
</p>
<p><input type="submit" value="Save" class="button" /></p>
</form>
</main>
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.";
}
}
@@ -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.

0 comments on commit b4932fa

Please sign in to comment.
You can’t perform that action at this time.