mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-01 10:56:42 +02:00
Show stats in the Guide menu & refactor
This commit is contained in:
@@ -39,6 +39,8 @@ export enum BxEvent {
|
||||
XCLOUD_DIALOG_SHOWN = 'bx-xcloud-dialog-shown',
|
||||
XCLOUD_DIALOG_DISMISSED = 'bx-xcloud-dialog-dismissed',
|
||||
|
||||
XCLOUD_GUIDE_SHOWN = 'bx-xcloud-guide-shown',
|
||||
|
||||
XCLOUD_POLLING_MODE_CHANGED = 'bx-xcloud-polling-mode-changed',
|
||||
}
|
||||
|
||||
@@ -46,6 +48,10 @@ export enum XcloudEvent {
|
||||
MICROPHONE_STATE_CHANGED = 'microphoneStateChanged',
|
||||
}
|
||||
|
||||
export enum XcloudGuideWhere {
|
||||
HOME,
|
||||
}
|
||||
|
||||
export namespace BxEvent {
|
||||
export function dispatch(target: HTMLElement | Window, eventName: string, data?: any) {
|
||||
if (!eventName) {
|
||||
|
@@ -22,6 +22,15 @@ import iconCamera from "@assets/svg/camera.svg" with { type: "text" };
|
||||
import iconMicrophone from "@assets/svg/microphone.svg" with { type: "text" };
|
||||
import iconMicrophoneMuted from "@assets/svg/microphone-slash.svg" with { type: "text" };
|
||||
|
||||
// Stream Badge
|
||||
import iconBatteryFull from "@assets/svg/battery-full.svg" with { type: "text" };
|
||||
import iconClock from "@assets/svg/clock.svg" with { type: "text" };
|
||||
import iconCloud from "@assets/svg/cloud.svg" with { type: "text" };
|
||||
import iconDownload from "@assets/svg/download.svg" with { type: "text" };
|
||||
import iconSpeakerHigh from "@assets/svg/speaker-high.svg" with { type: "text" };
|
||||
import iconUpload from "@assets/svg/upload.svg" with { type: "text" };
|
||||
|
||||
|
||||
export const BxIcon = {
|
||||
STREAM_SETTINGS: iconStreamSettings,
|
||||
STREAM_STATS: iconStreamStats,
|
||||
@@ -48,4 +57,12 @@ export const BxIcon = {
|
||||
|
||||
MICROPHONE: iconMicrophone,
|
||||
MICROPHONE_MUTED: iconMicrophoneMuted,
|
||||
|
||||
// Stream Badge
|
||||
BATTERY: iconBatteryFull,
|
||||
PLAYTIME: iconClock,
|
||||
SERVER: iconCloud,
|
||||
DOWNLOAD: iconDownload,
|
||||
UPLOAD: iconUpload,
|
||||
AUDIO: iconSpeakerHigh,
|
||||
} as const;
|
||||
|
@@ -366,14 +366,15 @@ class XcloudInterceptor {
|
||||
const url = (typeof request === 'string') ? request : (request as Request).url;
|
||||
const parsedUrl = new URL(url);
|
||||
|
||||
StreamBadges.region = parsedUrl.host.split('.', 1)[0];
|
||||
let badgeRegion: string = parsedUrl.host.split('.', 1)[0];
|
||||
for (let regionName in STATES.serverRegions) {
|
||||
const region = STATES.serverRegions[regionName];
|
||||
if (parsedUrl.origin == region.baseUri) {
|
||||
StreamBadges.region = regionName;
|
||||
badgeRegion = regionName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
StreamBadges.getInstance().setRegion(badgeRegion);
|
||||
|
||||
const clone = (request as Request).clone();
|
||||
const body = await clone.json();
|
||||
|
Reference in New Issue
Block a user