Skip to content

Commit 61caeb8

Browse files
authored
Misc build fixes (#160)
1 parent e556e23 commit 61caeb8

File tree

10 files changed

+81
-90
lines changed

10 files changed

+81
-90
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"matrix-widget-api": "^0.1.0-beta.11",
3434
"moment": "^2.29.1",
3535
"node-fetch": "^2.6.1",
36-
"pg": "^8.5.1",
36+
"pg": "^8.9.0",
3737
"postcss-preset-env": "^6.7.0",
3838
"rfc4648": "^1.4.0",
3939
"string-template": "^1.0.0"
@@ -50,7 +50,7 @@
5050
"postcss-loader": "^4.1.0",
5151
"style-loader": "^2.0.0",
5252
"ts-jest": "^29.0.3",
53-
"ts-loader": "^8.0.14",
53+
"ts-loader": "^9.4.2",
5454
"typescript": "^4.9.4",
5555
"webpack": "^5.12.1",
5656
"webpack-cli": "^4.3.1",

src/__tests__/backends/penta/__snapshots__/PentabarfParser.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ exports[`parsing pentabarf XML: overview: auditoriums 1`] = `
66
"id": "A.01 (Someroom)",
77
"isPhysical": false,
88
"kind": "auditorium",
9-
"name": "01 (Someroom)",
10-
"slug": "01_someroom_",
9+
"name": "A.01 (Someroom)",
10+
"slug": "a.01_someroom_",
1111
"talks": Map {
1212
"E001" => {
1313
"auditoriumId": "A.01 (Someroom)",
@@ -51,8 +51,8 @@ exports[`parsing pentabarf XML: overview: conference 1`] = `
5151
"id": "A.01 (Someroom)",
5252
"isPhysical": false,
5353
"kind": "auditorium",
54-
"name": "01 (Someroom)",
55-
"slug": "01_someroom_",
54+
"name": "A.01 (Someroom)",
55+
"slug": "a.01_someroom_",
5656
"talks": Map {
5757
"E001" => {
5858
"auditoriumId": "A.01 (Someroom)",

src/backends/penta/PentabarfParser.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ export function decodePrefix(id: string, prefixConfig: IPrefixConfig): {kind: Ro
4646
// For physical auditoriums: don't strip the prefix. For e.g. K.1.102 the `K` is a building name and is important!
4747
return {kind: RoomKind.Auditorium, name: override || id};
4848
}
49-
return {kind: RoomKind.Auditorium, name: override || id.substring(auditoriumPrefix.length)};
49+
// TODO(FOSDEM 2023): don't strip the prefix, because on FOSDEM's end they are not stripped in the livestream IDs.
50+
// It would be good to figure out why we wanted to strip prefixes originally and whether we need finer controls.
51+
//return {kind: RoomKind.Auditorium, name: override || id.substring(auditoriumPrefix.length)};
52+
return {kind: RoomKind.Auditorium, name: override || id };
5053
}
5154

5255
const interestPrefix = prefixConfig.interestRooms.find(p => id.startsWith(p));

web/auditorium.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import "./common.scss";
1818

1919
import { controlsEl, makeLivestream, muteButton, videoEl } from "./hls";
2020

21-
const messagesEl = document.getElementById("messages");
21+
const messagesEl = document.getElementById("messages")!;
2222

2323
messagesEl.style.display = 'block';
2424
muteButton.style.display = 'block';

web/common.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export function formatDuration(duration: number): string {
2525
return `${minutes}:${seconds}`;
2626
}
2727

28-
export function getAttr(name: string): string {
29-
return Array.from(document.getElementsByTagName('meta'))
28+
export function getAttr(name: string): string | null {
29+
return (Array.from(document.getElementsByTagName('meta'))
3030
.find(t => t.name === name)
31-
.getAttribute('content');
31+
?.getAttribute('content')) || null;
3232
}

web/hls.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import { getAttr } from "./common";
2020

2121
const videoUrl = getAttr('org.matrix.confbot.video_url');
2222

23-
export const videoEl = document.getElementById("livestream") as HTMLVideoElement;
24-
export const muteButton = document.getElementById('muteButton');
25-
export const controlsEl = document.getElementById("controlBar");
23+
export const videoEl = document.getElementById("livestream")! as HTMLVideoElement;
24+
export const muteButton = document.getElementById('muteButton')!;
25+
export const controlsEl = document.getElementById("controlBar")!;
2626

2727
if (isWidget) {
2828
videoEl.classList.add('widget');
@@ -41,7 +41,7 @@ export function pause() {
4141
videoEl.pause();
4242
}
4343

44-
export function play(readyFn: (isReady: boolean) => void = null) {
44+
export function play(readyFn: ((isReady: boolean) => void) | null = null) {
4545
isVideoMode = true;
4646
if (hls) hls.destroy();
4747
makeLivestream(readyFn || lastReadyFn);

web/jitsi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function joinConference(opts, widgetApi, onCallback) {
8484
if (!openIdToken?.access_token) { // eslint-disable-line camelcase
8585
// We've failed to get a token, don't try to init conference
8686
console.warn('Expected to have an OpenID credential, cannot initialize widget.');
87-
document.getElementById("widgetActionContainer").innerText = "Failed to load Jitsi widget";
87+
document.getElementById("widgetActionContainer")!.innerText = "Failed to load Jitsi widget";
8888
return;
8989
}
9090
jwt = createJWTToken(jitsiDomain, roomId, avatarUrl, displayName, openIdToken);
@@ -119,7 +119,7 @@ export async function joinConference(opts, widgetApi, onCallback) {
119119
if (title) meetApi.executeCommand("subject", title);
120120

121121
meetApi.on("readyToClose", () => {
122-
document.getElementById("jitsiContainer").innerHTML = "";
122+
document.getElementById("jitsiContainer")!.innerHTML = "";
123123
meetApi = null;
124124
onCallback();
125125
});

web/scoreboard.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { MatrixCapabilities, WidgetApi } from "matrix-widget-api";
1919
import { widgetId } from "./widgets";
2020
import { formatDuration, getAttr } from "./common";
2121

22-
const upvoteEl = document.getElementById("upvoted");
22+
const upvoteEl = document.getElementById("upvoted")!;
2323

2424
interface Scoreboard {
2525
qaStartTime: number | null;
@@ -35,7 +35,7 @@ interface RoomMessage {
3535
senderAvatarHttpUrl?: string;
3636
}
3737

38-
let widgetApi: WidgetApi = null;
38+
let widgetApi: WidgetApi | null = null;
3939

4040
// Start widget API as early as possible
4141
if (widgetId) {
@@ -44,12 +44,12 @@ if (widgetId) {
4444
widgetApi.requestCapability(MatrixCapabilities.MSC2931Navigate);
4545
widgetApi.start();
4646
await new Promise<void>(resolve => {
47-
widgetApi.once("ready", () => resolve());
47+
widgetApi!.once("ready", () => resolve());
4848
});
4949
})();
5050
}
5151

52-
const forRoomId = getAttr('org.matrix.confbot.room_id');
52+
const forRoomId = getAttr('org.matrix.confbot.room_id')!;
5353

5454
function innerText(tag: string, clazz: string, text: string): [string, string[]] {
5555
const id = Date.now() + '-' + (Math.random() * Number.MAX_SAFE_INTEGER) + '-text';
@@ -68,11 +68,11 @@ function render(scoreboard: Scoreboard) {
6868
clearInterval(bannerUpdateTimer);
6969
bannerUpdateTimer = null;
7070
}
71+
const banner = document.getElementById('scoreboardQABanner')!;
7172
if (scoreboard.qaStartTime !== null) {
7273
// Show the countdown banner
7374
function renderBannerText(qaStartTime: number) {
7475
const timeUntilStart = qaStartTime - Date.now();
75-
const banner = document.getElementById('scoreboardQABanner');
7676
if (timeUntilStart < 0) {
7777
banner.innerText = "Q&A has started";
7878
} else {
@@ -84,10 +84,10 @@ function render(scoreboard: Scoreboard) {
8484
}
8585
bannerUpdateTimer = window.setInterval(renderBannerText, 100, scoreboard.qaStartTime);
8686
renderBannerText(scoreboard.qaStartTime);
87-
document.getElementById('scoreboardQABanner').style.display = 'block';
87+
banner.style.display = 'block';
8888
} else {
8989
// Hide the countdown banner
90-
document.getElementById('scoreboardQABanner').style.display = 'none';
90+
banner.style.display = 'none';
9191
}
9292

9393
let html = "";
@@ -124,7 +124,7 @@ function render(scoreboard: Scoreboard) {
124124
}
125125
upvoteEl.innerHTML = html;
126126
for (const innerText of innerTexts) {
127-
document.getElementById(innerText[0]).innerText = innerText[1];
127+
document.getElementById(innerText[0])!.innerText = innerText[1];
128128
}
129129
}
130130

@@ -140,7 +140,7 @@ function intercept(ev) {
140140

141141
ev.preventDefault();
142142
ev.stopPropagation();
143-
widgetApi.navigateTo(ev.target.href);
143+
widgetApi!.navigateTo(ev.target.href);
144144
}
145145
(<any>window).intercept = intercept;
146146

web/talk.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ import { controlsEl, makeLivestream, muteButton, pause, play, videoEl } from "./
2222
import { addlQuery, isWidget, widgetId } from "./widgets";
2323
import { formatDuration, getAttr } from "./common";
2424

25-
const messagesEl = document.getElementById("messages");
26-
const jitsiContainer = document.getElementById("jitsiContainer");
27-
const jitsiUnderlay = document.getElementById("jitsiUnderlay");
28-
const liveBanner = document.getElementById("liveBanner");
29-
const liveBannerShortText = document.getElementById("liveBannerShortText");
30-
const liveBannerLongText = document.getElementById("liveBannerLongText");
31-
const joinButton = document.getElementById('joinButton');
25+
const messagesEl = document.getElementById("messages")!;
26+
const jitsiContainer = document.getElementById("jitsiContainer")!;
27+
const jitsiUnderlay = document.getElementById("jitsiUnderlay")!;
28+
const liveBanner = document.getElementById("liveBanner")!;
29+
const liveBannerShortText = document.getElementById("liveBannerShortText")!;
30+
const liveBannerLongText = document.getElementById("liveBannerLongText")!;
31+
const joinButton = document.getElementById('joinButton')!;
3232

3333
const livestreamStartTime = getAttr('org.matrix.confbot.livestream_start_time') ?
34-
parseInt(getAttr('org.matrix.confbot.livestream_start_time')) :
34+
parseInt(getAttr('org.matrix.confbot.livestream_start_time')!) :
3535
null;
3636
const livestreamEndTime = getAttr('org.matrix.confbot.livestream_end_time') ?
37-
parseInt(getAttr('org.matrix.confbot.livestream_end_time')) :
37+
parseInt(getAttr('org.matrix.confbot.livestream_end_time')!) :
3838
null;
3939

40-
let widgetApi: WidgetApi = null;
40+
let widgetApi: WidgetApi | null = null;
4141

4242
// Start widget API as early as possible
4343
if (widgetId) {
@@ -46,7 +46,7 @@ if (widgetId) {
4646
widgetApi.requestCapabilities(VideoConferenceCapabilities);
4747
widgetApi.start();
4848
await new Promise<void>(resolve => {
49-
widgetApi.once("ready", () => resolve());
49+
widgetApi!.once("ready", () => resolve());
5050
});
5151
await widgetApi.setAlwaysOnScreen(false);
5252
})();

0 commit comments

Comments
 (0)