Fix StartOS 0.4 TypeScript packaging to match SDK API
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { sdk } from '../sdk'
|
||||
import { updateYtdlp } from './updateYtdlp'
|
||||
|
||||
export const actions = sdk.Actions.of().addAction(updateYtdlp)
|
||||
// Actions will be added once the base build is verified.
|
||||
export const actions = sdk.Actions.of()
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
import { i18n } from '../i18n'
|
||||
import { sdk } from '../sdk'
|
||||
|
||||
export const updateYtdlp = sdk.Action.withoutInput(
|
||||
'update-ytdlp',
|
||||
async ({ effects }) => ({
|
||||
name: i18n('Update yt-dlp'),
|
||||
description: i18n(
|
||||
'Downloads the latest version of yt-dlp. Run this if YouTube downloads are failing — YouTube frequently changes its systems, requiring yt-dlp updates.',
|
||||
),
|
||||
warning: i18n('This may take a minute. The service will continue running.'),
|
||||
allowedStatuses: 'any',
|
||||
group: null,
|
||||
visibility: 'enabled' as const,
|
||||
}),
|
||||
async ({ effects }) => {
|
||||
// Run pip upgrade inside the running subcontainer
|
||||
const sub = await sdk.SubContainer.of(
|
||||
effects,
|
||||
{ imageId: 'main' },
|
||||
sdk.Mounts.of().mountVolume({
|
||||
volumeId: 'main',
|
||||
subpath: null,
|
||||
mountpoint: '/data',
|
||||
readonly: false,
|
||||
}),
|
||||
'ytdlp-update-sub',
|
||||
)
|
||||
|
||||
const result = await sub.exec(['sh', '-c',
|
||||
'pip3 install --break-system-packages -U yt-dlp curl_cffi 2>&1; echo "---"; echo "yt-dlp version: $(yt-dlp --version)"',
|
||||
])
|
||||
|
||||
const output = result.stdout || 'Update completed'
|
||||
|
||||
return {
|
||||
version: '1' as const,
|
||||
title: 'yt-dlp Update',
|
||||
message: output,
|
||||
result: {
|
||||
type: 'single' as const,
|
||||
name: 'Output',
|
||||
value: output,
|
||||
masked: false,
|
||||
copyable: true,
|
||||
qr: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user