Added history support to the raw action.

This commit is contained in:
Starbeamrainbowlabs 2016-10-18 18:38:34 +01:00
parent 0253ab6c0e
commit dfeb2a9399
4 changed files with 14 additions and 13 deletions

View File

@ -2,6 +2,9 @@
## v0.13-dev
### Added
- Added history support to the `raw` action.
### Changed
- Overhauled internal history logic - history logic is now done in core.
- Added `$env->page_filename`, which points to the current page on disk.

View File

@ -1596,7 +1596,7 @@ register_module([
register_module([
"name" => "Raw page source",
"version" => "0.6",
"version" => "0.7",
"author" => "Starbeamrainbowlabs",
"description" => "Adds a 'raw' action that shows you the raw source of a page.",
"id" => "action-raw",
@ -1620,10 +1620,9 @@ register_module([
*/
add_action("raw", function() {
global $env;
header("x-filename: " . rawurlencode($env->page) . ".md");
header("content-type: text/markdown");
exit(file_get_contents("$env->storage_prefix$env->page.md"));
exit(file_get_contents($env->page_filename));
exit();
});
@ -4689,7 +4688,7 @@ register_module([
register_module([
"name" => "Page viewer",
"version" => "0.15",
"version" => "0.16",
"author" => "Starbeamrainbowlabs",
"description" => "Allows you to view pages. You really should include this one.",
"id" => "page-view",

View File

@ -19,11 +19,11 @@
},
{
"name": "Raw page source",
"version": "0.6",
"version": "0.7",
"author": "Starbeamrainbowlabs",
"description": "Adds a 'raw' action that shows you the raw source of a page.",
"id": "action-raw",
"lastupdate": 1465757909,
"lastupdate": 1476812239,
"optional": false
},
{
@ -181,11 +181,11 @@
},
{
"name": "Page viewer",
"version": "0.15",
"version": "0.16",
"author": "Starbeamrainbowlabs",
"description": "Allows you to view pages. You really should include this one.",
"id": "page-view",
"lastupdate": 1476811748,
"lastupdate": 1476812218,
"optional": false
},
{

View File

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Raw page source",
"version" => "0.6",
"version" => "0.7",
"author" => "Starbeamrainbowlabs",
"description" => "Adds a 'raw' action that shows you the raw source of a page.",
"id" => "action-raw",
@ -25,10 +25,9 @@ register_module([
*/
add_action("raw", function() {
global $env;
header("x-filename: " . rawurlencode($env->page) . ".md");
header("content-type: text/markdown");
exit(file_get_contents("$env->storage_prefix$env->page.md"));
exit(file_get_contents($env->page_filename));
exit();
});