|
|
@@ -3,7 +3,8 @@ import HumanReadableLogs from '../../../ide/human-readable-logs/HumanReadableLog
|
|
|
import BibLogParser from '../../../ide/log-parser/bib-log-parser'
|
|
|
import { v4 as uuid } from 'uuid'
|
|
|
import { enablePdfCaching } from './pdf-caching-flags'
|
|
|
-import { fetchFromCompileDomain } from './fetchFromCompileDomain'
|
|
|
+import { fetchFromCompileDomain, swapDomain } from './fetchFromCompileDomain'
|
|
|
+import { userContentDomainAccessCheckPassed } from '../../user-content-domain-access-check'
|
|
|
|
|
|
// Warnings that may disappear after a second LaTeX pass
|
|
|
const TRANSIENT_WARNING_REGEX = /^(Reference|Citation).+undefined on input line/
|
|
|
@@ -28,7 +29,8 @@ export function handleOutputFiles(outputFiles, projectId, data) {
|
|
|
|
|
|
outputFile.pdfUrl = `${buildURL(
|
|
|
outputFile,
|
|
|
- data.pdfDownloadDomain
|
|
|
+ data.pdfDownloadDomain,
|
|
|
+ data.enableHybridPdfDownload
|
|
|
)}?${params}`
|
|
|
|
|
|
// build the URL for downloading the PDF
|
|
|
@@ -71,7 +73,7 @@ export const handleLogFiles = async (outputFiles, data, signal) => {
|
|
|
if (logFile) {
|
|
|
try {
|
|
|
const response = await fetchFromCompileDomain(
|
|
|
- buildURL(logFile, data.pdfDownloadDomain),
|
|
|
+ buildURL(logFile, data.pdfDownloadDomain, data.enableHybridPdfDownload),
|
|
|
{ signal }
|
|
|
)
|
|
|
|
|
|
@@ -102,7 +104,7 @@ export const handleLogFiles = async (outputFiles, data, signal) => {
|
|
|
if (blgFile) {
|
|
|
try {
|
|
|
const response = await fetchFromCompileDomain(
|
|
|
- buildURL(blgFile, data.pdfDownloadDomain),
|
|
|
+ buildURL(blgFile, data.pdfDownloadDomain, data.enableHybridPdfDownload),
|
|
|
{ signal }
|
|
|
)
|
|
|
|
|
|
@@ -159,7 +161,20 @@ export function buildLogEntryAnnotations(entries, fileTreeManager) {
|
|
|
return logEntryAnnotations
|
|
|
}
|
|
|
|
|
|
-function buildURL(file, pdfDownloadDomain) {
|
|
|
+function buildURL(file, pdfDownloadDomain, enableHybridPdfDownload) {
|
|
|
+ const userContentDomain = getMeta('ol-compilesUserContentDomain')
|
|
|
+ if (
|
|
|
+ enableHybridPdfDownload &&
|
|
|
+ userContentDomainAccessCheckPassed() &&
|
|
|
+ file.build &&
|
|
|
+ userContentDomain
|
|
|
+ ) {
|
|
|
+ // This user is enrolled in the hybrid download of compile output.
|
|
|
+ // The access check passed, so try to use the new user content domain.
|
|
|
+ // Downloads from the compiles domains must include a build id.
|
|
|
+ // The build id is used implicitly for access control.
|
|
|
+ return swapDomain(`${pdfDownloadDomain}${file.url}`, userContentDomain)
|
|
|
+ }
|
|
|
if (file.build && pdfDownloadDomain) {
|
|
|
// Downloads from the compiles domain must include a build id.
|
|
|
// The build id is used implicitly for access control.
|