diff --git a/services/web/app/coffee/Features/Compile/ClsiManager.coffee b/services/web/app/coffee/Features/Compile/ClsiManager.coffee index 0e910d8591..22598d7dfa 100755 --- a/services/web/app/coffee/Features/Compile/ClsiManager.coffee +++ b/services/web/app/coffee/Features/Compile/ClsiManager.coffee @@ -54,6 +54,7 @@ module.exports = ClsiManager = outputFiles.push path: url.parse(file.url).path.replace("/project/#{project_id}/output/", "") type: file.type + build: file.build return outputFiles VALID_COMPILERS: ["pdflatex", "latex", "xelatex", "lualatex"] diff --git a/services/web/app/coffee/Features/Compile/CompileController.coffee b/services/web/app/coffee/Features/Compile/CompileController.coffee index b95a8ed82c..16840ef576 100755 --- a/services/web/app/coffee/Features/Compile/CompileController.coffee +++ b/services/web/app/coffee/Features/Compile/CompileController.coffee @@ -85,15 +85,20 @@ module.exports = CompileController = url = "#{compilerUrl}#{url}" logger.log url: url, "proxying to CLSI" oneMinute = 60 * 1000 - # pass through If-* and Range headers for byte serving pdfs - # do not send any others, potential proxying loop if Host: is passed! + # the base request + options = { url: url, method: req.method, timeout: oneMinute } + # if we have a build parameter, pass it through to the clsi + if req.query?.build? + options.qs = {} + options.qs.build = req.query.build + # if we are byte serving pdfs, pass through If-* and Range headers + # do not send any others, there's a proxying loop if Host: is passed! if req.query?.pdfng newHeaders = {} for h, v of req.headers newHeaders[h] = req.headers[h] if h.match /^(If-|Range)/i - proxy = request(url: url, method: req.method, timeout: oneMinute, headers: newHeaders) - else - proxy = request(url: url, method: req.method, timeout: oneMinute) + options.headers = newHeaders + proxy = request(options) proxy.pipe(res) proxy.on "error", (error) -> logger.warn err: error, url: url, "CLSI proxy error" diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index bd17965d26..43b11dd14f 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -41,12 +41,17 @@ define [ $scope.pdf.failure = true fetchLogs() else if response.status == "success" + $scope.pdf.url = "/project/#{$scope.project_id}/output/output.pdf?cache_bust=#{Date.now()}" if response.compileGroup? $scope.pdf.compileGroup = response.compileGroup - $scope.pdf.url = "/project/#{$scope.project_id}/output/output.pdf?cache_bust=#{Date.now()}" + - "&compileGroup=#{$scope.pdf.compileGroup}" - else - $scope.pdf.url = "/project/#{$scope.project_id}/output/output.pdf?cache_bust=#{Date.now()}" + $scope.pdf.url = $scope.pdf.url + "&compileGroup=#{$scope.pdf.compileGroup}" + fileByPath = {} + for file in response.outputFiles + fileByPath[file.path] = file + if fileByPath['output.pdf']?.build? + build = fileByPath['output.pdf'].build + $scope.pdf.url = $scope.pdf.url + "&build=#{build}" + fetchLogs() IGNORE_FILES = ["output.fls", "output.fdb_latexmk"]