Release V2 with better username display and a cleaner set of DokuWiki commits.

This commit is contained in:
Nolan Darilek 2016-04-18 20:50:30 -05:00
parent 6d20100350
commit 6cd5c8c8c8
20 changed files with 2149 additions and 1978 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
.vagrant .vagrant
*.spk *.spk
conf
plugins
tpl

View File

@ -10,8 +10,7 @@ VM_NAME = File.basename(File.dirname(File.dirname(__FILE__))) + "_sandstorm_#{Ti
VAGRANTFILE_API_VERSION = "2" VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# We base ourselves off Debian Jessie config.vm.box = "sandstorm/debian-jessie64"
config.vm.box = "debian/jessie64"
if Vagrant.has_plugin?("vagrant-vbguest") then if Vagrant.has_plugin?("vagrant-vbguest") then
# vagrant-vbguest is a Vagrant plugin that upgrades # vagrant-vbguest is a Vagrant plugin that upgrades

BIN
.sandstorm/appGrid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -11,3 +11,17 @@ if [ -f /opt/app/dokuwiki/composer.json ] ; then
fi fi
php composer.phar install php composer.phar install
fi fi
rsync -a /opt/app/plugin/ /opt/app/dokuwiki/lib/plugins/sandstorm/
for p in /opt/app/dokuwiki/{conf,data,lib/plugins,lib/tpl}; do
if [ -e $p ]; then
mv $p $p.orig
rm -rf $p
fi
done
ln -sf /var/lib/dokuwiki/conf /opt/app/dokuwiki/conf
ln -sf /var/lib/dokuwiki/data /opt/app/dokuwiki/data
ln -sf /var/lib/dokuwiki/lib/plugins /opt/app/dokuwiki/lib/plugins
ln -sf /var/lib/dokuwiki/lib/tpl /opt/app/dokuwiki/lib/tpl

13
.sandstorm/changelog.md Normal file
View File

@ -0,0 +1,13 @@
# V2 (2016-04-18)
* Now displays usernames rather than UUIDs in topbar and recent changes feeds
# V1 (2015-12-29)
* Dramatically shrunk grain size by only persisting config, data, plugins and templates
* Fixed rewrite issue where doku.php was appended to URLs
* Configured clean URLs
# V0 (2015-11-18)
* Initial release

BIN
.sandstorm/grain.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -19,11 +19,29 @@ while [ ! -e /var/run/php5-fpm.sock ] ; do
sleep .2 sleep .2
done done
rsync -a /opt/app/dokuwiki/ /var/www mkdir -p /var/lib/dokuwiki/lib/plugins/sandstorm
if [ ! -f /var/www/conf/local.php ]; then if [ ! -e /var/lib/dokuwiki/conf/local.php ]; then
cp /opt/app/local.php /var/www/conf echo Adding new configuration.
rsync -a /opt/app/dokuwiki/conf.orig/ /var/lib/dokuwiki/conf
cp /opt/app/local.php /var/lib/dokuwiki/conf
fi fi
if [ ! -e /var/lib/dokuwiki/data ]; then
echo Adding data.
rsync -a /opt/app/dokuwiki/data.orig/ /var/lib/dokuwiki/data
fi
rsync -a /opt/app/dokuwiki/lib/plugins.orig/ /var/lib/dokuwiki/lib/plugins
rsync -a /opt/app/plugin/ /var/lib/dokuwiki/lib/plugins/sandstorm
if [ ! -e /var/lib/dokuwiki/lib/tpl ]; then
echo Adding templates.
rsync -a /opt/app/dokuwiki/lib/tpl.orig/ /var/lib/dokuwiki/lib/tpl
fi
cd /var/lib/dokuwiki
grep -Ev '^($|#)' /opt/app/dokuwiki/data.orig/deleted.files | xargs -n 1 rm -vrf
# Start nginx. # Start nginx.
/usr/sbin/nginx -g "daemon off;" /usr/sbin/nginx -g "daemon off;"

BIN
.sandstorm/market.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
.sandstorm/pgp-keyring Normal file

Binary file not shown.

BIN
.sandstorm/pgp-signature Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@ const pkgdef :Spk.PackageDefinition = (
appTitle = (defaultText = "DokuWiki"), appTitle = (defaultText = "DokuWiki"),
appVersion = 0, # Increment this for every release. appVersion = 2, # Increment this for every release.
appMarketingVersion = (defaultText = "2015-08-10a"), appMarketingVersion = (defaultText = "2015-08-10a"),
# Human-readable representation of appVersion. Should match the way you # Human-readable representation of appVersion. Should match the way you
@ -48,9 +48,9 @@ const pkgdef :Spk.PackageDefinition = (
# https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/package.capnp # https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/package.capnp
icons = ( icons = (
# Various icons to represent the app in various contexts. # Various icons to represent the app in various contexts.
#appGrid = (svg = embed "path/to/appgrid-128x128.svg"), appGrid = (png = (dpi1x = embed "appGrid.png")),
#grain = (svg = embed "path/to/grain-24x24.svg"), grain = (png = (dpi1x = embed "grain.png")),
#market = (svg = embed "path/to/market-150x150.svg"), market = (png = (dpi1x = embed "market.png")),
#marketBig = (svg = embed "path/to/market-big-300x300.svg"), #marketBig = (svg = embed "path/to/market-big-300x300.svg"),
), ),
@ -61,11 +61,11 @@ const pkgdef :Spk.PackageDefinition = (
# URL of the app's source code repository, e.g. a GitHub URL. # URL of the app's source code repository, e.g. a GitHub URL.
# Required if you specify a license requiring redistributing code, but optional otherwise. # Required if you specify a license requiring redistributing code, but optional otherwise.
license = (none = void), license = (openSource = gpl2),
# The license this package is distributed under. See # The license this package is distributed under. See
# https://docs.sandstorm.io/en/latest/developing/publishing-apps/#license # https://docs.sandstorm.io/en/latest/developing/publishing-apps/#license
categories = [], categories = [webPublishing, productivity],
# A list of categories/genres to which this app belongs, sorted with best fit first. # A list of categories/genres to which this app belongs, sorted with best fit first.
# See the list of categories at # See the list of categories at
# https://docs.sandstorm.io/en/latest/developing/publishing-apps/#categories # https://docs.sandstorm.io/en/latest/developing/publishing-apps/#categories
@ -78,7 +78,7 @@ const pkgdef :Spk.PackageDefinition = (
# requests as well as app store administrator requests, so it is very important that this be a # requests as well as app store administrator requests, so it is very important that this be a
# valid address with someone paying attention to it. # valid address with someone paying attention to it.
pgpSignature = embed "../pgp-signature", pgpSignature = embed "pgp-signature",
# PGP signature attesting responsibility for the app ID. This is a binary-format detached # PGP signature attesting responsibility for the app ID. This is a binary-format detached
# signature of the following ASCII message (not including the quotes, no newlines, and # signature of the following ASCII message (not including the quotes, no newlines, and
# replacing <app-id> with the standard base-32 text format of the app's ID): # replacing <app-id> with the standard base-32 text format of the app's ID):
@ -99,7 +99,7 @@ const pkgdef :Spk.PackageDefinition = (
# Remove this line if you consider yourself as the author of the app. # Remove this line if you consider yourself as the author of the app.
), ),
pgpKeyring = embed "../pgp-keyring", pgpKeyring = embed "pgp-keyring",
# A keyring in GPG keyring format containing all public keys needed to verify PGP signatures in # A keyring in GPG keyring format containing all public keys needed to verify PGP signatures in
# this manifest (as of this writing, there is only one: `author.pgpSignature`). # this manifest (as of this writing, there is only one: `author.pgpSignature`).
# #
@ -109,7 +109,7 @@ const pkgdef :Spk.PackageDefinition = (
# #
# Where `<key-id>` is a PGP key ID or email address associated with the key. # Where `<key-id>` is a PGP key ID or email address associated with the key.
description = (defaultText = embed "../description.md"), description = (defaultText = embed "description.md"),
# The app's description description in Github-flavored Markdown format, to be displayed e.g. # The app's description description in Github-flavored Markdown format, to be displayed e.g.
# in an app store. Note that the Markdown is not permitted to contain HTML nor image tags (but # in an app store. Note that the Markdown is not permitted to contain HTML nor image tags (but
# you can include a list of screenshots separately). # you can include a list of screenshots separately).
@ -127,7 +127,7 @@ const pkgdef :Spk.PackageDefinition = (
#(width = 746, height = 795, jpeg = embed "path/to/screenshot-1.jpeg"), #(width = 746, height = 795, jpeg = embed "path/to/screenshot-1.jpeg"),
#(width = 640, height = 480, png = embed "path/to/screenshot-2.png"), #(width = 640, height = 480, png = embed "path/to/screenshot-2.png"),
], ],
changeLog = (defaultText = embed "../changelog.md"), changeLog = (defaultText = embed "changelog.md"),
# Documents the history of changes in Github-flavored markdown format (with the same restrictions # Documents the history of changes in Github-flavored markdown format (with the same restrictions
# as govern `description`). We recommend formatting this with an H1 heading for each version # as govern `description`). We recommend formatting this with an H1 heading for each version
# followed by a bullet list of changes. # followed by a bullet list of changes.

View File

@ -17,27 +17,30 @@ server {
client_max_body_size 0; client_max_body_size 0;
server_name localhost; server_name localhost;
root /var/www; root /opt/app/dokuwiki;
location / {
index doku.php; index doku.php;
location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; }
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
log_not_found off;
}
location / {
try_files \$uri \$uri/ @dokuwiki; try_files \$uri \$uri/ @dokuwiki;
} }
location ^~ /lib/ {
expires 30d;
}
location ^~ /conf/ { return 403; }
location ^~ /data/ { return 403; }
location @dokuwiki { location @dokuwiki {
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=\$1 last; rewrite ^/_media/(.*) /lib/exe/fetch.php?media=\$1 last;
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=\$1 last; rewrite ^/_detail/(.*) /lib/exe/detail.php?media=\$1 last;
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_\$1&id=\$2 last; rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_\$1&id=\$2 last;
rewrite ^/(.*) /doku.php?id=\$1 last; rewrite ^/(.*) /doku.php?id=\$1&\$args last;
} }
location ~ \\.php\$ { location ~ \\.php\$ {
fastcgi_pass unix:/var/run/php5-fpm.sock; if (!-f \$request_filename) { return 404; }
fastcgi_split_path_info ^(.+\\.php)(/.+)\$;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params; include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
} }
} }
EOF EOF
@ -83,3 +86,5 @@ sed --in-place='' \
--expression 's/^fastcgi_param *HTTPS.*$/fastcgi_param HTTPS \$fe_https if_not_empty;/' \ --expression 's/^fastcgi_param *HTTPS.*$/fastcgi_param HTTPS \$fe_https if_not_empty;/' \
/etc/nginx/fastcgi_params /etc/nginx/fastcgi_params
mkdir -p /var/lib/dokuwiki/{conf,data,lib/plugins,lib/tpl}
chown -R vagrant.vagrant /var/lib/dokuwiki

View File

@ -1,3 +0,0 @@
# V0
* Initial release

@ -1 +1 @@
Subproject commit 8bb94359b937d75319a05ffea59f725c775072e2 Subproject commit e97ab57612804569b7df0be3901315a37ae0a43a

View File

@ -8,6 +8,7 @@
* you automatically. * you automatically.
*/ */
$conf['showuseras'] = 'username';
$conf['useacl'] = 1; //Use Access Control Lists to restrict access? $conf['useacl'] = 1; //Use Access Control Lists to restrict access?
$conf['autopasswd'] = 0; //autogenerate passwords and email them to user $conf['autopasswd'] = 0; //autogenerate passwords and email them to user
$conf['authtype'] = 'sandstorm'; //which authentication backend should be used $conf['authtype'] = 'sandstorm'; //which authentication backend should be used
@ -15,3 +16,6 @@ $conf['superuser'] = '@admin'; //The admin can be user or @group or comma s
$conf['manager'] = '@manager'; //The manager can be user or @group or comma separated list user1,@group1,user2 $conf['manager'] = '@manager'; //The manager can be user or @group or comma separated list user1,@group1,user2
$conf['profileconfirm'] = 0; //Require current password to confirm changes to user profile $conf['profileconfirm'] = 0; //Require current password to confirm changes to user profile
$conf['disableactions']='login'; $conf['disableactions']='login';
$conf['userewrite'] = 1; //this makes nice URLs: 0: off 1: .htaccess 2: internal
$conf['useslash'] = 1; //use slash instead of colon? only when rewrite is on
$conf['savedir'] = '/var/lib/dokuwiki/data'; //where to store all the files

27
plugin/README Normal file
View File

@ -0,0 +1,27 @@
sandstorm Plugin for DokuWiki
Modifications needed to run in Sandstorm
All documentation for this plugin can be found at
https://dev.thewordnerd.info/nolan/dokuwiki-sandstorm
If you install this plugin manually, make sure it is installed in
lib/plugins/sandstorm/ - if the folder is called different it
will not work!
Please refer to http://www.dokuwiki.org/plugins for additional info
on how to install plugins in DokuWiki.
----
Copyright (C) Nolan Darilek <nolan@thewordnerd.info>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See the COPYING file in your DokuWiki folder for details

63
plugin/auth.php Normal file
View File

@ -0,0 +1,63 @@
<?php
/**
* DokuWiki Plugin sandstorm (Auth Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Nolan Darilek <nolan@thewordnerd.info>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
class auth_plugin_sandstorm extends DokuWiki_Auth_Plugin {
/**
* Constructor.
*/
public function __construct() {
parent::__construct(); // for compatibility
// FIXME set capabilities accordingly
//$this->cando['addUser'] = false; // can Users be created?
//$this->cando['delUser'] = false; // can Users be deleted?
//$this->cando['modLogin'] = false; // can login names be changed?
//$this->cando['modPass'] = false; // can passwords be changed?
//$this->cando['modName'] = false; // can real names be changed?
//$this->cando['modMail'] = false; // can emails be changed?
//$this->cando['modGroups'] = false; // can groups be changed?
//$this->cando['getUsers'] = false; // can a (filtered) list of users be retrieved?
//$this->cando['getUserCount']= false; // can the number of users be retrieved?
//$this->cando['getGroups'] = false; // can a list of available groups be retrieved?
$this->cando['external'] = true; // does the module do external auth checking?
$this->cando['logout'] = false; // can the user logout again? (eg. not possible with HTTP auth)
// FIXME intialize your auth system and set success to true, if successful
$this->success = true;
}
/**
* Do all authentication [ OPTIONAL ]
*
* @param string $user Username
* @param string $pass Cleartext Password
* @param bool $sticky Cookie should not expire
* @return bool true on successful auth
*/
public function trustExternal($user, $pass, $sticky = true) {
global $USERINFO;
global $conf;
$sticky = true;
$USERINFO['name'] = rawurldecode($_SERVER['HTTP_X_SANDSTORM_USERNAME']);
$USERINFO['mail'] = 'user@example.com';
$USERINFO['grps'] = str_getcsv($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS']);
$_SERVER['REMOTE_USER'] = $_SERVER['HTTP_X_SANDSTORM_USER_ID'];
$_SESSION[DOKU_COOKIE]['auth']['user'] = $USERINFO['name'];
$_SESSION[DOKU_COOKIE]['auth']['pass'] = $pass;
$_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
return true;
}
}
// vim:ts=4:sw=4:et:

7
plugin/plugin.info.txt Normal file
View File

@ -0,0 +1,7 @@
base sandstorm
author Nolan Darilek
email nolan@thewordnerd.info
date 2015-11-16
name sandstorm plugin
desc Modifications needed to run in Sandstorm
url https://dev.thewordnerd.info/nolan/dokuwiki-sandstorm