mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
clean up pdfcontroller query string logic
This commit is contained in:
@@ -102,6 +102,15 @@ define [
|
|||||||
for file in response?.outputFiles
|
for file in response?.outputFiles
|
||||||
fileByPath[file.path] = file
|
fileByPath[file.path] = file
|
||||||
|
|
||||||
|
# prepare query string
|
||||||
|
qs = {}
|
||||||
|
# add a query string parameter for the compile group
|
||||||
|
if response.compileGroup?
|
||||||
|
ide.compileGroup = qs.compileGroup = response.compileGroup
|
||||||
|
# add a query string parameter for the clsi server id
|
||||||
|
if response.clsiServerId?
|
||||||
|
ide.clsiServerId = qs.clsiserverid = response.clsiServerId
|
||||||
|
|
||||||
if response.status == "timedout"
|
if response.status == "timedout"
|
||||||
$scope.pdf.view = 'errors'
|
$scope.pdf.view = 'errors'
|
||||||
$scope.pdf.timedout = true
|
$scope.pdf.timedout = true
|
||||||
@@ -133,8 +142,6 @@ define [
|
|||||||
$scope.pdf.view = 'pdf'
|
$scope.pdf.view = 'pdf'
|
||||||
$scope.shouldShowLogs = false
|
$scope.shouldShowLogs = false
|
||||||
|
|
||||||
# prepare query string
|
|
||||||
qs = {}
|
|
||||||
# define the base url. if the pdf file has a build number, pass it to the clsi in the url
|
# define the base url. if the pdf file has a build number, pass it to the clsi in the url
|
||||||
if fileByPath['output.pdf']?.url?
|
if fileByPath['output.pdf']?.url?
|
||||||
$scope.pdf.url = fileByPath['output.pdf'].url
|
$scope.pdf.url = fileByPath['output.pdf'].url
|
||||||
@@ -146,16 +153,8 @@ define [
|
|||||||
# check if we need to bust cache (build id is unique so don't need it in that case)
|
# check if we need to bust cache (build id is unique so don't need it in that case)
|
||||||
if not fileByPath['output.pdf']?.build?
|
if not fileByPath['output.pdf']?.build?
|
||||||
qs.cache_bust = "#{Date.now()}"
|
qs.cache_bust = "#{Date.now()}"
|
||||||
# add a query string parameter for the compile group
|
|
||||||
if response.compileGroup?
|
|
||||||
$scope.pdf.compileGroup = response.compileGroup
|
|
||||||
qs.compileGroup = "#{$scope.pdf.compileGroup}"
|
|
||||||
if response.clsiServerId?
|
|
||||||
qs.clsiserverid = response.clsiServerId
|
|
||||||
ide.clsiServerId = response.clsiServerId
|
|
||||||
# convert the qs hash into a query string and append it
|
# convert the qs hash into a query string and append it
|
||||||
$scope.pdf.qs = createQueryString qs
|
$scope.pdf.url += createQueryString qs
|
||||||
$scope.pdf.url += $scope.pdf.qs
|
|
||||||
# Save all downloads as files
|
# Save all downloads as files
|
||||||
qs.popupDownload = true
|
qs.popupDownload = true
|
||||||
$scope.pdf.downloadUrl = "/project/#{$scope.project_id}/output/output.pdf" + createQueryString(qs)
|
$scope.pdf.downloadUrl = "/project/#{$scope.project_id}/output/output.pdf" + createQueryString(qs)
|
||||||
@@ -187,6 +186,7 @@ define [
|
|||||||
opts =
|
opts =
|
||||||
method:"GET"
|
method:"GET"
|
||||||
params:
|
params:
|
||||||
|
compileGroup:ide.compileGroup
|
||||||
clsiserverid:ide.clsiServerId
|
clsiserverid:ide.clsiServerId
|
||||||
if file?.url? # FIXME clean this up when we have file.urls out consistently
|
if file?.url? # FIXME clean this up when we have file.urls out consistently
|
||||||
opts.url = file.url
|
opts.url = file.url
|
||||||
|
|||||||
Reference in New Issue
Block a user