mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
Added support for document export, no link from the pad so far
This commit is contained in:
parent
83829759e9
commit
eeddf1348f
5 changed files with 244 additions and 2 deletions
|
@ -31,6 +31,7 @@ var async = require('async');
|
|||
var express = require('express');
|
||||
var path = require('path');
|
||||
var minify = require('./minify');
|
||||
var exportHandler;
|
||||
var exporthtml;
|
||||
var readOnlyManager;
|
||||
|
||||
|
@ -68,6 +69,7 @@ async.waterfall([
|
|||
//load modules that needs a initalized db
|
||||
readOnlyManager = require("./ReadOnlyManager");
|
||||
exporthtml = require("./exporters/exporthtml");
|
||||
exportHandler = require('./ExportHandler');
|
||||
|
||||
//set logging
|
||||
if(settings.logHTTP)
|
||||
|
@ -191,6 +193,28 @@ async.waterfall([
|
|||
res.sendfile(filePath, { maxAge: exports.maxAge });
|
||||
});
|
||||
|
||||
//serve timeslider.html under /p/$padname/timeslider
|
||||
app.get('/p/:pad/export/:type', function(req, res, next)
|
||||
{
|
||||
var types = ["pdf", "doc", "txt", "html", "odt"];
|
||||
//send a 404 if we don't support this filetype
|
||||
if(types.indexOf(req.params.type) == -1)
|
||||
{
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
//if abiword is disabled, and this is a format we only support with abiword, output a message
|
||||
if(settings.abiword == null && req.params.type != "html" && req.params.type != "txt" )
|
||||
{
|
||||
res.send("Abiword is not enabled at this Etherpad Lite instance. Set the path to Abiword in settings.json to enable this feature");
|
||||
return;
|
||||
}
|
||||
|
||||
res.header("Server", serverName);
|
||||
exportHandler.doExport(req, res, req.params.pad, req.params.type);
|
||||
});
|
||||
|
||||
//serve index.html under /
|
||||
app.get('/', function(req, res)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue