For Typescript and Javascript extensions to work with Seanime, they need to run in an interpreter. This interpreter is an implementation of ECMAScript 6 and does not support Node.JS APIs, Web APIs, or modules.

However, Seanime’s version of the interpreter implements some helper APIs you might be used to, using Go under the hood.


Console

These console methods allow your extension to print message to the main terminal output of Seanime so use them sparsely.

console.log(...data: any[])
console.debug(...data: any[])
console.error(...data: any[])
console.warn(...data: any[])
console.info(...data: any[])

CleanShot 2024-08-25 at 15.26.44@2x.png

Console output from Playground

Console output from Playground


Fetch

On Seanime, fetch is implemented a little differently.

fetch(url: string, options?: Options): Promise<Response>

interface Options {
	body?: string | URLSearchParams
	method?: "GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "PATCH" | "OPTIONS"
	headers?: Record<string, any>
}

interface Response {
	status: number
	statusText: string
	ok: boolean
	json(): any
	text(): string
}

Bonus: A CloudFlare bypass is implemented under the hood. You can test in the Playground.

CleanShot 2024-08-25 at 15.28.11@2x.png