diff --git a/ep.json b/ep.json
index 709f659..a5cacf8 100644
--- a/ep.json
+++ b/ep.json
@@ -1,9 +1,10 @@
{
"parts": [
{
- "name": "noscript",
+ "name": "ep_public_view",
"hooks": {
- "eejsBlock_body": "ep_text_content_in_noscripts_tag/noscript"
+ "expressConfigure" : "ep_public_view/index:expressConfigure",
+ "expressCreateServer" : "ep_public_view/index:expressServer"
}
}
]
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..1b0ae87
--- /dev/null
+++ b/index.js
@@ -0,0 +1,47 @@
+ var eejs = require('ep_etherpad-lite/node/eejs/'),
+ padManager = require('ep_etherpad-lite/node/db/PadManager'),
+ ERR = require("ep_etherpad-lite/node_modules/async-stacktrace"),
+ async = require('ep_etherpad-lite/node_modules/async'),
+ express = require('ep_etherpad-lite/node_modules/express');
+
+exports.expressConfigure = function(hook_name, args, cb) {
+}
+
+exports.expressServer = function (hook_name, args, cb) {
+ args.app.get('/public/:padId(*)', function(req, res) {
+ var padId = req.params.padId.replace(/\.\./g, '').split("?")[0];
+
+ var pad;
+ async.series([
+ function(callback){ // Get the pad Text
+ var padText = padManager.getPad(padId, function(err, _pad){
+ console.warn(_pad);
+ pad = _pad;
+ text = pad.text().replace(/\n/g,"
");
+ ERR(err);
+ callback();
+ });
+ },
+
+ function(callback){ // Append the pad Text to the Body
+
+ /* Why don't we use EEJS require here? Well EEJS require isn't ASYNC so on first load
+ it would bring in the .ejs content only and then on second load pad contents would be included..
+ Sorry this is ugly but that's how the plugin FW was designed by @redhog -- bug him for a fix! */
+
+ args.content = "