- Touch if you dare.
+
+ Resizing your content will take additional resources on your server. If you wish to
+ optionally resize your output for this stream variant then you should either set the
+ width or the height to keep your aspect ratio.
+
+
+
+
+
+
+
{/* FRAME RATE FIELD */}
diff --git a/web/types/config-section.ts b/web/types/config-section.ts
index e85036397..05484c9df 100644
--- a/web/types/config-section.ts
+++ b/web/types/config-section.ts
@@ -56,6 +56,9 @@ export interface VideoVariant {
audioBitrate: number;
videoPassthrough: boolean;
videoBitrate: number;
+
+ scaledWidth: number;
+ scaledHeight: number;
}
export interface VideoSettingsFields {
latencyLevel: number;
diff --git a/web/utils/apis.ts b/web/utils/apis.ts
index 1972f5745..83e193c0c 100644
--- a/web/utils/apis.ts
+++ b/web/utils/apis.ts
@@ -63,6 +63,8 @@ export const CREATE_WEBHOOK = `${API_LOCATION}webhooks/create`;
// hard coded social icons list
export const SOCIAL_PLATFORMS_LIST = `${NEXT_PUBLIC_API_HOST}api/socialplatforms`;
+export const API_YP_RESET = `${API_LOCATION}yp/reset`;
+
export const TEMP_UPDATER_API = LOGS_ALL;
const GITHUB_RELEASE_URL = 'https://api.github.com/repos/owncast/owncast/releases/latest';
@@ -71,14 +73,10 @@ interface FetchOptions {
data?: any;
method?: string;
auth?: boolean;
-};
+}
export async function fetchData(url: string, options?: FetchOptions) {
- const {
- data,
- method = 'GET',
- auth = true,
- } = options || {};
+ const { data, method = 'GET', auth = true } = options || {};
const requestOptions: RequestInit = {
method,
@@ -114,7 +112,6 @@ export async function fetchData(url: string, options?: FetchOptions) {
return {};
}
-
export async function getGithubRelease() {
try {
const response = await fetch(GITHUB_RELEASE_URL);
@@ -133,29 +130,25 @@ export async function getGithubRelease() {
// Stolen from https://gist.github.com/prenagha/98bbb03e27163bc2f5e4
const VPAT = /^\d+(\.\d+){0,2}$/;
function upToDate(local, remote) {
- if (!local || !remote || local.length === 0 || remote.length === 0)
- return false;
- if (local === remote)
- return true;
- if (VPAT.test(local) && VPAT.test(remote)) {
- const lparts = local.split('.');
- while(lparts.length < 3)
- lparts.push("0");
- const rparts = remote.split('.');
- while (rparts.length < 3)
- rparts.push("0");
- // eslint-disable-next-line no-plusplus
- for (let i=0; i<3; i++) {
- const l = parseInt(lparts[i], 10);
- const r = parseInt(rparts[i], 10);
- if (l === r)
- // eslint-disable-next-line no-continue
- continue;
- return l > r;
- }
- return true;
- }
- return local >= remote;
+ if (!local || !remote || local.length === 0 || remote.length === 0) return false;
+ if (local === remote) return true;
+ if (VPAT.test(local) && VPAT.test(remote)) {
+ const lparts = local.split('.');
+ while (lparts.length < 3) lparts.push('0');
+ const rparts = remote.split('.');
+ while (rparts.length < 3) rparts.push('0');
+ // eslint-disable-next-line no-plusplus
+ for (let i = 0; i < 3; i++) {
+ const l = parseInt(lparts[i], 10);
+ const r = parseInt(rparts[i], 10);
+ if (l === r)
+ // eslint-disable-next-line no-continue
+ continue;
+ return l > r;
+ }
+ return true;
+ }
+ return local >= remote;
}
// Make a request to the server status API and the Github releases API
@@ -165,12 +158,12 @@ export async function upgradeVersionAvailable(currentVersion) {
let recentReleaseVersion = recentRelease.tag_name;
if (recentReleaseVersion.substr(0, 1) === 'v') {
- recentReleaseVersion = recentReleaseVersion.substr(1)
+ recentReleaseVersion = recentReleaseVersion.substr(1);
}
if (!upToDate(currentVersion, recentReleaseVersion)) {
- return recentReleaseVersion
+ return recentReleaseVersion;
}
return null;
-}
\ No newline at end of file
+}
diff --git a/web/utils/config-constants.tsx b/web/utils/config-constants.tsx
index 88223e727..bbca05014 100644
--- a/web/utils/config-constants.tsx
+++ b/web/utils/config-constants.tsx
@@ -168,6 +168,8 @@ export const DEFAULT_VARIANT_STATE: VideoVariant = {
audioPassthrough: true, // if false, then CAN set audiobitrate
audioBitrate: 0,
cpuUsageLevel: 3,
+ scaledHeight: null,
+ scaledWidth: null,
};
export const DEFAULT_SOCIAL_HANDLE: SocialHandle = {
diff --git a/web/utils/urls.ts b/web/utils/urls.ts
index 058bf0639..b03a978f6 100644
--- a/web/utils/urls.ts
+++ b/web/utils/urls.ts
@@ -1,4 +1,4 @@
export function isValidUrl(url: string): boolean {
- const pattern = /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/;
+ const pattern = /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i;
return !!pattern.test(url);
-}
\ No newline at end of file
+}