Owncast Plugin APIs
Il runtime del plugin di Owncast espone un singolo globale, owncast, con le funzioni host che il tuo plugin può chiamare. Most methods require the matching permission in your manifest. A call without it never reaches Owncast: the host logs the denial and the call does nothing. What your plugin sees depends on the method. Mutating calls that report an outcome raise an error (moderation, users.register, auth.grantSession, kv.set, videoConfig.write, actions.add, actions.clear, and every sql method), readers return an empty or zero value, and calls that return nothing become silent no-ops. fs.write, fs.delete, and storage.upload are the exceptions: they report failure in their return value rather than raising. A few methods are ambient and need no permission: logging, timers, reading bundled assets, and owncast.config.get.
Plugins require Owncast 0.3.0 or later.
Le chiamate sono mostrate per entrambi gli SDK, scegli il tuo linguaggio con le schede. Vedi JavaScript o Python per la configurazione. (I nomi dei metodi JavaScript sono camelCase, Python usa snake_case, quindi sendAction diventa send_action, e così via.)
Logging
owncast.log.info(message), .warning(message), and .error(message)
Write an operator-visible entry to Owncast's server log. Owncast records the calling plugin's slug and the matching info, warning, or error severity. It replaces control characters with spaces so each entry stays on one line, then truncates messages longer than 4 KiB.
- JavaScript
- Python
owncast.log.info('sync started');
owncast.log.warning('provider response is incomplete');
owncast.log.error('sync failed');
owncast.log.info("sync started")
owncast.log.warning("provider response is incomplete")
owncast.log.error("sync failed")
Ambient: nessun permesso richiesto. See the paired chat-logger examples for JavaScript and Python.
Chat
Stai costruendo un chatbot, uno strumento di moderazione o un filtro? Inizia con Chat plugins.
owncast.chat.send(text)
Invia un messaggio di chat. Inviato come identità bot del tuo plugin (nome visualizzato da bot.displayName o name nel tuo manifest).
- JavaScript
- Python
owncast.chat.send('hello chat');
owncast.chat.send("hello chat")
Richiede chat.send.
owncast.chat.sendAction(text)
Invia un messaggio in stile azione ("/me").
- JavaScript
- Python
owncast.chat.sendAction('is now live');
owncast.chat.send_action("is now live")
Richiede chat.send.
owncast.chat.system(body)
Invia un messaggio di annuncio del server. Nessuna identità bot associata. Il corpo viene reso inline come HTML, quindi usa questo per avvisi brevi attribuiti al server come "lo stream inizia tra 5 minuti". Tratta il corpo come output HTML non attendibile: non interpolare l'input dell'utente senza effettuare l'escape.
Requires chat.send.
owncast.chat.sendTo(clientId, text)
Invia un messaggio privato a un singolo client connesso.
Requires chat.send.
owncast.chat.replyTo(msg, text)
Sussurra una risposta a chiunque abbia inviato un messaggio di chat. Passa il messaggio di chat da onChatMessage/filterChatMessage (o un ID client nudo). Restituisce false se la connessione del mittente è sconosciuta (nessun ID client), quindi puoi tornare a un send pubblico. Sugar sopra sendTo(clientId, text).
- JavaScript
- Python
onChatMessage(msg) {
if (!owncast.chat.replyTo(msg, "got it")) {
owncast.chat.send("got it");
}
}
@plugin.on_chat_message
def handle(msg):
if not owncast.chat.reply_to(msg, "got it"):
owncast.chat.send("got it")
Richiede chat.send.
owncast.chat.history(limit?)
Restituisci i messaggi di chat più recenti, ognuno con id, user, body e timestamp. limit predefinito è 50.
Richiede chat.history.
owncast.chat.clients()
Return the list of currently-connected chat clients, each with id, userId?, displayName?, connectedAt?, userAgent?, ipAddress?, and messageCount. id è l'ID client per connessione usato da chat.kick.
Richiede chat.history.
owncast.chat.deleteMessage(messageId)
Nascondi un messaggio di chat dai visualizzatori.
Requires chat.moderate.
owncast.chat.kick(clientId)
Disconnetti un client di chat.
Requires chat.moderate.
Identità chat
Ogni plugin ha esattamente un'identità chat, il bot creato da Owncast quando il tuo plugin è installato. Il nome visualizzato è bot.displayName nel tuo manifest se impostato, altrimenti è name, con IsBot: true. Sia send che sendAction postano con questa identità, attraverso il pipeline di chat normale di Owncast (filtri, limiti di velocità, moderazione). I plugin non possono postare sotto nomi arbitrari o impersonare utenti reali.
L'utente bot è basato sul slug del plugin quindi l'identità sopravvive alle modifiche del manifest a name o bot.displayName. Se hai bisogno di più persone di chat, distribuisci più plugin.
Utenti
owncast.users.list() e owncast.users.get(id)
Leggi l'elenco degli utenti della chat o un singolo record utente.
- JavaScript
- Python
const users = owncast.users.list();
const alice = owncast.users.get('u-alice');
users = owncast.users.list()
alice = owncast.users.get("u-alice")
Richiede users.read.
owncast.users.setEnabled(id, enabled, reason?)
Abilita o disabilita un utente della chat.
- JavaScript
- Python
owncast.users.setEnabled('u-spammer', false, 'spam');
owncast.users.set_enabled("u-spammer", False, "spam")
Richiede users.moderate.
owncast.users.banIP(ip)
Banna un IP dall'unirsi alla chat.
- JavaScript
- Python
owncast.users.banIP('203.0.113.42');
owncast.users.ban_ip("203.0.113.42")
Richiede users.moderate.
owncast.users.register({ authId, displayName?, scopes?, profileUrl?, handle?, public? })
Find or create an authenticated Owncast user for an external identity and return { userId }. Pass the provider's stable authId without adding your plugin slug. The host stores the slug separately as the identity provider, so plugins cannot collide with or spoof each other's users. displayName seeds a new user's name and is optional: omit it, or pass null, and Owncast generates a display name the same way it does for anonymous viewers. Non-empty scopes such as ["MODERATOR"] are applied on each call.
The optional profileUrl, handle, and public fields describe a verified external identity. profileUrl must be empty or an absolute HTTP(S) URL. handle is the provider's verified label, such as a GitHub login or fediverse handle. Set public to true only after the viewer opts into public display. It defaults to false. These profile fields are captured when the identity is first registered. Later calls with the same authId return the existing user but do not change the stored profile fields.
- JavaScript
- Python
const { userId } = owncast.users.register({
authId: 'github:583231',
displayName: 'octocat',
profileUrl: 'https://github.com/octocat',
handle: 'octocat',
public: false, // Set true only after the viewer opts in.
});
result = owncast.users.register(
"github:583231",
display_name="octocat",
profile_url="https://github.com/octocat",
handle="octocat",
public=False, # Set true only after the viewer opts in.
)
user_id = result.user_id
Richiede users.register.
Autenticazione
Questi alimentano un gate di autenticazione per visualizzatori. grantSession e endSession funzionano solo all'interno di un gestore onHttpRequest, perché l'host attacca il cookie di sessione alla risposta HTTP in volo.
owncast.auth.grantSession({ userId, ttl? })
Emetti una sessione firmata per un utente già registrato (l'userId da owncast.users.register). L'host genera, firma e attacca il cookie di sessione alla risposta corrente; il tuo plugin non vede mai il token, quindi non può forgiare o trapelarlo. ttl è una durata facoltativa in secondi (0/non specificata usa il valore predefinito dell'host di 24 ore).
- JavaScript
- Python
const { userId } = owncast.users.register({ authId: 'shared', displayName: 'Guest' });
owncast.auth.grantSession({ userId });
return { status: 302, headers: { Location: returnTo } };
result = owncast.users.register("shared", display_name="Guest")
owncast.auth.grant_session(result.user_id)
return {"status": 302, "headers": {"Location": return_to}}
Richiede auth.gate.
owncast.auth.endSession()
Cancella il cookie della sessione dell'attuale visualizzatore in questa risposta per disconnetterli. Il tuo plugin controlla ancora il reindirizzamento (e potrebbe rimbalzare sul logout del fornitore stesso).
- JavaScript
- Python
owncast.auth.endSession();
return { status: 302, headers: { Location: '/' } };
owncast.auth.end_session()
return {"status": 302, "headers": {"Location": "/"}}
Richiede auth.gate.
Memoria
owncast.kv.get(key) e owncast.kv.set(key, value)
Memoria chiave/valore per plugin, denominata con il slug del tuo plugin. I valori sono stringhe.
Per tipi più ricchi, usa gli helper JSON (getJSON / setJSON, get_json / set_json in Python) invece di fare il parsing e la serializzazione da solo. Il getter JSON restituisce il fallback quando la chiave non è impostata o contiene JSON non valido. I plugin non possono leggere le chiavi degli altri.
- JavaScript
- Python
owncast.kv.set('count', '1');
const n = Number(owncast.kv.get('count') ?? '0');
owncast.kv.setJSON('prefs', { theme: 'dark' });
const prefs = owncast.kv.getJSON('prefs', {});
owncast.kv.set("count", "1")
n = int(owncast.kv.get("count") or "0")
owncast.kv.set_json("prefs", {"theme": "dark"})
prefs = owncast.kv.get_json("prefs", {})
Richiede storage.kv.
owncast.storage.upload(name, data)
Carica un file nell'area file pubblica di Owncast. JavaScript accepts a Uint8Array or string. Python accepts bytes or str. Raw bytes are preserved, while strings are encoded as UTF-8. JavaScript returns { url } or null. Python returns a dict accessed as result["url"], or None.
Richiede storage.upload.
owncast.fs.*
A private, sandboxed filesystem at data/plugin-storage/\<your-slug>/files/. A differenza di owncast.storage.upload, questi file rimangono lato server: non sono mai serviti tramite HTTP. I percorsi sono relativi alla tua radice della sandbox. L'host limita ogni percorso alla tua directory (un plugin non può leggere i file di un altro plugin, e ../ o i percorsi assoluti tornano indietro all'interno della sandbox). Le directory padre vengono create secondo necessità durante la scrittura.
| JavaScript | Python | Restituisce |
|---|---|---|
fs.read(path) | fs.read(path) | Uint8Array / bytes, or null / None if missing |
fs.readText(path) | fs.read_text(path) | UTF-8 string / str, or null / None if missing |
fs.write(path, data) | fs.write(path, data) | { error? } |
fs.list(dir) | fs.list(dir) | nomi delle voci (una directory mancante è vuota) |
fs.delete(path) | fs.delete(path) | { error? } for a file or empty directory |
fs.exists(path) | fs.exists(path) | booleano |
fs.read preserves the original bytes. fs.readText and fs.read_text decode UTF-8. Python replaces malformed byte sequences when decoding. fs.write preserves a JavaScript Uint8Array or Python bytes, and UTF-8 encodes strings. fs.write and fs.delete return {} on success. If the host rejects the operation, they return { error } with the reason.
- JavaScript
- Python
owncast.fs.write('notes/log.txt', 'hello');
const text = owncast.fs.readText('notes/log.txt');
const data = new Uint8Array([0xff, 0x00, 0x80]);
owncast.fs.write('cache/data.bin', data);
const stored = owncast.fs.read('cache/data.bin');
if (stored) owncast.storage.upload('data.bin', stored);
owncast.fs.write("notes/log.txt", "hello")
text = owncast.fs.read_text("notes/log.txt")
data = bytes((0xFF, 0x00, 0x80))
owncast.fs.write("cache/data.bin", data)
stored = owncast.fs.read("cache/data.bin")
if stored is not None:
owncast.storage.upload("data.bin", stored)
Richiede storage.fs.
owncast.sql.*
One private SQLite database per plugin, at data/plugin-storage/\<your-slug>/db/plugin.db, separate from Owncast's own database and from the storage.fs sandbox. The sandbox is rooted at files/, so db/ is not a path owncast.fs.* refuses but one it cannot express, and the filesystem quota walk covers files/ only, so the two quotas stay independent. Reach for this over storage.kv when you need to sort, filter, or aggregate rather than just remember a value.
| Method | Returns |
|---|---|
sql.exec(sql, params?) | { rowsAffected, lastInsertId } |
sql.query(sql, params?) | rows as objects keyed by column name |
sql.queryRow(sql, params?) | the first row object, or null when nothing matched |
In Python queryRow is query_row, rows come back as dicts, and query_row returns None when nothing matched. An error throws in JavaScript and raises RuntimeError in Python. Parameters are null/None, booleans, numbers, or strings. Anything else is refused.
- JavaScript
- Python
owncast.sql.exec(`CREATE TABLE IF NOT EXISTS chatters (
user_id TEXT PRIMARY KEY,
messages INTEGER NOT NULL DEFAULT 0
)`);
owncast.sql.exec(
`INSERT INTO chatters (user_id, messages) VALUES (?, 1)
ON CONFLICT (user_id) DO UPDATE SET messages = messages + 1`,
[msg.user.id],
);
const top = owncast.sql.query(
'SELECT user_id, messages FROM chatters ORDER BY messages DESC LIMIT ?',
[5],
);
const mine = owncast.sql.queryRow('SELECT messages FROM chatters WHERE user_id = ?', [msg.user.id]);
owncast.sql.exec("""
CREATE TABLE IF NOT EXISTS chatters (
user_id TEXT PRIMARY KEY,
messages INTEGER NOT NULL DEFAULT 0
)
""")
owncast.sql.exec(
"""
INSERT INTO chatters (user_id, messages) VALUES (?, 1)
ON CONFLICT (user_id) DO UPDATE SET messages = messages + 1
""",
[msg.user.id],
)
top = owncast.sql.query(
"SELECT user_id, messages FROM chatters ORDER BY messages DESC LIMIT ?",
[5],
)
mine = owncast.sql.query_row("SELECT messages FROM chatters WHERE user_id = ?", [msg.user.id])
Each exec call runs as one host-owned transaction. A multi-statement batch commits whole or leaves the database untouched, so a schema migration can't half-apply. A plugin cannot leave a transaction open across calls, so there's nothing to clean up either.
query never hands back a silently short result. A query that overruns the row cap or the result budget is an error telling you to add a LIMIT, so write the bound you actually want when a table grows with your audience. queryRow reads a single row, which keeps it cheap on a table query is too big for.
| Limit | Value |
|---|---|
| Encoded request | 64 KiB total JSON |
| Bound parameters | 64 per call |
| Returned column value | 1 MiB |
| Encoded query result | 1 MiB |
| Rows returned | 10000 |
| Call duration | 2 seconds |
| Database size | 128 MiB |
Ordinary SQL is unaffected: DDL, DML, indexes, views, triggers, ORDER BY, recursive CTEs, subqueries, UNION, and the json1 functions all work. Refused in every host: ATTACH, DETACH, every PRAGMA (reads included), temporary-schema DDL both as keywords (CREATE TEMP TABLE / INDEX / TRIGGER / VIEW) and schema-qualified (CREATE TABLE temp.x), load_extension(), VACUUM and VACUUM INTO, and transaction controls (BEGIN, COMMIT, END, ROLLBACK, SAVEPOINT, and RELEASE). exec already owns the transaction around the whole batch.
Parameters and results cross the host boundary as JSON. Python can bind and read exact 64-bit SQLite integers. JavaScript loses unsafe integers before JSON.stringify on writes and during JSON.parse on reads. Store values above Number.MAX_SAFE_INTEGER (2^53 - 1) as TEXT when a JavaScript plugin needs them to remain exact.
Requires storage.sql. For a worked example, the chat-leaderboard plugin covers schema creation in one atomic exec, an ON CONFLICT upsert, a bounded ranked query, and a single-row read, in both JavaScript and Python. It contrasts with message-counter, which keeps the same counts in storage.kv and cannot rank.
Configurazione
owncast.config.get(key, fallback?)
Leggi una delle impostazioni config dichiarate nel manifesto del plugin. Restituisce il valore impostato dall'amministratore quando presente, altrimenti il valore predefinito dichiarato, già analizzato nel suo tipo dichiarato. Per una chiave sconosciuta (o una senza valore) restituisce fallback.
- JavaScript
- Python
const cooldownMs = owncast.config.get('cooldownMs', 2000);
cooldown_ms = owncast.config.get("cooldownMs", 2000)
Ambient: no permission required. Preferisci questo rispetto alla creazione di una pagina di impostazioni su misura e al collegamento chiave/valore per semplici controlli. (La chiave di configurazione è quella che hai nominato nel manifesto e non viene tradotta in base alla lingua.)
Rete
owncast.http.fetch(url, opts?)
Richiesta HTTP outbound sincrona. opts contiene method, headers e body. Il risultato è { status, headers, body }. Solo gli host elencati in network.allowedHosts del tuo manifesto sono raggiungibili. Tutto il resto restituisce un errore.
- JavaScript
- Python
const res = owncast.http.fetch('https://api.example.com/status');
if (res.status === 200) {
const data = JSON.parse(res.body);
}
import json
res = owncast.http.fetch("https://api.example.com/status")
if res.status == 200:
data = json.loads(res.body)
Richiede network.fetch e un'entrata corrispondente in network.allowedHosts. Usa questo per l'HTTP outbound piuttosto che il client HTTP nativo del tuo linguaggio (in Python, non usare requests: non si compilerà in un plugin).
Vedi la riferimento manifest: rete per la sintassi della lista di autorizzazione.
Eventi plugin-to-plugin
owncast.events.emit(eventType, payload)
Emit to a custom hook owned by another plugin. eventType is the fully
qualified \<recipient-slug>.\<hook> target. The host dispatches that exact name
and does not add the emitter's slug. The receiving plugin declares only its
local hook name. See the
handlers reference.
- JavaScript
- Python
owncast.events.emit('announcer.announcement.broadcast', { text: 'We are live' });
owncast.events.emit("announcer.announcement.broadcast", {"text": "We are live"})
Richiede events.emit.
Stato dello stream e del server
owncast.stream.current()
The current live stream state: { online, title?, summary?, viewers, startedAt?, latencyLevel? }.
Requires server.read.
owncast.stream.broadcaster()
Inbound encode telemetry for the current connection: { remoteAddr?, codecs?, resolution?, framerate?, bitrates? }. Sola lettura e valore zero quando nessuna trasmissione è connessa. Per cambiare l'output video, vedere il gruppo configurazione video qui sotto.
Richiede server.read.
owncast.server.info()
Static server info: { name?, url?, summary?, welcomeMessage?, version? }.
- JavaScript
- Python
const name = owncast.server.info().name;
name = owncast.server.info().name
Richiede server.read.
owncast.server.socials()
The streamer's configured social links, each { platform, url, icon? }.
Requires server.read.
owncast.server.emotes()
Le emoticon personalizzate del server: lo stesso set che fornisce l'endpoint pubblico /api/emoji, ognuno { name, url }. Utile per il rendering o il filtraggio delle emoticon :code: lato server.
Richiede server.read.
owncast.server.federation()
Whether fediverse federation is enabled and under what handle: { enabled, username?, isPrivate? }. username is omitted when unset, and isPrivate is present only when true.
Richiede server.read.
owncast.server.tags()
I tag configurati dallo streamer, come un elenco di stringhe.
Richiede server.read.
Configurazione video e transcoding
owncast.videoConfig.read()
Returns the current VideoConfig.
| Field | Type | Values |
|---|---|---|
latencyLevel | number | 0 through 4 |
codec | string | Configured ffmpeg encoder name |
autoplay | string | off, always, or sound-only |
variants | StreamVariant[] | Configured output renditions |
codec reads can report a legacy value or an encoder added by a newer host. Writes accept libx264, h264_omx, h264_vaapi, h264_qsv, h264_nvenc, h264_v4l2m2m, or h264_videotoolbox. Hardware codecs require the matching encoder in the host's ffmpeg build.
Autoplay off requires the viewer to press play. always starts automatically and may fall back to muted playback. sound-only starts automatically only when the browser allows sound.
Each StreamVariant has these fields:
| Field | Type | Description |
|---|---|---|
width | number | Scaled output width |
height | number | Scaled output height |
framerate | number | Output frames per second |
videoBitrate | number | Video bitrate in kbps |
cpuUsageLevel | number | Processing usage from 0 (lowest) through 4 (highest) |
isPassthrough | boolean | Pass video through without transcoding |
Audio settings are not exposed to plugins. Owncast preserves the existing audio configuration for each variant a plugin updates.
- JavaScript
- Python
const cfg = owncast.videoConfig.read();
cfg = owncast.video_config.read()
Richiede videoconfig.read.
owncast.videoConfig.write(partial)
Update any of the VideoConfig fields above. Passa un oggetto parziale. Solo i campi che includi vengono modificati. Le modifiche si applicano all'inizio della prossima trasmissione: l'host non riavvia una trasmissione attiva.
- JavaScript
- Python
owncast.videoConfig.write({ latencyLevel: 2, autoplay: "sound-only" });
owncast.video_config.write({"latencyLevel": 2, "autoplay": "sound-only"})
Richiede videoconfig.write. Questo è ad alta fiducia. Gli amministratori dovrebbero concedere con parsimonia.
Notifiche
owncast.notifications.discord(text)
Invia una notifica Discord attraverso il webhook configurato dello streamer.
Richiede notifications.send.
owncast.notifications.browserPush({ title, body, url? })
Push ai browser sottoscritti.
- JavaScript
- Python
owncast.notifications.browserPush({ title: 'Live now', body: 'Come say hi', url: '/' });
owncast.notifications.browser_push({"title": "Live now", "body": "Come say hi", "url": "/"})
Richiede notifications.send.
owncast.notifications.fediverse({ type, body, image?, link? })
Invia una notifica formattata per il fediverse (viene visualizzata come un post per i follower).
Richiede notifications.send.
Fediverse
owncast.fediverse.post(text)
Fai un post pubblico nel fediverse dall'account di Owncast.
Returns { url } on success (currently with an empty url: Owncast publishes the note but does not yet return its URL), or null when the host rejects the call.
Richiede fediverse.post. Alta fiducia: un post sul fediverse viene inviato con l'handle dello streamer e non può essere revocato silenziosamente. Gli amministratori dovrebbero concedere con parsimonia.
Pulsanti di azione (runtime)
owncast.actions.add(button | buttons[])
Aggiungi uno o più pulsanti di azione al set di manifest del tuo plugin senza un ricaricamento. Ogni pulsante richiede gli stessi campi di una voce di manifest.actions (title, più url/openExternally o html inline). L'host convalida ogni voce con le stesse regole di manifest.actions e persiste il risultato in modo che le aggiunte sopravvivano a un ricaricamento. A rejected entry throws an error naming the entry and the rule it broke, and the whole batch is rejected, so nothing is added when any entry is invalid.
- JavaScript
- Python
owncast.actions.add({ title: 'Donate', url: '/plugins/my-plugin/donate', openExternally: true });
owncast.actions.add({"title": "Donate", "url": "/plugins/my-plugin/donate", "openExternally": True})
Richiede ui.modify.
owncast.actions.clear()
Rimuove ogni pulsante di azione aggiunto in runtime. Le azioni dichiarate nel manifesto rimangono.
Richiede ui.modify.
Copertura totale in UI: Pulsanti di azione.
Push in tempo reale (Server-Sent Events)
owncast.sse.send(channel, event, data)
Invia un Server-Sent-Event a ogni browser connesso all'endpoint /_sse/\<channel> del tuo plugin.
channel: quale stream pushare. Usa""per il canale predefinito.event: il nome dell'evento che il browser ascolta. Usa""per l'eventomessagepredefinito.data: payload. Le stringhe vengono inviate così come sono. Tutto il resto viene codificato in JSON per te.
- JavaScript
- Python
owncast.sse.send('alerts', 'donation', { from: 'alice', amount: 5 });
owncast.sse.send("alerts", "donation", {"from": "alice", "amount": 5})
Fire-and-forget. La chiamata restituisce immediatamente e non blocca mai. I client lenti perdono frame piuttosto che fermare il tuo plugin.
Richiede http.sse.
Copertura completa in Servire HTTP: aggiornamenti in tempo reale.
Timer
Pianifica lavoro rimandato e ripetitivo. I timer sono ambienti, non richiedono autorizzazione e vengono cancellati automaticamente quando il tuo plugin è disabilitato. (Python: set_timeout, set_interval, clear.)
owncast.timer.setTimeout(fn, ms)
Esegui fn una volta dopo ms millisecondi. Restituisce un id.
owncast.timer.setInterval(fn, ms)
Esegui fn ripetutamente ogni ms millisecondi. Restituisce un id.
owncast.timer.clear(id)
Annulla un timeout o un intervallo in sospeso tramite l'id restituito dalla chiamata.
Risorse incorporate
Leggi i file che hai spedito nella directory assets/ del tuo plugin. Ambient: non richiede autorizzazione. (Python: read, read_text.)
owncast.assets.read(path) and owncast.assets.readText(path)
Read a file bundled under assets/, relative to that directory. read returns the original bytes as a JavaScript Uint8Array or Python bytes. readText and Python's read_text decode the bytes as UTF-8. Python replaces malformed byte sequences when decoding. Missing files return null in JavaScript or None in Python.
- JavaScript
- Python
const image = owncast.assets.read('badge.png');
const template = owncast.assets.readText('template.html');
image = owncast.assets.read("badge.png")
template = owncast.assets.read_text("template.html")
Riferimento completo all'API
I nomi dei metodi sottostanti sono nella forma JavaScript (camelCase). Gli equivalenti Python sono snake_case (sendAction → send_action, banIP → ban_ip, videoConfig → video_config, e così via).
| API | Autorizzazione |
|---|---|
owncast.log.info / .warning / .error | nessuno (ambient) |
owncast.chat.send | chat.send |
owncast.chat.sendAction | chat.send |
owncast.chat.sendTo | chat.send |
owncast.chat.system | chat.send |
owncast.chat.replyTo | chat.send |
owncast.chat.history | chat.history |
owncast.chat.clients | chat.history |
owncast.chat.deleteMessage | chat.moderate |
owncast.chat.kick | chat.moderate |
owncast.users.list / .get | users.read |
owncast.users.setEnabled / .banIP | users.moderate |
owncast.users.register | users.register |
owncast.auth.grantSession / .endSession | auth.gate |
owncast.kv.get / .set / .getJSON / .setJSON | storage.kv |
owncast.storage.upload | storage.upload |
owncast.fs.read / .readText / .write / .list / .delete / .exists | storage.fs |
owncast.sql.exec / .query / .queryRow | storage.sql |
owncast.http.fetch | network.fetch |
owncast.events.emit | events.emit |
owncast.stream.current | server.read |
owncast.stream.broadcaster | server.read |
owncast.server.info / .socials / .emotes / .federation / .tags | server.read |
owncast.videoConfig.read | videoconfig.read |
owncast.videoConfig.write | videoconfig.write |
owncast.notifications.discord / .browserPush / .fediverse | notifications.send |
owncast.fediverse.post | fediverse.post |
owncast.actions.add / .clear | ui.modify |
owncast.timer.setTimeout / .setInterval / .clear | nessuno (ambient) |
owncast.assets.read / .readText | nessuno (ambient) |
owncast.config.get | none (ambient) |
owncast.sse.send | http.sse |
Improve this page
See something missing or incorrect? Edit this page and improve the documentation for everyone.
Gabe Kangas