Skip to content

Commit 351a6cf

Browse files
Create setup wizard
1 parent 774aa49 commit 351a6cf

9 files changed

Lines changed: 1097 additions & 172 deletions

File tree

CLAUDE.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,16 @@ All 29 resource types inherit from the base `Resource` type in `src/_shared/type
223223

224224
### Prerequisites
225225

226-
- Apache 2.2.29+ with PHP 5.6.2+ (for server mode)
226+
- PHP 7.4+ (for server mode — run `php -S localhost:8080` in `src/`, no Apache needed for local dev)
227227
- Or: Chrome/Edge for local folder mode (File System Access API)
228228
- No build tools required for development — edit files directly in `src/`
229229

230230
### Running Locally
231231

232232
**Development (with server):**
233-
1. Point Apache at `src/` directory
234-
2. Access via browser (e.g., `http://localhost/frametrail/src/`)
235-
3. First run opens setup wizard
236-
4. Creates `src/_data/` directory and admin account
233+
1. Run `php -S localhost:8080` in the `src/` directory
234+
2. Open `http://localhost:8080` — first run opens setup wizard
235+
3. Creates `src/_data/` directory and admin account
237236

238237
**Development (local folder mode):**
239238
1. Open `src/index.html` directly in Chrome or Edge

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Thank you for your interest in contributing to FrameTrail! This guide covers dev
66

77
### Prerequisites
88

9-
- Apache Web Server (2.2.29+) with PHP (5.6.2+)
9+
- PHP 7.4+ (run `php -S localhost:8080` in `src/` for local dev — no Apache needed)
1010
- A modern browser (Chrome or Firefox)
1111
- Git
1212

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ FrameTrail supports a wide range of embeddable content:
6060

6161
## Installation
6262

63-
### Option 1: Server Deployment (Apache + PHP)
63+
### Option 1: Server Deployment (PHP)
6464

6565
1. Download the [latest release](https://github.com/OpenHypervideo/FrameTrail/releases) or build from source
66-
2. Extract to your web server directory
67-
3. Open in your browser and follow the setup wizard
68-
4. Create an admin account — you're ready to go
66+
2. Extract to any directory
67+
3. In that directory, run: `php -S localhost:8080`
68+
4. Open `http://localhost:8080` and follow the setup wizard
6969

70-
**Requirements:** Apache 2.2.29+ with PHP 5.6.2+. The web server needs write permissions to the installation directory.
70+
**Requirements:** PHP 7.4+. The directory needs write permissions so FrameTrail can create `_data/`.
71+
72+
For public deployments, use Apache (`.htaccess` included) or nginx with PHP-FPM. No PHP installed? Use [XAMPP](https://www.apachefriends.org/) (Windows) or [MAMP](https://www.mamp.info/) (Mac/Windows).
7173

7274
### Option 2: Local Folder Mode (No Server)
7375

docs/DEPLOYMENT.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@ This guide covers the three ways to run FrameTrail (server, local folder, and in
44

55
## Deployment Options
66

7-
### Option 1: Server Deployment (Apache + PHP)
7+
### Option 1: Server Deployment (PHP)
88

99
Full multi-user mode with file uploads, user management, and collaboration.
1010

1111
**Requirements:**
12-
- Apache 2.2.29+ with PHP 5.6.2+
13-
- The web server needs write permissions to the installation directory
14-
- `mod_rewrite` enabled (for the `.htaccess` rules)
12+
- PHP 7.4+
13+
- The directory needs write permissions so FrameTrail can create `_data/`
14+
15+
**Quickest local setup:**
16+
```bash
17+
php -S localhost:8080
18+
```
19+
Then open `http://localhost:8080`. No Apache, no XAMPP needed if PHP is installed.
20+
21+
**Public / production server:** Use Apache (`.htaccess` included and handles security rules) or nginx + PHP-FPM (add a deny rule for `_data/` in your nginx config).
1522

1623
**Steps:**
1724

scripts/build.sh

Lines changed: 11 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -410,77 +410,9 @@ cat > "$BUILD_DIR/resources.html" << 'RESOURCES_HTML'
410410
</html>
411411
RESOURCES_HTML
412412

413-
cat > "$BUILD_DIR/setup.html" << 'SETUP_HTML'
414-
<!DOCTYPE html>
415-
<html lang="en">
416-
<head>
417-
<meta charset="utf-8">
418-
<meta http-equiv="cache-control" content="no-cache">
419-
<title>FrameTrail Setup</title>
420-
<link rel="shortcut icon" href="favico.png">
421-
<link rel="stylesheet" href="frametrail.min.css">
422-
<script src="frametrail.min.js"></script>
423-
<script>
424-
$(document).ready(function() {
425-
$("#initSetup").ajaxForm({
426-
url: "_server/ajaxServer.php",
427-
type: "POST",
428-
data: {"a": "setupInit"},
429-
dataType: "json",
430-
success: function(ret) {
431-
if (ret["code"] != 1) {
432-
$("#returnFromSetup").show().append(ret["string"] + "<br>");
433-
} else { location.reload(); }
434-
}
435-
});
436-
if (!!document.location.host) {
437-
$.ajax({
438-
type: "POST",
439-
url: "_server/ajaxServer.php",
440-
data: {"a": "setupCheck"},
441-
dataType: "json",
442-
success: function(ret) {
443-
if (ret["code"] != "1") {
444-
$("#setupForm").show();
445-
} else {
446-
window.location.replace(
447-
window.location.href.replace('setup.html', '')
448-
);
449-
}
450-
}
451-
});
452-
} else {
453-
$('.boxTitle').html('No Webserver').show();
454-
$('#message').addClass('error').html(
455-
'This application needs to run on a webserver. ' +
456-
'You can use <a href="https://www.apachefriends.org/">XAMPP</a> ' +
457-
'or <a href="https://www.mamp.info/">MAMP</a> for local development.'
458-
).show();
459-
}
460-
});
461-
</script>
462-
</head>
463-
<body class="frametrail-body">
464-
<div class="ui-blocking-overlay">
465-
<div class="ui-overlay-box">
466-
<div class="boxTitle" style="display:none"></div>
467-
<div id="message" class="message"></div>
468-
<div id="content">
469-
<div id="setupForm" style="display:none">
470-
<form id="initSetup">
471-
<input name="mail" placeholder="Admin Mail-Address (login name)" type="text">
472-
<input name="name" placeholder="Admin Username" type="text">
473-
<input name="passwd" placeholder="Admin Password" type="password">
474-
<button type="submit">OK</button>
475-
<div id="returnFromSetup" class="message error" style="margin-top:10px"></div>
476-
</form>
477-
</div>
478-
</div>
479-
</div>
480-
</div>
481-
</body>
482-
</html>
483-
SETUP_HTML
413+
# Copy setup.html from source, replacing dev CSS links with the minified bundle
414+
sed '/<!-- BUILD:CSS -->/,/<!-- \/BUILD:CSS -->/c\ <link rel="stylesheet" href="frametrail.min.css">' \
415+
"$SRC_DIR/setup.html" > "$BUILD_DIR/setup.html"
484416

485417
# ──────────────────────────────────────────────
486418
# Copy static files
@@ -489,6 +421,7 @@ SETUP_HTML
489421
echo "Copying static files..."
490422
cp "$SRC_DIR/favico.png" "$BUILD_DIR/"
491423
cp "$SRC_DIR/.htaccess" "$BUILD_DIR/"
424+
cp "$SRC_DIR/.user.ini" "$BUILD_DIR/"
492425
cp -r "$SRC_DIR/_server" "$BUILD_DIR/_server"
493426

494427
# ──────────────────────────────────────────────
@@ -503,14 +436,16 @@ cat > "$BUILD_DIR/README.md" << README
503436
504437
## Installation
505438
506-
1. Extract this archive into your Apache web server directory
507-
2. Open the directory in your browser
508-
3. Follow the setup wizard to create an admin account
439+
1. Extract this archive into your web server directory (or any local directory)
440+
2. Open a terminal in that directory and run: `php -S localhost:8080`
441+
3. Open `http://localhost:8080` and follow the setup wizard
442+
443+
For public server deployment, use Apache (`.htaccess` included) or nginx with PHP 7.4+.
509444
510445
### Requirements
511446
512-
- Apache 2.2.29+ with PHP 5.6.2+
513-
- The web server needs write permissions to the installation directory
447+
- PHP 7.4+
448+
- The directory needs write permissions so FrameTrail can create `_data/`
514449
515450
### Documentation
516451

src/.user.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; FrameTrail PHP settings
2+
; This file is read by all PHP SAPIs (mod_php, PHP-FPM, built-in server).
3+
; The equivalent mod_php settings are also in .htaccess for Apache + mod_php.
4+
5+
post_max_size = 900M
6+
upload_max_filesize = 400M
7+
memory_limit = 900M
8+
max_execution_time = 259200
9+
max_input_time = 259200
10+
session.gc_maxlifetime = 1200

src/_server/ajaxServer.php

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@
196196

197197
case "setupCheck":
198198

199-
if ( version_compare(phpversion(), '5.4.4', '<') ) {
199+
if ( version_compare(phpversion(), '7.4.0', '<') ) {
200200
$return["status"] = "fail";
201201
$return["code"] = 2;
202-
$return["string"] = "Server does not meet the requirements. PHP version needs to be 5.4.4 or later (".phpversion()." is installed)";
202+
$return["string"] = "Server does not meet the requirements. PHP version needs to be 7.4 or later (".phpversion()." is installed)";
203203
echo json_encode($return);
204204
exit;
205205
}
@@ -259,6 +259,70 @@
259259

260260
break;
261261

262+
case "setupCheckDetailed":
263+
264+
// Only available before setup is complete
265+
$alreadySetup = file_exists($conf["dir"]["data"]."/users.json")
266+
&& file_exists($conf["dir"]["data"]."/config.json")
267+
&& file_exists($conf["dir"]["data"]."/tagdefinitions.json");
268+
269+
if ($alreadySetup) {
270+
$return["status"] = "success";
271+
$return["alreadySetup"] = true;
272+
$return["checks"] = array();
273+
break;
274+
}
275+
276+
$checks = array();
277+
278+
// PHP version
279+
$phpOk = version_compare(phpversion(), '7.4.0', '>=');
280+
$checks["php"] = array(
281+
"pass" => $phpOk,
282+
"label" => "PHP Version",
283+
"detail" => $phpOk
284+
? "PHP " . phpversion()
285+
: "PHP " . phpversion() . " found — 7.4+ required"
286+
);
287+
288+
// Root directory writable (needed to create _data/)
289+
$rootWritable = file_exists($conf["dir"]["data"]) || is_writable("../");
290+
$checks["root_writable"] = array(
291+
"pass" => $rootWritable,
292+
"label" => "Root Directory",
293+
"detail" => $rootWritable
294+
? "Writable"
295+
: "Not writable. Run: chmod 755 " . realpath("../")
296+
);
297+
298+
// Data directory writable (if it already exists)
299+
if (file_exists($conf["dir"]["data"])) {
300+
$dataWritable = is_writable($conf["dir"]["data"]);
301+
$checks["data_writable"] = array(
302+
"pass" => $dataWritable,
303+
"label" => "Data Directory",
304+
"detail" => $dataWritable
305+
? "Writable"
306+
: "Not writable. Run: chmod -R 775 " . realpath($conf["dir"]["data"])
307+
);
308+
} else {
309+
$checks["data_writable"] = array(
310+
"pass" => true,
311+
"label" => "Data Directory",
312+
"detail" => "Will be created during setup"
313+
);
314+
}
315+
316+
$allPass = true;
317+
foreach ($checks as $c) {
318+
if (!$c["pass"]) { $allPass = false; break; }
319+
}
320+
321+
$return["status"] = $allPass ? "success" : "fail";
322+
$return["checks"] = $checks;
323+
$return["alreadySetup"] = false;
324+
break;
325+
262326
case "setupInit":
263327
$errorCnt = 0;
264328
if (!file_exists($conf["dir"]["data"]) && !is_dir($conf["dir"]["data"])) {
@@ -300,6 +364,18 @@
300364
"useFFmpeg"=> false
301365
)
302366
);
367+
// Apply optional config overrides sent by the setup wizard
368+
$configOverrides = array("defaultUserRole", "userNeedsConfirmation",
369+
"alwaysForceLogin", "allowUploads", "theme");
370+
foreach ($configOverrides as $key) {
371+
if (isset($_REQUEST[$key])) {
372+
$val = $_REQUEST[$key];
373+
if ($val === "true") $val = true;
374+
if ($val === "false") $val = false;
375+
$tmpConf[$key] = $val;
376+
}
377+
}
378+
303379
if (!file_put_contents($conf["dir"]["data"]."/config.json", json_encode($tmpConf,$conf["settings"]["json_flags"]))) {
304380
$errorCnt++;
305381
}

src/_shared/styles/generic.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ button.active, input[type="submit"].active, input[type="button"].active, .button
102102
color: var(--primary-fg-color);
103103
}
104104

105-
input[type="text"], input[type="password"], textarea, input[type="number"], input[type="time"] {
105+
input[type="text"], input[type="password"], textarea, input[type="number"], input[type="time"], input[type="email"] {
106106
font-family: TitilliumWeb,"Helvetica Neue",Helvetica,Arial,sans-serif;
107107
font-size: 14px;
108108
margin: 4px 8px 4px 0;

0 commit comments

Comments
 (0)