Просмотр исходного кода

Download all log files from compiles.sharelatex.env (#833)

* add a couple of missing buildPdfDownloadUrl

* only download pdfs from compile server when streaming

* use compiles.env for resonse files

* update config to use clsi_lb
Henry Oswald 8 лет назад
Родитель
Сommit
7a253e56ef

+ 2 - 1
services/web/config/settings.defaults.coffee

@@ -135,6 +135,7 @@ module.exports = settings =
 			url: "http://#{process.env['FILESTORE_HOST'] or 'localhost'}:3009"
 		clsi:
 			url: "http://#{process.env['CLSI_HOST'] or 'localhost'}:3013"
+			# url: "http://#{process.env['CLSI_LB_HOST']}:3014"
 			backendGroupName: undefined
 		templates:
 			url: "http://#{process.env['TEMPLATES_HOST'] or 'localhost'}:3007"
@@ -340,7 +341,7 @@ module.exports = settings =
 	# disablePerUserCompiles: true
 
 	# Domain the client (pdfjs) should download the compiled pdf from
-	# pdfDownloadDomain: "http://compiles.sharelatex.test:3014"
+	# pdfDownloadDomain: "http://clsi-lb:3014"
 
 	# Maximum size of text documents in the real-time editing system.
 	max_doc_length: 2 * 1024 * 1024 # 2mb

+ 6 - 4
services/web/public/coffee/ide/pdf/controllers/PdfController.coffee

@@ -225,7 +225,8 @@ define [
 			}, {params: params}
 
 		buildPdfDownloadUrl = (pdfDownloadDomain, path)->
-			if pdfDownloadDomain?
+			 #we only download builds from compiles server for security reasons
+			if pdfDownloadDomain? and path.indexOf("build") != -1
 				return "#{pdfDownloadDomain}#{path}"
 			else
 				return path
@@ -378,14 +379,15 @@ define [
 						compileGroup:ide.compileGroup
 						clsiserverid:ide.clsiServerId
 				if file?.url?  # FIXME clean this up when we have file.urls out consistently
-					opts.url = buildPdfDownloadUrl options.pdfDownloadDomain, file.url
+					opts.url = file.url
 				else if file?.build?
-					opts.url = buildPdfDownloadUrl options.pdfDownloadDomain, "/project/#{$scope.project_id}/build/#{file.build}/output/#{name}"
+					opts.url = "/project/#{$scope.project_id}/build/#{file.build}/output/#{name}"
 				else
-					opts.url = buildPdfDownloadUrl options.pdfDownloadDomain,  "/project/#{$scope.project_id}/output/#{name}"
+					opts.url = "/project/#{$scope.project_id}/output/#{name}"
 				# check if we need to bust cache (build id is unique so don't need it in that case)
 				if not file?.build?
 					opts.params.cache_bust = "#{Date.now()}"
+				opts.url = buildPdfDownloadUrl options.pdfDownloadDomain, opts.url
 				return $http(opts)
 
 			# accumulate the log entries