Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

1.6 KB
Raw Blame
import { request } from './apiCore.js';

// Video downloader (#1946) — Dev Tools utility that downloads a full video from
// a YouTube or x.com/Twitter URL via yt-dlp. Kickoff returns `{ jobId }`;
// progress streams over SSE (subscribe with useSseProgress). `options` lets a
// caller suppress request()'s auto-toast with `{ silent: true }`.
export const startVideoDownload = (url, options = {}) => request('/devtools/video-download', {
  method: 'POST',
  body: JSON.stringify({ url }),
  ...options,
});

export const videoDownloadEventsUrl = (jobId) =>
  `/api/devtools/video-download/${encodeURIComponent(jobId)}/events`;

export const cancelVideoDownload = (jobId, options = {}) =>
  request(`/devtools/video-download/${encodeURIComponent(jobId)}/cancel`, {
    method: 'POST',
    ...options,
  });

// The `source: 'download'` slice of video-history, newest first.
export const listVideoDownloads = (options = {}) => request('/devtools/video-download/downloads', options);

export const deleteVideoDownload = (id, options = {}) =>
  request(`/devtools/video-download/downloads/${encodeURIComponent(id)}`, {
    method: 'DELETE',
    ...options,
  });

// yt-dlp's own version and whether PortOS can update it in place. A stale
// yt-dlp is the usual cause of a failed YouTube download, so the page surfaces
// the state and the one-click remedy next to the URL field.
export const getYtDlpStatus = (options = {}) => request('/devtools/video-download/yt-dlp', options);

export const updateYtDlp = (options = {}) =>
  request('/devtools/video-download/yt-dlp/update', { method: 'POST', ...options });