Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- configs.js.o 2013-03-24 09:44:34.467603639 +0100
- +++ configs.js 2013-03-24 09:46:32.813600851 +0100
- @@ -2,11 +2,19 @@
- directory: {
- // absolute path of where to store compiled pdfs
- // defaults to "pdfs" directory in "flylatex" repo
- - path: "/Users/alabid/flylatex/blank"
- + path: "/var/www/flylatex/pdfs"
- }
- , db : {
- url : "mongodb://localhost/flydb" // for example: mongodb://localhost/flydb3"
- }
- + , temp : {
- + // set the temppath, empty means default (absolute paths only)
- + path : "/var/www/flylatex/_tmp/"
- + }
- + , pdflatex : {
- + // where to find pdflatex, empty means "pdflatex"
- + command : "/usr/bin/pdflatex"
- + }
- };
- --- routes.js.o 2013-03-24 09:44:34.505603638 +0100
- +++ routes.js 2013-03-24 10:24:31.566547178 +0100
- @@ -43,7 +43,7 @@
- // ================ GLOBAL variables here =============
- // maximum number of documents a user can have
- -var MAX_DOCS = 20;
- +var MAX_DOCS = 100;
- // messageTypes
- var MESSAGE_TYPES = {
- @@ -1169,7 +1169,7 @@
- var docLines = []
- , lastModified
- , docText;
- -
- +
- // get document lines
- doc.lines.forEach(function(item, index) {
- docLines.push(item.data.toString());
- @@ -1182,42 +1182,53 @@
- // get the document text
- docText = docLines.join();
- + // fixing TEMP Path
- + if(configs.temp.path.lengh !== '' && configs.temp.path.substring(0, 1)==='/'){
- + configs.temp.path = '..' + configs.temp.path;
- + }
- +
- + // fixing pdflatex path
- + if(configs.pdflatex.command === ''){
- + configs.pdflatex.command = 'pdflatex';
- + }
- +
- +
- // make temporary directory to create and compile latex pdf
- - temp.mkdir("pdfcreator", function(err, dirPath){
- + temp.mkdir(configs.temp.path + "pdfcreator", function(err, dirPath){
- var inputPath = path.join(dirPath, documentId+".tex");
- -
- + try {
- + fs.chmodSync(dirPath, 0766);
- + }catch(e){;}
- +
- fs.writeFile(inputPath, docText, function(err) {
- if (err) {
- response.errors.push("An error occured even before compiling");
- res.json(response);
- return;
- }
- - process.chdir(dirPath);
- // compile the document (or at least try)
- // redirect the stdin, stderr results of compilation
- // since the results of compilation will eventually be
- // written to the log file
- - exec("pdflatex -interaction=nonstopmode "+ inputPath +" > /dev/null 2>&1", function(err) {
- + var exStr = configs.pdflatex.command + " -output-directory="+ dirPath +" -interaction=nonstopmode "+ inputPath +" > /dev/null 2>&1";
- + exec(exStr, function(err) {
- // store the logs for the user here
- fs.readFile(path.join(dirPath, documentId+".log"), function(err, data){
- if (err) {
- - response.errors.push("Error while trying to read logs.");
- + response.errors.push("Error while reading compiled data.");
- + console.log(err);
- + res.json(response);
- + fs.remove(dirPath);
- + return;
- }
- // store the 'logs' from the compile
- response.logs = (data ? data.toString() : "");
- - var errorStr = "An error occured before or during compilation";
- - if (err) {
- - console.log(err);
- - response.errors.push(errorStr);
- - res.json(response);
- - return;
- - }
- + var errorStr = "An error occured during compilation, please check your document syntax.";
- // store the compile pdf document in the cloud
- -
- // create new PDFDoc
- var newpdf = new PDFDoc();
- newpdf.forDocument = documentId;
- @@ -1230,10 +1241,12 @@
- console.log(err);
- response.errors.push(errorStr);
- res.json(response);
- + fs.remove(dirPath);
- return;
- } else {
- console.log("Successfully saved "+newpdf.title+" in "+configs.directory.path);
- newpdf.save(function(err) {
- + fs.remove(dirPath);
- if (err) {
- console.log(err);
- response.errors.push(errorStr);
- @@ -1427,8 +1440,7 @@
- newLine.lastModified = new Date();
- newLine.save(function(err) {
- - if (!err)
- - console.log("new line saved successfully!");
- + if (!err) console.log("new line saved successfully!");
- });
- doc.lines[lineNum] = newLine;
- --- public/css/bootstrap.css.o 2013-03-23 20:32:04.852723604 +0100
- +++ public/css/bootstrap.css 2013-03-24 09:44:34.468603639 +0100
- @@ -791,7 +791,7 @@
- display: inline-block;
- height: 18px;
- padding: 4px;
- +/* margin-bottom: 9px; */
- - margin-bottom: 9px;
- font-size: 13px;
- line-height: 18px;
- color: #555555;
- @@ -3222,7 +3222,6 @@
- .nav .nav-header {
- display: block;
- padding: 3px 15px;
- + margin-bottom:9px;
- font-size: 11px;
- font-weight: bold;
- line-height: 18px;
- @@ -3249,7 +3248,7 @@
- }
- .nav-list > li > a {
- - padding: 3px 15px;
- + padding: 5px 15px;
- }
- .nav-list > .active > a,
Advertisement
Add Comment
Please, Sign In to add comment