@@ -408,38 +460,6 @@ export class CrawlDetail extends LiteElement {
>`
: ``}
- {
- const data = await this.apiFetch(
- `/archives/${this.archiveId}/crawls/${this.crawlId}/watch`,
- this.authState!,
- {
- method: "POST",
- }
- );
-
- return data.watch_url;
- }
-
private async cancel() {
if (window.confirm(msg("Are you sure you want to cancel the crawl?"))) {
const data = await this.apiFetch(
@@ -761,6 +769,21 @@ export class CrawlDetail extends LiteElement {
private stopPollTimer() {
window.clearTimeout(this.timerId);
}
+
+ /**
+ * Enter fullscreen mode
+ * @param id ID of element to fullscreen
+ */
+ private async enterFullscreen(id: string) {
+ try {
+ document.getElementById(id)!.requestFullscreen({
+ // Show browser navigation controls
+ navigationUI: "show",
+ });
+ } catch (err) {
+ console.error(err);
+ }
+ }
}
customElements.define("btrix-crawl-detail", CrawlDetail);
diff --git a/frontend/src/pages/archive/crawl-templates-detail.ts b/frontend/src/pages/archive/crawl-templates-detail.ts
index decaab7d..48bc98e8 100644
--- a/frontend/src/pages/archive/crawl-templates-detail.ts
+++ b/frontend/src/pages/archive/crawl-templates-detail.ts
@@ -759,7 +759,7 @@ export class CrawlTemplatesDetail extends LiteElement {
${this.crawlTemplate.currCrawlId
? html` ${msg("View crawl")}`
@@ -787,7 +787,7 @@ export class CrawlTemplatesDetail extends LiteElement {
${this.crawlTemplate?.lastCrawlId
? html`${msg("View crawl")}
@@ -1240,7 +1240,8 @@ export class CrawlTemplatesDetail extends LiteElement {
View crawl`
diff --git a/frontend/src/pages/archive/crawl-templates-list.ts b/frontend/src/pages/archive/crawl-templates-list.ts
index 3daf4872..2f108565 100644
--- a/frontend/src/pages/archive/crawl-templates-list.ts
+++ b/frontend/src/pages/archive/crawl-templates-list.ts
@@ -364,7 +364,7 @@ export class CrawlTemplatesList extends LiteElement {
? this.navTo(
`/archives/${this.archiveId}/crawls/crawl/${
this.runningCrawlsMap[t.id]
- }`
+ }#watch`
)
: this.runNow(t);
}}
@@ -502,7 +502,8 @@ export class CrawlTemplatesList extends LiteElement {
html`Started crawl from ${template.name}.
View crawl`
diff --git a/frontend/src/pages/archive/crawl-templates.ts b/frontend/src/pages/archive/crawl-templates.ts
index 5e6192a5..41e726a5 100644
--- a/frontend/src/pages/archive/crawl-templates.ts
+++ b/frontend/src/pages/archive/crawl-templates.ts
@@ -157,7 +157,8 @@ export class CrawlTemplatesList extends LiteElement {
html`Started crawl from ${template.name}.
View crawl`
diff --git a/frontend/src/pages/archive/index.ts b/frontend/src/pages/archive/index.ts
index a238448a..dda7cc67 100644
--- a/frontend/src/pages/archive/index.ts
+++ b/frontend/src/pages/archive/index.ts
@@ -53,7 +53,7 @@ export class Archive extends LiteElement {
isNewResourceTab: boolean = false;
@state()
- private archive?: ArchiveData;
+ private archive?: ArchiveData | null;
@state()
private successfullyInvitedEmail?: string;
@@ -61,14 +61,22 @@ export class Archive extends LiteElement {
async firstUpdated() {
if (!this.archiveId) return;
- const archive = await this.getArchive(this.archiveId);
+ try {
+ const archive = await this.getArchive(this.archiveId);
- if (!archive) {
- this.navTo("/archives");
- } else {
- this.archive = archive;
+ if (!archive) {
+ this.navTo("/archives");
+ } else {
+ this.archive = archive;
+ }
+ } catch {
+ this.archive = null;
- // TODO get archive members
+ this.notify({
+ message: msg("Sorry, couldn't retrieve archive at this time."),
+ type: "danger",
+ icon: "exclamation-octagon",
+ });
}
}
@@ -79,6 +87,11 @@ export class Archive extends LiteElement {
}
render() {
+ if (this.archive === null) {
+ // TODO handle 404 and 500s
+ return "";
+ }
+
if (!this.archive) {
return html`
;
};
type SeedConfig = {
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js
index 99472002..f1915f3d 100644
--- a/frontend/tailwind.config.js
+++ b/frontend/tailwind.config.js
@@ -47,6 +47,9 @@ function makeTheme() {
lg: `var(--sl-shadow-large)`,
xl: `var(--sl-shadow-x-large)`,
},
+ aspectRatio: {
+ "4/3": "4 / 3", // For Browsertrix watch/replay
+ },
};
}
diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js
index 66e54d64..be6a91ea 100644
--- a/frontend/webpack.config.js
+++ b/frontend/webpack.config.js
@@ -1,9 +1,9 @@
// webpack.config.js
const path = require("path");
+const webpack = require("webpack");
const ESLintPlugin = require("eslint-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
-const Dotenv = require("dotenv-webpack");
const childProcess = require("child_process");
const isDevServer = process.env.WEBPACK_SERVE;
@@ -23,14 +23,16 @@ const execCommand = (cmd, defValue) => {
} catch (e) {
return defValue;
}
-}
+};
// Local dev only
// Git branch and commit hash is used to add build info to error reporter when running locally
-const gitBranch = process.env.GIT_BRANCH_NAME ||
+const gitBranch =
+ process.env.GIT_BRANCH_NAME ||
execCommand("git rev-parse --abbrev-ref HEAD", "unknown");
-const commitHash = process.env.GIT_COMMIT_HASH ||
+const commitHash =
+ process.env.GIT_COMMIT_HASH ||
execCommand("git rev-parse --short HEAD", "unknown");
require("dotenv").config({
@@ -106,6 +108,7 @@ module.exports = {
Host: backendUrl.host,
},
pathRewrite: { "^/api": "" },
+ ws: true,
},
},
// Serve replay service worker file
@@ -119,7 +122,9 @@ module.exports = {
},
plugins: [
- new Dotenv({ path: dotEnvPath }),
+ new webpack.DefinePlugin({
+ "process.env.API_HOST": JSON.stringify(backendUrl.host),
+ }),
new HtmlWebpackPlugin({
template: "src/index.ejs",