Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Move updates into Settings

Jonny Burger1dd732f3e20c
diff --git a/packages/studio-server/src/preview-server/api-routes.ts b/packages/studio-server/src/preview-server/api-routes.ts
index 11f3250e92..748f3b7831 100644
--- a/packages/studio-server/src/preview-server/api-routes.ts
+++ b/packages/studio-server/src/preview-server/api-routes.ts
@@ -39,6 +39,7 @@ import {prepareElementInstallHandler} from './routes/prepare-element-install';
import {projectInfoHandler} from './routes/project-info';
import {redoHandler} from './routes/redo';
import {registerClientRenderHandler} from './routes/register-client-render';
+import {getReleaseNotesHandler} from './routes/release-notes';
import {remotionSkillsInfoHandler} from './routes/remotion-skills-info';
import {handleRemoveRender} from './routes/remove-render';
import {renameStaticFileHandler} from './routes/rename-static-file';
@@ -118,6 +119,7 @@ export const allApiRoutes: {
'/api/split-jsx-sequence': splitJsxSequenceHandler,
'/api/split-video-from-audio': splitVideoFromAudioHandler,
'/api/update-available': handleUpdate,
+ '/api/release-notes': getReleaseNotesHandler,
'/api/remotion-skills-info': remotionSkillsInfoHandler,
'/api/project-info': projectInfoHandler,
'/api/delete-static-file': deleteStaticFileHandler,
diff --git a/packages/studio-server/src/preview-server/routes/release-notes.ts b/packages/studio-server/src/preview-server/routes/release-notes.ts
new file mode 100644
index 0000000000..f183004153
--- /dev/null
+++ b/packages/studio-server/src/preview-server/routes/release-notes.ts
@@ -0,0 +1,146 @@
+import type {
+ GetReleaseNotesRequest,
+ GetReleaseNotesResponse,
+} from '@remotion/studio-shared';
+import semver from 'semver';
+import type {ApiHandler} from '../api-types';
+
+const githubApiVersion = '2022-11-28';
+const releaseNotesTimeout = 5000;
+const maximumReleaseNotes = 5;
+
+export const getReleaseNotesHandler: ApiHandler<
+ GetReleaseNotesRequest,
+ GetReleaseNotesResponse
+> = async ({input}) => {
+ const currentVersion = semver.valid(input.currentVersion);
+ const latestVersion = semver.valid(input.latestVersion);
+ if (currentVersion === null || latestVersion === null) {
+ throw new Error(
+ `Invalid Remotion version range: ${input.currentVersion} to ${input.latestVersion}`,
+ );
+ }
+
+ const controller = new AbortController();
+ const timeout = setTimeout(() => controller.abort(), releaseNotesTimeout);
+
+ try {
+ const releaseResponse = await fetch(
+ 'https://api.github.com/repos/remotion-dev/remotion/releases?per_page=100',
+ {
+ headers: {
+ accept: 'application/vnd.github+json',
+ 'user-agent': 'Remotion Studio',
+ 'x-github-api-version': githubApiVersion,
+ },
+ signal: controller.signal,
+ },
+ );
+
+ if (!releaseResponse.ok) {
+ return {hasMore: false, releases: []};
+ }
+
+ const githubReleases = (await releaseResponse.json()) as unknown;
+ if (!Array.isArray(githubReleases)) {
+ return {hasMore: false, releases: []};
+ }
+
+ const matchingReleases = githubReleases
+ .flatMap((release) => {
+ if (typeof release !== 'object' || release === null) {
+ return [];
+ }
+
+ const {
+ body,
+ published_at: publishedAt,
+ tag_name: tagName,
+ } = release as Record<string, unknown>;
+ if (typeof tagName !== 'string') {
+ return [];
+ }
+
+ const version = semver.valid(
+ tagName.startsWith('v') ? tagName.slice(1) : tagName,
+ );
+ if (
+ version === null ||
+ !semver.gt(version, currentVersion) ||
+ !semver.lte(version, latestVersion)
+ ) {
+ return [];
+ }
+
+ return [
+ {
+ body: typeof body === 'string' ? body : null,
+ publishedAt: typeof publishedAt === 'string' ? publishedAt : null,
+ version,
+ },
+ ];
+ })
+ .sort((a, b) => semver.rcompare(a.version, b.version));
+
+ const hasMore = matchingReleases.length > maximumReleaseNotes;
+ const releases = await Promise.all(
+ matchingReleases.slice(0, maximumReleaseNotes).map(async (release) => {
+ if (release.body === null || release.body.trim() === '') {
+ return {
+ publishedAt: release.publishedAt,
+ releaseNotesHtml: null,
+ version: release.version,
+ };
+ }
+
+ try {
+ const markdownResponse = await fetch(
+ 'https://api.github.com/markdown',
+ {
+ body: JSON.stringify({
+ context: 'remotion-dev/remotion',
+ mode: 'gfm',
+ text: release.body,
+ }),
+ headers: {
+ accept: 'text/html',
+ 'content-type': 'application/json',
+ 'user-agent': 'Remotion Studio',
+ 'x-github-api-version': githubApiVersion,
+ },
+ method: 'POST',
+ signal: controller.signal,
+ },
+ );
+
+ if (!markdownResponse.ok) {
+ return {
+ publishedAt: release.publishedAt,
+ releaseNotesHtml: null,
+ version: release.version,
+ };
+ }
+
+ const releaseNotesHtml = await markdownResponse.text();
+ return {
+ publishedAt: release.publishedAt,
+ releaseNotesHtml: releaseNotesHtml || null,
+ version: release.version,
+ };
+ } catch {
+ return {
+ publishedAt: release.publishedAt,
+ releaseNotesHtml: null,
+ version: release.version,
+ };
+ }
+ }),
+ );
+
+ return {hasMore, releases};
+ } catch {
+ return {hasMore: false, releases: []};
+ } finally {
+ clearTimeout(timeout);
+ }
+};
diff --git a/packages/studio-server/src/test/release-notes.test.ts b/packages/studio-server/src/test/release-notes.test.ts
new file mode 100644
index 0000000000..fc2fc2ce3e
--- /dev/null
+++ b/packages/studio-server/src/test/release-notes.test.ts
@@ -0,0 +1,174 @@
+import {expect, test} from 'bun:test';
+import type {IncomingMessage, ServerResponse} from 'node:http';
+import {getReleaseNotesHandler} from '../preview-server/routes/release-notes';
+
+const callHandler = (currentVersion: string, latestVersion: string) => {
+ return getReleaseNotesHandler({
+ binariesDirectory: null,
+ configFile: null,
+ entryPoint: '',
+ getDefaultCodingAgent: () => null,
+ getDefaultEditor: () => null,
+ input: {currentVersion, latestVersion},
+ logLevel: 'info',
+ methods: {
+ addJob: () => undefined,
+ cancelJob: () => undefined,
+ removeJob: () => undefined,
+ },
+ publicDir: '',
+ remotionRoot: '',
+ request: {} as IncomingMessage,
+ response: {} as ServerResponse,
+ });
+};
+
+test('renders every missed release with GitHub-flavored Markdown', async () => {
+ const originalFetch = globalThis.fetch;
+ const requests: {body: string | null; url: string}[] = [];
+
+ globalThis.fetch = Object.assign(
+ (input: Parameters<typeof fetch>[0], init?: RequestInit) => {
+ const body = typeof init?.body === 'string' ? init.body : null;
+ requests.push({body, url: input.toString()});
+
+ if (body === null) {
+ return Promise.resolve(
+ Response.json([
+ {body: '## Future', tag_name: 'v4.0.519'},
+ {
+ body: '## Latest',
+ published_at: '2026-08-27T12:00:00Z',
+ tag_name: 'v4.0.518',
+ },
+ {
+ body: '## Earlier',
+ published_at: '2026-08-20T12:00:00Z',
+ tag_name: 'v4.0.517',
+ },
+ {body: '## Installed', tag_name: 'v4.0.516'},
+ ]),
+ );
+ }
+
+ const {text} = JSON.parse(body) as {text: string};
+ return Promise.resolve(new Response(`<h2>${text.slice(3)}</h2>`));
+ },
+ {preconnect: originalFetch.preconnect},
+ );
+
+ try {
+ await expect(callHandler('4.0.516', '4.0.518')).resolves.toEqual({
+ hasMore: false,
+ releases: [
+ {
+ publishedAt: '2026-08-27T12:00:00Z',
+ releaseNotesHtml: '<h2>Latest</h2>',
+ version: '4.0.518',
+ },
+ {
+ publishedAt: '2026-08-20T12:00:00Z',
+ releaseNotesHtml: '<h2>Earlier</h2>',
+ version: '4.0.517',
+ },
+ ],
+ });
+ expect(requests).toEqual([
+ {
+ body: null,
+ url: 'https://api.github.com/repos/remotion-dev/remotion/releases?per_page=100',
+ },
+ {
+ body: JSON.stringify({
+ context: 'remotion-dev/remotion',
+ mode: 'gfm',
+ text: '## Latest',
+ }),
+ url: 'https://api.github.com/markdown',
+ },
+ {
+ body: JSON.stringify({
+ context: 'remotion-dev/remotion',
+ mode: 'gfm',
+ text: '## Earlier',
+ }),
+ url: 'https://api.github.com/markdown',
+ },
+ ]);
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+});
+
+test('limits release notes to the five most recent releases', async () => {
+ const originalFetch = globalThis.fetch;
+ globalThis.fetch = Object.assign(
+ (input: Parameters<typeof fetch>[0], init?: RequestInit) => {
+ if (typeof init?.body !== 'string') {
+ return Promise.resolve(
+ Response.json(
+ [513, 514, 515, 516, 517, 518].map((patch) => ({
+ body: `## ${patch}`,
+ tag_name: `v4.0.${patch}`,
+ })),
+ ),
+ );
+ }
+
+ return Promise.resolve(new Response(input.toString()));
+ },
+ {preconnect: originalFetch.preconnect},
+ );
+
+ try {
+ const response = await callHandler('4.0.512', '4.0.518');
+ expect(response.hasMore).toBe(true);
+ expect(response.releases.map(({version}) => version)).toEqual([
+ '4.0.518',
+ '4.0.517',
+ '4.0.516',
+ '4.0.515',
+ '4.0.514',
+ ]);
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+});
+
+test('gracefully falls back when releases cannot be loaded', async () => {
+ const originalFetch = globalThis.fetch;
+ globalThis.fetch = Object.assign(
+ () => Promise.resolve(new Response(null, {status: 404})),
+ {preconnect: originalFetch.preconnect},
+ );
+
+ try {
+ await expect(callHandler('4.0.516', '4.0.518')).resolves.toEqual({
+ hasMore: false,
+ releases: [],
+ });
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+});
+
+test('rejects invalid versions without calling GitHub', async () => {
+ const originalFetch = globalThis.fetch;
+ let didFetch = false;
+ globalThis.fetch = Object.assign(
+ () => {
+ didFetch = true;
+ return Promise.resolve(new Response());
+ },
+ {preconnect: originalFetch.preconnect},
+ );
+
+ try {
+ await expect(callHandler('../../latest', '4.0.518')).rejects.toThrow(
+ 'Invalid Remotion version range',
+ );
+ expect(didFetch).toBe(false);
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+});
diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.ts
index 06a85c9254..26a745eba2 100644
--- a/packages/studio-shared/src/api-requests.ts
+++ b/packages/studio-shared/src/api-requests.ts
@@ -1067,6 +1067,20 @@ export type UpdateAvailableResponse = {
packageManager: PackageManager | 'unknown';
};
+export type GetReleaseNotesRequest = {
+ currentVersion: string;
+ latestVersion: string;
+};
+
+export type GetReleaseNotesResponse = {
+ hasMore: boolean;
+ releases: {
+ publishedAt: string | null;
+ releaseNotesHtml: string | null;
+ version: string;
+ }[];
+};
+
export type GetRemotionSkillsInfoRequest = {};
export type GetRemotionSkillsInfoResponse = {
remotionUpgradeSkillAvailable: boolean;
@@ -1336,6 +1350,10 @@ export type ApiRoutes = {
UpdateAvailableRequest,
UpdateAvailableResponse
>;
+ '/api/release-notes': ReqAndRes<
+ GetReleaseNotesRequest,
+ GetReleaseNotesResponse
+ >;
'/api/remotion-skills-info': ReqAndRes<
GetRemotionSkillsInfoRequest,
GetRemotionSkillsInfoResponse
diff --git a/packages/studio-shared/src/index.ts b/packages/studio-shared/src/index.ts
index a58865a777..ebcb7a67e2 100644
--- a/packages/studio-shared/src/index.ts
+++ b/packages/studio-shared/src/index.ts
@@ -64,6 +64,8 @@ export {
GetDefaultEditorInfoResponse,
GetRemotionSkillsInfoRequest,
GetRemotionSkillsInfoResponse,
+ GetReleaseNotesRequest,
+ GetReleaseNotesResponse,
GoogleFontSourceEdit,
InsertElementFileConflict,
InsertElementRequest,
diff --git a/packages/studio/src/components/KnownBugs.tsx b/packages/studio/src/components/KnownBugs.tsx
index 27c0ec8775..480b8740e4 100644
--- a/packages/studio/src/components/KnownBugs.tsx
+++ b/packages/studio/src/components/KnownBugs.tsx
@@ -1,5 +1,5 @@
-import type {Bug} from './UpdateCheck';
import {OpenIssueButton} from './UpdateModal/OpenIssueButton';
+import type {Bug} from './UpdateStatusContext';
const container: React.CSSProperties = {
display: 'flex',
diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsx
index 631b377054..bbde745bc3 100644
--- a/packages/studio/src/components/Modals.tsx
+++ b/packages/studio/src/components/Modals.tsx
@@ -26,7 +26,6 @@ import {RenderModalWithLoader} from './RenderModal/ServerRenderModal';
import {WebRenderModalWithLoader} from './RenderModal/WebRenderModal';
import {SettingsModal} from './SettingsModal';
import {SvgImportDialog} from './SvgImportDialog';
-import {UpdateModal} from './UpdateModal/UpdateModal';
export const Modals: React.FC<{
readonly readOnlyStudio: boolean;
@@ -258,12 +257,6 @@ export const Modals: React.FC<{
<RenderStatusModal jobId={modalContextType.jobId} />
)}
- {modalContextType && modalContextType.type === 'update' && (
- <UpdateModal
- info={modalContextType.info}
- knownBugs={modalContextType.knownBugs}
- />
- )}
{modalContextType && modalContextType.type === 'fix-computed-value' && (
<FixComputedValueModal state={modalContextType} />
)}
diff --git a/packages/studio/src/components/RenderQueue/actions.ts b/packages/studio/src/components/RenderQueue/actions.ts
index f1c4a1ec25..205871edf8 100644
--- a/packages/studio/src/components/RenderQueue/actions.ts
+++ b/packages/studio/src/components/RenderQueue/actions.ts
@@ -386,6 +386,14 @@ export const updateAvailable = (signal: AbortSignal) => {
return callApi('/api/update-available', {}, signal);
};
+export const getReleaseNotes = (
+ currentVersion: string,
+ latestVersion: string,
+ signal: AbortSignal,
+) => {
+ return callApi('/api/release-notes', {currentVersion, latestVersion}, signal);
+};
+
export const getProjectInfo = (signal: AbortSignal) => {
return callApi('/api/project-info', {}, signal);
};
diff --git a/packages/studio/src/components/SettingsContext.tsx b/packages/studio/src/components/SettingsContext.tsx
index 3d859d90e2..5b667c3189 100644
--- a/packages/studio/src/components/SettingsContext.tsx
+++ b/packages/studio/src/components/SettingsContext.tsx
@@ -16,6 +16,7 @@ import React, {
import {getBrowserStudioOperations} from '../helpers/browser-studio-operations';
import {StudioServerConnectionCtx} from '../helpers/client-id';
import {callApi} from './call-api';
+import {UpdateStatusProvider} from './UpdateStatusContext';
type SettingsContextValue = {
readonly codingAgentInfo: GetDefaultCodingAgentInfoResponse | null;
@@ -152,7 +153,7 @@ export const SettingsProvider: React.FC<{
return (
<SettingsContext.Provider value={value}>
- {children}
+ <UpdateStatusProvider>{children}</UpdateStatusProvider>
</SettingsContext.Provider>
);
};
diff --git a/packages/studio/src/components/SettingsModal.tsx b/packages/studio/src/components/SettingsModal.tsx
index 21f514c56f..c957a8b477 100644
--- a/packages/studio/src/components/SettingsModal.tsx
+++ b/packages/studio/src/components/SettingsModal.tsx
@@ -4,6 +4,7 @@ import {
getBrowserStudioOperations,
} from '../helpers/browser-studio-operations';
import {AppsIcon} from '../icons/apps';
+import {CloudDownloadIcon} from '../icons/cloud-download';
import {KeyboardIcon} from '../icons/keyboard';
import {LicenseIcon} from '../icons/license';
import {PackageIcon} from '../icons/package';
@@ -33,6 +34,7 @@ import {SettingsModalFooter} from './SettingsModalFooter';
import {SkillsSettings} from './SkillsSettings';
import {StudioSettings} from './StudioSettings';
import {VerticalTab} from './Tabs/vertical';
+import {UpdatesSettings} from './UpdatesSettings';
type SettingsTab =
| 'apps'
@@ -41,7 +43,8 @@ type SettingsTab =
| 'packages'
| 'shortcuts'
| 'skills'
- | 'license';
+ | 'license'
+ | 'updates';
const hiddenPanel: React.CSSProperties = {
display: 'none',
@@ -215,6 +218,20 @@ export const SettingsModal: React.FC<{
License
</VerticalTab>
)}
+ {isBrowserStudio ? null : (
+ <VerticalTab
+ style={horizontalTab}
+ selected={tab === 'updates'}
+ onClick={() => selectTab('updates')}
+ renderIcon={(color) => (
+ <div style={iconContainer}>
+ <CloudDownloadIcon color={color} style={icon} />
+ </div>
+ )}
+ >
+ Updates
+ </VerticalTab>
+ )}
</div>
{openedTabs.includes('packages') ? (
<div style={tab === 'packages' ? optionsPanel : hiddenPanel}>
@@ -272,10 +289,18 @@ export const SettingsModal: React.FC<{
<StudioSettings />
</div>
) : null}
+ {openedTabs.includes('updates') ? (
+ <div
+ style={tab === 'updates' ? settingsOptionsPanel : hiddenPanel}
+ className={VERTICAL_SCROLLBAR_CLASSNAME}
+ >
+ <UpdatesSettings />
+ </div>
+ ) : null}
</div>
{tab === 'packages' ? (
<div ref={setPackagesFooterContainer} />
- ) : isBrowserStudio ? null : (
+ ) : isBrowserStudio || tab === 'updates' ? null : (
<SettingsModalFooter showLicenseFaq={tab === 'license'} />
)}
</>
diff --git a/packages/studio/src/components/UpdateCheck.tsx b/packages/studio/src/components/UpdateCheck.tsx
index 3b59c0224a..fceea40657 100644
--- a/packages/studio/src/components/UpdateCheck.tsx
+++ b/packages/studio/src/components/UpdateCheck.tsx
@@ -1,15 +1,4 @@
-import type {
- GetRemotionSkillsInfoResponse,
- UpdateAvailableResponse,
-} from '@remotion/studio-shared';
-import React, {
- useCallback,
- useContext,
- useEffect,
- useMemo,
- useState,
-} from 'react';
-import {VERSION} from 'remotion';
+import React, {useCallback, useContext, useMemo, useState} from 'react';
import {
TRANSPARENT,
WARNING_COLOR,
@@ -20,11 +9,7 @@ import {SetSelectedModalContext} from '../state/modals';
import {useZIndex} from '../state/z-index';
import type {RenderInlineAction} from './InlineAction';
import {InlineAction} from './InlineAction';
-import {updateAvailable} from './RenderQueue/actions';
-import {useSettings} from './SettingsContext';
-
-export type UpdateInfo = UpdateAvailableResponse &
- Pick<GetRemotionSkillsInfoResponse, 'remotionUpgradeSkillAvailable'>;
+import {useUpdateStatus} from './UpdateStatusContext';
const buttonStyle: React.CSSProperties = {
appearance: 'none',
@@ -44,88 +29,24 @@ const updateIconContainer: React.CSSProperties = {
flexShrink: 0,
};
-// Keep in sync with packages/bugs/api/[v].ts
-export type Bug = {
- title: string;
- description: string;
- link: string;
- versions: string[];
-};
-
export const UpdateCheck = () => {
- const [info, setInfo] = useState<UpdateAvailableResponse | null>(null);
const {setSelectedModal} = useContext(SetSelectedModalContext);
- const {remotionSkillsInfo} = useSettings();
const {tabIndex} = useZIndex();
- const [knownBugs, setKnownBugs] = useState<Bug[] | null>(null);
+ const {info, knownBugs} = useUpdateStatus();
const [hovered, setHovered] = useState(false);
const hasBugfixesAvailable = useMemo(() => {
return Boolean(info?.updateAvailable && knownBugs && knownBugs.length > 0);
}, [info?.updateAvailable, knownBugs]);
- const checkForUpdates = useCallback(() => {
- const controller = new AbortController();
-
- updateAvailable(controller.signal)
- .then((d) => {
- setInfo(d);
- })
- .catch((err: Error) => {
- if (err.message.includes('aborted')) {
- return;
- }
-
- // eslint-disable-next-line no-console
- console.log('Could not check for updates', err);
- });
-
- return controller;
- }, []);
-
- const checkForBugs = useCallback(() => {
- const controller = new AbortController();
-
- fetch(`https://bugs.remotion.dev/api/${VERSION}`, {
- signal: controller.signal,
- })
- .then(async (res) => {
- const body = await res.json();
- setKnownBugs(body.bugs);
- })
- .catch((err: Error) => {
- if (err.message.includes('aborted')) {
- return;
- }
-
- // eslint-disable-next-line no-console
- console.log('Could not check for bugs in this version', err);
- });
-
- return controller;
- }, []);
-
- useEffect(() => {
- const abortUpdate = checkForUpdates();
- const abortBugs = checkForBugs();
-
- return () => {
- abortUpdate.abort();
- abortBugs.abort();
- };
- }, [checkForBugs, checkForUpdates]);
-
const openModal = useCallback(() => {
setSelectedModal({
- type: 'update',
- info: {
- ...(info as UpdateAvailableResponse),
- remotionUpgradeSkillAvailable:
- remotionSkillsInfo?.remotionUpgradeSkillAvailable ?? false,
- },
- knownBugs: knownBugs as Bug[],
+ type: 'settings',
+ initialTab: 'updates',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
});
- }, [info, knownBugs, remotionSkillsInfo, setSelectedModal]);
+ }, [setSelectedModal]);
const dynButtonStyle: React.CSSProperties = useMemo(() => {
return {
diff --git a/packages/studio/src/components/UpdateModal/UpdateModal.tsx b/packages/studio/src/components/UpdateModal/UpdateModal.tsx
deleted file mode 100644
index 1c6cb53916..0000000000
--- a/packages/studio/src/components/UpdateModal/UpdateModal.tsx
+++ /dev/null
@@ -1,176 +0,0 @@
-import React, {useCallback, useMemo} from 'react';
-import {
- BLUE,
- LIGHT_TEXT,
- SELECTED_BACKGROUND,
- WHITE,
-} from '../../helpers/colors';
-import {copyText} from '../../helpers/copy-text';
-import {ClipboardIcon} from '../../icons/clipboard';
-import type {RenderInlineAction} from '../InlineAction';
-import {InlineAction} from '../InlineAction';
-import {KnownBugs} from '../KnownBugs';
-import {ModalHeader} from '../ModalHeader';
-import {DismissableModal} from '../NewComposition/DismissableModal';
-import {showNotification} from '../Notifications/NotificationCenter';
-import type {Bug, UpdateInfo} from '../UpdateCheck';
-
-const container: React.CSSProperties = {
- padding: '0 16px 8px',
-};
-
-const panelStyle: React.CSSProperties = {
- borderRadius: 6,
- overflow: 'hidden',
-};
-
-const text: React.CSSProperties = {
- color: LIGHT_TEXT,
- fontFamily: 'sans-serif',
- fontSize: 14,
- lineHeight: 1.5,
-};
-
-const title: React.CSSProperties = {
- paddingTop: 12,
- paddingBottom: 8,
- ...text,
-};
-
-const commandField: React.CSSProperties = {
- alignItems: 'center',
- background: SELECTED_BACKGROUND,
- borderRadius: 6,
- boxSizing: 'border-box',
- display: 'flex',
- marginBottom: 10,
- marginTop: 10,
- padding: '8px 8px 8px 10px',
- width: '100%',
-};
-
-const code: React.CSSProperties = {
- color: WHITE,
- flex: 1,
- fontFamily: 'monospace',
- fontSize: 14,
- lineHeight: 1.5,
- margin: 0,
- minWidth: 0,
- overflowX: 'auto',
- whiteSpace: 'pre',
-};
-
-const copyIcon: React.CSSProperties = {
- flexShrink: 0,
- height: 12,
- width: 12,
-};
-
-const link: React.CSSProperties = {
- ...text,
- fontWeight: 'bold',
- color: BLUE,
- textDecoration: 'none',
-};
-
-const commands: {[key in UpdateInfo['packageManager']]: string} = {
- npm: 'npx remotion upgrade',
- yarn: 'yarn remotion upgrade',
- pnpm: 'pnpm exec remotion upgrade',
- bun: 'bun remotion upgrade',
- unknown: 'npx remotion upgrade',
-};
-
-const skillsUpdateCommand = 'npx remotion skills update';
-const remotionUpgradeSkill = '/remotion-upgrade';
-
-export const UpdateModal: React.FC<{
- readonly info: UpdateInfo;
- readonly knownBugs: Bug[];
-}> = ({info, knownBugs}) => {
- const hasKnownBugs = useMemo(() => {
- return knownBugs && knownBugs?.length > 0;
- }, [knownBugs]);
-
- const updateAction = info.remotionUpgradeSkillAvailable
- ? remotionUpgradeSkill
- : info.updateAvailable
- ? commands[info.packageManager]
- : skillsUpdateCommand;
- const updateActionType = info.remotionUpgradeSkillAvailable
- ? 'skill'
- : 'command';
-
- const onClick = useCallback(() => {
- copyText(updateAction).catch((err) => {
- showNotification(`Could not copy: ${err.message}`, 2000);
- });
- }, [updateAction]);
-
- const renderCopyAction: RenderInlineAction = useCallback((color) => {
- return <ClipboardIcon color={color} style={copyIcon} />;
- }, []);
-
- return (
- <DismissableModal panelStyle={panelStyle}>
- <ModalHeader title="Update available" />
- <div style={container}>
- {hasKnownBugs && info.updateAvailable ? (
- <>
- <div style={title}>
- The currently installed version {info.currentVersion} has the
- following known bugs:
- </div>
- <KnownBugs bugs={knownBugs as Bug[]} />
- <div style={{height: '20px'}} />
- <div style={text}>
- To upgrade, run the following {updateActionType}:
- </div>
- </>
- ) : info.updateAvailable ? (
- <div style={title}>
- A new update for Remotion is available! Run the following{' '}
- {updateActionType}:
- </div>
- ) : (
- <div style={title}>
- Your Remotion Agent Skills are out of date. Run the following{' '}
- {updateActionType}:
- </div>
- )}
- <div style={commandField}>
- <pre style={code}>{updateAction}</pre>
- <InlineAction
- variant={null}
- onClick={onClick}
- renderAction={renderCopyAction}
- title="Copy command"
- />
- </div>
- {info.updateAvailable ? (
- <div style={text}>
- This will upgrade Remotion from {info.currentVersion} to{' '}
- {info.latestVersion}
- {info.skillsUpdateAvailable
- ? ' and update your project Remotion Agent Skills.'
- : '.'}
- </div>
- ) : null}
- {info.updateAvailable ? (
- <div style={text}>
- Read the{' '}
- <a
- style={link}
- target="_blank"
- href="https://github.com/remotion-dev/remotion/releases"
- >
- Release notes
- </a>{' '}
- to know what{"'s"} new in Remotion.
- </div>
- ) : null}
- </div>
- </DismissableModal>
- );
-};
diff --git a/packages/studio/src/components/UpdateStatusContext.tsx b/packages/studio/src/components/UpdateStatusContext.tsx
new file mode 100644
index 0000000000..589a02400c
--- /dev/null
+++ b/packages/studio/src/components/UpdateStatusContext.tsx
@@ -0,0 +1,99 @@
+import type {UpdateAvailableResponse} from '@remotion/studio-shared';
+import React, {
+ createContext,
+ useContext,
+ useEffect,
+ useMemo,
+ useState,
+} from 'react';
+import {VERSION} from 'remotion';
+import {getBrowserStudioOperations} from '../helpers/browser-studio-operations';
+import {updateAvailable} from './RenderQueue/actions';
+
+// Keep in sync with packages/bugs/api/[v].ts
+export type Bug = {
+ title: string;
+ description: string;
+ link: string;
+ versions: string[];
+};
+
+type UpdateStatusContextValue = {
+ readonly error: string | null;
+ readonly info: UpdateAvailableResponse | null;
+ readonly knownBugs: Bug[] | null;
+};
+
+const UpdateStatusContext = createContext<UpdateStatusContextValue | null>(
+ null,
+);
+
+export const UpdateStatusProvider: React.FC<{
+ readonly children: React.ReactNode;
+}> = ({children}) => {
+ const [info, setInfo] = useState<UpdateAvailableResponse | null>(null);
+ const [knownBugs, setKnownBugs] = useState<Bug[] | null>(null);
+ const [error, setError] = useState<string | null>(null);
+
+ useEffect(() => {
+ if (getBrowserStudioOperations() !== null) {
+ return;
+ }
+
+ const updateController = new AbortController();
+ const bugsController = new AbortController();
+
+ updateAvailable(updateController.signal)
+ .then((response) => {
+ setInfo(response);
+ setError(null);
+ })
+ .catch((err: Error) => {
+ if (updateController.signal.aborted) {
+ return;
+ }
+
+ setError(err.message);
+ });
+
+ fetch('https://bugs.remotion.dev/api/' + VERSION, {
+ signal: bugsController.signal,
+ })
+ .then(async (response) => {
+ const body = await response.json();
+ setKnownBugs(body.bugs);
+ })
+ .catch((err: Error) => {
+ if (bugsController.signal.aborted) {
+ return;
+ }
+
+ // eslint-disable-next-line no-console
+ console.log('Could not check for bugs in this version', err);
+ });
+
+ return () => {
+ updateController.abort();
+ bugsController.abort();
+ };
+ }, []);
+
+ const value = useMemo<UpdateStatusContextValue>(() => {
+ return {error, info, knownBugs};
+ }, [error, info, knownBugs]);
+
+ return (
+ <UpdateStatusContext.Provider value={value}>
+ {children}
+ </UpdateStatusContext.Provider>
+ );
+};
+
+export const useUpdateStatus = (): UpdateStatusContextValue => {
+ const context = useContext(UpdateStatusContext);
+ if (context === null) {
+ throw new Error('useUpdateStatus must be used inside UpdateStatusProvider');
+ }
+
+ return context;
+};
diff --git a/packages/studio/src/components/UpdatesSettings.tsx b/packages/studio/src/components/UpdatesSettings.tsx
new file mode 100644
index 0000000000..a9d73ebda4
--- /dev/null
+++ b/packages/studio/src/components/UpdatesSettings.tsx
@@ -0,0 +1,417 @@
+import type {
+ GetReleaseNotesResponse,
+ UpdateAvailableResponse,
+} from '@remotion/studio-shared';
+import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
+import {
+ BACKGROUND,
+ BORDER_WHITE_ALPHA_12,
+ BLUE,
+ LIGHT_TEXT,
+ SELECTED_BACKGROUND,
+ WHITE,
+} from '../helpers/colors';
+import {copyText} from '../helpers/copy-text';
+import {ClipboardIcon} from '../icons/clipboard';
+import type {RenderInlineAction} from './InlineAction';
+import {InlineAction} from './InlineAction';
+import {KnownBugs} from './KnownBugs';
+import {ValidationMessage} from './NewComposition/ValidationMessage';
+import {showNotification} from './Notifications/NotificationCenter';
+import {getReleaseNotes} from './RenderQueue/actions';
+import {useSettings} from './SettingsContext';
+import {useUpdateStatus} from './UpdateStatusContext';
+
+const container: React.CSSProperties = {
+ alignSelf: 'flex-start',
+ boxSizing: 'border-box',
+ flex: 1,
+ minWidth: 0,
+ padding: '4px 16px 0',
+};
+
+const text: React.CSSProperties = {
+ color: LIGHT_TEXT,
+ fontFamily: 'sans-serif',
+ fontSize: 14,
+ lineHeight: 1.5,
+};
+
+const title: React.CSSProperties = {
+ paddingTop: 12,
+ paddingBottom: 8,
+ ...text,
+};
+
+const titleBeforeCommand: React.CSSProperties = {
+ ...title,
+ paddingBottom: 0,
+};
+
+const commandField: React.CSSProperties = {
+ alignItems: 'center',
+ background: SELECTED_BACKGROUND,
+ borderRadius: 6,
+ boxSizing: 'border-box',
+ display: 'flex',
+ marginBottom: 10,
+ marginTop: 10,
+ padding: '8px 8px 8px 10px',
+ width: '100%',
+};
+
+const code: React.CSSProperties = {
+ color: WHITE,
+ flex: 1,
+ fontFamily: 'monospace',
+ fontSize: 14,
+ lineHeight: 1.5,
+ margin: 0,
+ minWidth: 0,
+ overflowX: 'auto',
+ whiteSpace: 'pre',
+};
+
+const copyIcon: React.CSSProperties = {
+ flexShrink: 0,
+ height: 12,
+ width: 12,
+};
+
+const link: React.CSSProperties = {
+ ...text,
+ fontWeight: 'bold',
+ color: BLUE,
+ textDecoration: 'none',
+};
+
+const releaseNotesFrame: React.CSSProperties = {
+ backgroundColor: BACKGROUND,
+ border: 0,
+ display: 'block',
+ marginTop: 8,
+ overflow: 'hidden',
+ width: '100%',
+};
+
+const releaseNotesTitle: React.CSSProperties = {
+ ...title,
+ borderBottom: BORDER_WHITE_ALPHA_12,
+ width: '100%',
+};
+
+const commands: {
+ [key in UpdateAvailableResponse['packageManager']]: string;
+} = {
+ npm: 'npx remotion upgrade',
+ yarn: 'yarn remotion upgrade',
+ pnpm: 'pnpm exec remotion upgrade',
+ bun: 'bun remotion upgrade',
+ unknown: 'npx remotion upgrade',
+};
+
+const skillsUpdateCommand = 'npx remotion skills update';
+const remotionUpgradeSkill = '/remotion-upgrade';
+
+const formatReleaseDate = (publishedAt: string | null) => {
+ if (publishedAt === null) {
+ return null;
+ }
+
+ const date = new Date(publishedAt);
+ if (Number.isNaN(date.getTime())) {
+ return null;
+ }
+
+ const day = date.getDate();
+ const lastTwoDigits = day % 100;
+ const suffix =
+ lastTwoDigits >= 11 && lastTwoDigits <= 13
+ ? 'th'
+ : day % 10 === 1
+ ? 'st'
+ : day % 10 === 2
+ ? 'nd'
+ : day % 10 === 3
+ ? 'rd'
+ : 'th';
+ const month = new Intl.DateTimeFormat('en-US', {
+ month: 'long',
+ }).format(date);
+
+ return `${month} ${day}${suffix}, ${date.getFullYear()}`;
+};
+
+const RenderedReleaseNotes: React.FC<{
+ readonly release: GetReleaseNotesResponse['releases'][number];
+}> = ({release}) => {
+ const [height, setHeight] = useState(220);
+ const frameRef = useRef<HTMLIFrameElement>(null);
+ const resizeObserver = useRef<ResizeObserver | null>(null);
+ const formattedReleaseDate = formatReleaseDate(release.publishedAt);
+ const document = useMemo(() => {
+ if (release.releaseNotesHtml === null) {
+ return null;
+ }
+
+ return `<!doctype html><html><head><base href="https://github.com/remotion-dev/remotion/" target="_blank"><style>
+ :root { color-scheme: dark; }
+ html, body { overflow: hidden; }
+ body { background: ${BACKGROUND}; color: ${LIGHT_TEXT}; font-family: sans-serif; font-size: 13px; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
+ h1, h2, h3, h4, h5, h6 { color: ${WHITE}; line-height: 1.25; margin: 16px 0 8px; }
+ h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }
+ h1 { font-size: 18px; } h2 { font-size: 16px; } h3, h4, h5, h6 { font-size: 14px; }
+ p, ul, ol, pre, blockquote { margin: 8px 0; }
+ ul, ol { padding-left: 22px; }
+ a { color: ${BLUE}; text-decoration: none; }
+ code { background: transparent; color: ${LIGHT_TEXT}; font-family: monospace; padding: 0; }
+ pre { background: ${SELECTED_BACKGROUND}; border-radius: 6px; overflow-x: auto; padding: 10px; }
+ pre code { background: transparent; padding: 0; }
+ img { max-width: 100%; }
+ blockquote { border-left: 3px solid ${SELECTED_BACKGROUND}; margin-left: 0; padding-left: 10px; }
+ hr { border: 0; border-top: 1px solid ${SELECTED_BACKGROUND}; }
+ </style></head><body>${release.releaseNotesHtml}</body></html>`;
+ }, [release.releaseNotesHtml]);
+
+ useEffect(() => {
+ return () => resizeObserver.current?.disconnect();
+ }, []);
+
+ const onLoad = useCallback(() => {
+ resizeObserver.current?.disconnect();
+ const iframeDocument = frameRef.current?.contentDocument;
+ if (!iframeDocument?.body) {
+ return;
+ }
+
+ const updateHeight = () => {
+ setHeight(iframeDocument.documentElement.scrollHeight + 2);
+ };
+
+ updateHeight();
+ const observer = new ResizeObserver(updateHeight);
+ observer.observe(iframeDocument.body);
+ resizeObserver.current = observer;
+ }, []);
+
+ return (
+ <>
+ <div style={releaseNotesTitle}>
+ {release.version}
+ {formattedReleaseDate === null
+ ? null
+ : ` \u2013\u00a0${formattedReleaseDate}`}
+ </div>
+ {document === null ? (
+ <div style={text}>
+ Release notes could not be loaded.{' '}
+ <a
+ style={link}
+ target="_blank"
+ href={`https://github.com/remotion-dev/remotion/releases/tag/v${release.version}`}
+ >
+ View them on GitHub
+ </a>
+ .
+ </div>
+ ) : (
+ <iframe
+ ref={frameRef}
+ onLoad={onLoad}
+ sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin"
+ scrolling="no"
+ srcDoc={document}
+ style={{...releaseNotesFrame, height}}
+ title={`Release notes for Remotion ${release.version}`}
+ />
+ )}
+ </>
+ );
+};
+
+export const UpdatesSettings: React.FC = () => {
+ const {remotionSkillsInfo} = useSettings();
+ const {error, info, knownBugs} = useUpdateStatus();
+ const [releaseNotes, setReleaseNotes] = useState<
+ | (GetReleaseNotesResponse & {
+ currentVersion: string;
+ latestVersion: string;
+ })
+ | null
+ >(null);
+
+ useEffect(() => {
+ if (!info?.updateAvailable) {
+ return;
+ }
+
+ const controller = new AbortController();
+ getReleaseNotes(info.currentVersion, info.latestVersion, controller.signal)
+ .then((response) => {
+ setReleaseNotes({
+ ...response,
+ currentVersion: info.currentVersion,
+ latestVersion: info.latestVersion,
+ });
+ })
+ .catch(() => {
+ if (!controller.signal.aborted) {
+ setReleaseNotes({
+ currentVersion: info.currentVersion,
+ hasMore: false,
+ latestVersion: info.latestVersion,
+ releases: [],
+ });
+ }
+ });
+
+ return () => controller.abort();
+ }, [info]);
+
+ const hasKnownBugs = useMemo(() => {
+ return (knownBugs?.length ?? 0) > 0;
+ }, [knownBugs]);
+
+ const updateAction = info
+ ? remotionSkillsInfo?.remotionUpgradeSkillAvailable
+ ? remotionUpgradeSkill
+ : info.updateAvailable
+ ? commands[info.packageManager]
+ : skillsUpdateCommand
+ : null;
+ const updateActionType = remotionSkillsInfo?.remotionUpgradeSkillAvailable
+ ? 'skill'
+ : 'command';
+
+ const onClick = useCallback(() => {
+ if (updateAction === null) {
+ return;
+ }
+
+ copyText(updateAction).catch((err) => {
+ showNotification('Could not copy: ' + err.message, 2000);
+ });
+ }, [updateAction]);
+
+ const renderCopyAction: RenderInlineAction = useCallback((color) => {
+ return <ClipboardIcon color={color} style={copyIcon} />;
+ }, []);
+
+ if (info === null) {
+ return (
+ <div style={container}>
+ {error ? (
+ <div style={{paddingTop: 12}}>
+ <ValidationMessage
+ message={'Could not check for updates: ' + error}
+ align="flex-start"
+ type="error"
+ />
+ </div>
+ ) : (
+ <div style={title}>Checking for updates...</div>
+ )}
+ </div>
+ );
+ }
+
+ if (!info.updateAvailable && !info.skillsUpdateAvailable) {
+ return (
+ <div style={container}>
+ <div style={title}>You{"'re"} up to date.</div>
+ <div style={text}>
+ Remotion {info.currentVersion} and your Remotion Agent Skills are up
+ to date.
+ </div>
+ </div>
+ );
+ }
+
+ return (
+ <div style={container}>
+ {hasKnownBugs && info.updateAvailable ? (
+ <>
+ <div style={title}>
+ The currently installed version {info.currentVersion} has the
+ following known bugs:
+ </div>
+ <KnownBugs bugs={knownBugs ?? []} />
+ <div style={{height: '20px'}} />
+ <div style={text}>
+ To update, run the following {updateActionType}:
+ </div>
+ </>
+ ) : info.updateAvailable ? (
+ <div style={titleBeforeCommand}>
+ A new Remotion update is available. Run the following{' '}
+ {updateActionType}:
+ </div>
+ ) : (
+ <div style={titleBeforeCommand}>
+ Your Remotion Agent Skills are out of date. Run the following{' '}
+ {updateActionType}:
+ </div>
+ )}
+ <div style={commandField}>
+ <pre style={code}>{updateAction}</pre>
+ <InlineAction
+ variant={null}
+ onClick={onClick}
+ renderAction={renderCopyAction}
+ title="Copy command"
+ />
+ </div>
+ {info.updateAvailable ? (
+ <div style={text}>
+ This will update Remotion from {info.currentVersion} to{' '}
+ {info.latestVersion}
+ {info.skillsUpdateAvailable
+ ? ' and update your project Remotion Agent Skills.'
+ : '.'}
+ </div>
+ ) : null}
+ {info.updateAvailable ? (
+ releaseNotes?.currentVersion === info.currentVersion &&
+ releaseNotes.latestVersion === info.latestVersion ? (
+ releaseNotes.releases.length === 0 ? (
+ <>
+ <div style={releaseNotesTitle}>{info.latestVersion}</div>
+ <div style={text}>
+ Release notes could not be loaded.{' '}
+ <a
+ style={link}
+ target="_blank"
+ href="https://github.com/remotion-dev/remotion/releases"
+ >
+ View them on GitHub
+ </a>
+ .
+ </div>
+ </>
+ ) : (
+ <>
+ {releaseNotes.releases.map((release) => (
+ <RenderedReleaseNotes key={release.version} release={release} />
+ ))}
+ {releaseNotes.hasMore ? (
+ <div style={{...text, paddingTop: 12}}>
+ Showing the 5 most recent releases.{' '}
+ <a
+ style={link}
+ target="_blank"
+ href="https://github.com/remotion-dev/remotion/releases"
+ >
+ View all releases on GitHub
+ </a>
+ .
+ </div>
+ ) : null}
+ </>
+ )
+ ) : (
+ <div style={text}>Loading release notes...</div>
+ )
+ ) : null}
+ </div>
+ );
+};
diff --git a/packages/studio/src/state/modals.ts b/packages/studio/src/state/modals.ts
index 4f02372998..0204642e57 100644
--- a/packages/studio/src/state/modals.ts
+++ b/packages/studio/src/state/modals.ts
@@ -28,7 +28,6 @@ import type {StaticFile} from '../api/get-static-files';
import type {CompType} from '../components/NewComposition/DuplicateComposition';
import type {QuickSwitcherMode} from '../components/QuickSwitcher/NoResults';
import type {RenderType} from '../components/RenderModal/RenderModalAdvanced';
-import type {Bug, UpdateInfo} from '../components/UpdateCheck';
export type WebRenderModalState = {
type: 'web-render';
@@ -197,6 +196,8 @@ export type ModalState =
| 'studio'
| 'packages'
| 'shortcuts'
+ | 'skills'
+ | 'updates'
| 'license';
initialPublicLicenseKey: string | null;
}
@@ -206,11 +207,6 @@ export type ModalState =
type: 'render-progress';
jobId: string;
}
- | {
- type: 'update';
- info: UpdateInfo;
- knownBugs: Bug[];
- }
| {
type: 'fix-computed-value';
prop: string;