Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: readonly www dir #61

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 67 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
# WUHU
Lightweight party management system
http://wuhu.function.hu
## Requirements
### Server side:
* Apache 2.x (Not tested with other servers but it should probably work fine)
* PHP 5.x (works fine with 7.x)
* MySQL 5.x (works fine with MariaDB)
### Beamer side:
* HTML5 compatible browser (Chrome/Firefox preferred)
* Machine to handle it (any OS)
## Basic installation
Note: there's an installation script available from https://gist.github.com/Gargaj/2a8cb8c015244b6431b9 that can pretty much set most things up on a blank Linux install.
### Apache
1. Set up a basic Apache server with two virtual hosts, one for the users and one for the admins. One convenient way to configure this is
http://party.lan pointing to /var/www/party
http://admin.lan pointing to /var/www/admin
The admin one is recommended to have SSL configured.
It's important to set up a working nameserver too!
2. Set AllowOverride in your Apache configs to All.
### MySQL
Set up a MySQL server, create a database, and create an account that has full read/write access to the database.
### Miscellaneous Unix stuff
1. Create a directory where you will store your compo entries. This dir has to be readable and writeable by Apache, and for convenience, it's useful if it's the root dir of a password protected FTP.
2. Create another directory, where you will store the screenshots. This dir has to be readable and writeable by Apache, but it will only serve as storage, it doesn't have to be accessible by anything else.
3. Unpack the www_admin dir into your admin dir and unpack the www_party dir into your party dir.
### Deployment
1. Open your admin interface in a web browser. It should bring you to the deployment form.
2. Fill the form accordingly, and remember to use absolute paths everywhere.
3. On success, you should be forwarded to the admin interface. Note that if you set a user/pass for the interface, you will be prompted for it.
## Using the beam system
1. Click the "Slideviewer" link in the admin
2. Enter the original slide resolution in which the design was done
3. Press "Open viewer" - most browsers allow you to switch to fullscreen with F11.
Both beam systems rely on simple keypresses for operation.
* ALT-F4 - quit
* LEFT ARROW - previous slide / minus one minute in countdown mode
* RIGHT ARROW - next slide / plus one minute in countdown mode
* HOME - first slide
* END - last slide
* S - partyslide rotation mode
* T - reload stylesheet (without changing the slide contents)
* SPACE - re-read result.xml (and quit partyslide mode)
This last key essentially means that once you've used the "BEAMER" menu on the admin interface, you must press SPACE to refresh the data inside (and/or switch to another mode).
## Credits
Wuhu was created and is maintained by Gargaj / Conspiracy.
Additional effort by:
* Zoom / Conspiracy with the original admin design and QA
* Quarryman / Ogdoad for minor fixes
* lug00ber / Kvasigen for additional QA
* The TG Creativia crew for their immense QA effort
Acknowledgments for external stuff are available in the license file.
# WUHU
Lightweight party management system
http://wuhu.function.hu

## Requirements

### Server side:
* Apache 2.x (Not tested with other servers but it should probably work fine)
* PHP 5.x (works fine with 7.x)
* MySQL 5.x (works fine with MariaDB)
### Beamer side:
* HTML5 compatible browser (Chrome/Firefox preferred)
* Machine to handle it (any OS)

## Basic installation
Note: there's an installation script available from https://gist.github.com/Gargaj/2a8cb8c015244b6431b9 that can pretty much set most things up on a blank Linux install.

### Apache
1. Set up a basic Apache server with two virtual hosts, one for the users and one for the admins. One convenient way to configure this is
http://party.lan pointing to /var/www/party
http://admin.lan pointing to /var/www/admin
The admin one is recommended to have SSL configured.
It's important to set up a working nameserver too!

2. Set AllowOverride in your Apache configs to All.

### MySQL

Set up a MySQL server, create a database, and create an account that has full read/write access to the database.

### Miscellaneous Unix stuff
1. Create a directory where you will store your compo entries. This dir has to be readable and writeable by Apache, and for convenience, it's useful if it's the root dir of a password protected FTP.
2. Create another directory, where you will store the screenshots. This dir has to be readable and writeable by Apache, but it will only serve as storage, it doesn't have to be accessible by anything else.
3. Unpack the www_admin dir into your admin dir and unpack the www_party dir into your party dir.
### Deployment
1. Open your admin interface in a web browser. It should bring you to the deployment form.
2. Fill the form accordingly, and remember to use absolute paths everywhere.
3. On success, you should be forwarded to the admin interface. Note that if you set a user/pass for the interface, you will be prompted for it.

## Using the beam system
1. Click the "Slideviewer" link in the admin
2. Enter the original slide resolution in which the design was done
3. Press "Open viewer" - most browsers allow you to switch to fullscreen with F11.

Both beam systems rely on simple keypresses for operation.

* ALT-F4 - quit
* LEFT ARROW - previous slide / minus one minute in countdown mode
* RIGHT ARROW - next slide / plus one minute in countdown mode
* HOME - first slide
* END - last slide
* S - partyslide rotation mode
* T - reload stylesheet (without changing the slide contents)
* SPACE - re-read slide-events (and quit partyslide mode)

This last key essentially means that once you've used the "BEAMER" menu on the admin interface, you must press SPACE to refresh the data inside (and/or switch to another mode).

## Credits
Wuhu was created and is maintained by Gargaj / Conspiracy.

Additional effort by:
* Zoom / Conspiracy with the original admin design and QA
* Quarryman / Ogdoad for minor fixes
* lug00ber / Kvasigen for additional QA
* The TG Creativia crew for their immense QA effort

Acknowledgments for external stuff are available in the license file.
7 changes: 3 additions & 4 deletions www_admin/beamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,16 @@
} break;
}
printf("</result>\n");
file_put_contents("result.xml",ob_get_clean());
@chmod("result.xml",0755);
file_put_contents(sys_get_temp_dir() . "/.wuhu.slide-events",ob_get_clean());
}
printf("<h2>Change beamer setting</h2>\n");

$f = @file_get_contents("result.xml");
$f = @file_get_contents(sys_get_temp_dir() . "/.wuhu.slide-events");
preg_match("|\\<mode\\>(.*)\\</mode\\>|m",$f,$m);

$s = SQLLib::selectRows("select * from compos order by start");

printf("Current mode: <a href='result.xml'>%s</a>",$m[1]);
printf("Current mode: <a href='slide-events.php'>%s</a>",$m[1]);
//if ($m[0]=="announcement") {
preg_match("/<announcementtext isHTML='(.*)'>(.*)<\/announcementtext>/sm",$f,$ann);
// var_dump($ann);
Expand Down
2 changes: 1 addition & 1 deletion www_admin/common.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class OpLock
{
function __construct()
{
$this->f = fopen(ADMIN_DIR . "/.oplock","wb");
$this->f = fopen(sys_get_temp_dir() . "/.wuhu.oplock","wb");
flock($this->f,LOCK_EX);
fwrite($this->f,"open."); // this is to see if the lock gets stuck somewhere.
}
Expand Down
2 changes: 1 addition & 1 deletion www_admin/hooks.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function get_cron_log( $cronName )
return SQLLib::SelectRow(sprintf_esc("select * from cron where cronname='%s'",$cronName));
}

define("PLUGINREGISTRY", ADMIN_DIR . "/activeplugins.serialize");
define("PLUGINREGISTRY", "/var/lib/wuhu/activeplugins.serialize");

function get_plugin_entry_path( $name )
{
Expand Down
2 changes: 1 addition & 1 deletion www_admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function todo_createcompos() { return SQLLib::selectRow("select * from compo
function todo_generatevotekeys() { return SQLLib::selectRow("select * from votekeys limit 1"); }
function todo_createtemplate() { return file_exists( WWW_DIR . "/template.html" ); }
function todo_replaceascii() { return file_exists( ADMIN_DIR . "/results_header.txt" ); }
function todo_resultxml() { return file_exists( ADMIN_DIR . "/result.xml" ); }
function todo_resultxml() { return file_exists( sys_get_temp_dir() . "/.wuhu.slide-events" ); }
function todo_slideviewercss() { return file_exists( ADMIN_DIR . "/slideviewer/custom.css" ); }
function todo_crontab() { return SQLLib::selectRow("select * from cron"); }

Expand Down
1 change: 1 addition & 0 deletions www_admin/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
run_hook( $dirname . "_activation" );
}
}
@mkdir(dirname(PLUGINREGISTRY), 0777, True);
$success = @file_put_contents(PLUGINREGISTRY,serialize($activePlugins)) !== false;
}

Expand Down
10 changes: 10 additions & 0 deletions www_admin/slide-events.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

if (($data = @file_get_contents(sys_get_temp_dir() . "/.wuhu.slide-events")) === false) {
http_response_code(404);
echo "<html><body>404: file not found</body></html>";
} else {
header("Content-type: text/xml");
echo $data;
}
?>
4 changes: 2 additions & 2 deletions www_admin/slideviewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<h2>Open slideviewer</h2>

<?php if (file_exists("result.xml")){ ?>
<?php if (file_exists(sys_get_temp_dir() . "/.wuhu.slide-events")){ ?>
<form action="/slideviewer/" method="get" id="frm">
<label>Native slide size:</label>
<input type='number' name='width' value='<?=(get_setting("slideviewer_x") ?: "1920")?>' style='width: 70px'/> x
Expand Down Expand Up @@ -41,7 +41,7 @@
<li>DOWN ARROW - minus one minute in countdown mode</li>
<li>S - partyslide rotation mode</li>
<li>T - reload stylesheet without changing the slide</li>
<li>SPACE - re-read result.xml (and quit partyslide mode)</li>
<li>SPACE - re-read slide-events (and quit partyslide mode)</li>
</ul>
<?}else{ ?>
<p>You haven't set a slide mode yet; go <a href="beamer.php">here</a> to do so.</p>
Expand Down
2 changes: 1 addition & 1 deletion www_admin/slideviewer/wuhu.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ var WuhuSlideSystem = Class.create({
},
fetchSlideEvents:function()
{
new Ajax.Request("../result.xml?" + Math.random(),{
new Ajax.Request("../slide-events.php",{
"method":"GET",
onException:function(req,ex) { throw ex; },
onSuccess:(function(transport){
Expand Down