π¬ BetterStremio is a dynamic Plugin & Theme loader for Stremio.
BetterStremio patches the server.js
file to inject code in the local development web server hosted at 127.0.0.1:11470
and adds a loader script to run external plugins and CSS themes. There is no need to download external custom Stremio executables! :)
Download and run the installer from the releases page. You can also choose the "Uninstall" option to unpatch changes made to Stremio's server.js file and all modified shortcuts.
Tip
The original stremio server can still be used when opening stremio.exe
. For BetterStremio to work it must be opened though the shotcut.
For Linux users, it is required to run Stremio manually with the flags: --development --streaming-server
, please add it to your shortcuts.
Arch Linux was the only distro verified, please contribute to support your own distro.
If you want to install it manually, or build the installer locally, please check out the Contribute section for more information about how the patching works.
Demo Plugin: https://github.com/MateusAquino/WatchParty
Demo Theme: https://github.com/REVENGE977/StremioAmoledTheme
While developing plugins (.js files) and themes (.css files) you should be accessing through the browser at localhost:11470
for easier reloading and access to Developer Tools.
Here's a sample of all theme options (note these @annotations are not required but are a nice to have).
Sample.theme.css:
/**
* @name Amoled Theme
* @description A theme that uses amoled pitch black color.
* @image https://github.com/REVENGE977/stremio-enhanced/raw/main/images/amoled_screenshot.png
* @updateUrl https://raw.githubusercontent.com/REVENGE977/StremioAmoledTheme/main/amoled.theme.css
* @shareUrl https://github.com/REVENGE977/StremioAmoledTheme
* @version 1.0.1
* @author REVENGE977
*/
Pitch black Stremio Theme ref: https://github.com/REVENGE977/StremioAmoledTheme
Developing plugins is easy, here are all the methods you need for a sample plugin:
Sample.plugin.js:
module.exports = class SamplePlugin {
getName() {return "Sample BetterStremio Plugin"}
getImage() {return "https://cdn-icons-png.flaticon.com/512/9908/9908191.png"}
getDescription() {return "Sample plugin description."}
getVersion() {return "1.0.0"}
getAuthor() {return "YourAt"}
getShareURL() {return "https://github.com/Sample/example"}
getUpdateURL() {return "https://raw.githubusercontent.com/Sample/example/main/Example.js"}
onBoot() {}
onReady() {}
onLoad() {}
onEnable() {}
onDisable() {}
onSettings() {}
}
All of these functions are optional. If you remove onSettings()
declaration the settings button will be removed from your Plugin.
Prefer to always use onLoad
event (when window is loaded), as onBoot
is executed before the DOM is initialized and onReady
when the DOM is parsed.
You can also call functions from your own plugin, eg. for a better enable/disable compatibility:
onEnable() { this.onLoad(); }
Stremio's web source uses angular directives behind the scenes, you can use Plain JS or make use of Stremio Root functions exported by BetterStremio (eg. BetterStremio.StremioRoot
).
When developing plugins you might need to store/read data or interact with Stremio libs and resources. Here are all default loaded APIs for BetterStremio:
Mod | Calls | Description |
---|---|---|
BetterStremio | host version errors |
Basic Information variables |
BetterStremio.Data | store: (plugin, key, value) read: (plugin, key) delete: (plugin, key) |
Read/Store information from storage |
BetterStremio.Plugins | enable: (plugin) disable: (plugin) reload: () |
Used internally to control plugin states |
BetterStremio.Themes | enable: (theme) disable: (theme) reload: () |
Used internally to control theme states |
BetterStremio.Internal | fetch: (route='/', async=true) update: (filename, sourceUrl) reloadInfo: () reloadUI: () enabledPlugins enabledThemes enabledThemes plugins themes |
Required functions and variables for BetterStremio loader to handle plugins, themes and autoupdates |
BetterStremio.Toasts | error(title, desc, opts) info(title, desc, opts) success(title, desc, opts) warning(title, desc, opts) |
Toasts notification lib used by Stremio |
BetterStremio.StremioRoot | Read on DevTools for all states and functions | Used by Stremio's Angular client to control inner states |
BetterStremio.Player | Read on DevTools for all states and functions | Video Player used by Stremio. |
BetterStremio.Sharing | Read on DevTools for all states and functions | Stremio's sharing module. |
BetterStremio.Modules | Read on DevTools for all states and functions | All loaded modules. |
BetterStremio.Scopes | Read on DevTools for all states and functions | Stremio scopes from controllers (updates once controller is open). |
If you need to use any other libraries or modules from Stremio (metadata, subtitles, windowManager), use the function sample below to import them.
stremioApp.run([/* libs... */, function (/* callback modules */) => {
/* Your code */
}])
For further information, see examples of BetterStremio.loader.js
or dive into blob.js
on Developer Tools to make use of the source code, eg:
- Plugin & Theme loader
- Auto-update for BetterStremio loader
- Interface for plugins (stremio internals & storage)
- Sample plugin & theme
- Installer w/ WebUI
- Windows installer
- Linux installer (verified distros: Arch Linux)
- MacOS installer (needs contribution)
- Check for updates on plugins & themes (manual)
- Internationalization
This repository is currently available for contributions. If you'd like to help, here are more advanced things to know about how BetterStremio works:
-
The installer patches Stremio's server.js file with patch.js, updating some routes:
GET /betterstremio/
: Get information about BetterStremio's patch version, path, installed plugins and themes.GET /betterstremio/folder
: Open plugins/themes folder on user's file explorer.GET /betterstremio/changelog
: Open BetterStremio's changelog on the browser.GET /betterstremio/src/:path
: Static sharing of files on BetterStremio's folder.POST /betterstremio/update/:path?from=URL
: Replaces a file on BetterStremio's folder with the raw content read from the URL for updates.GET /
: Patched Stremio version, it read contents from "app.strem.io/shell-v4.4" as usual but injects BetterStremio's loader.
-
Patching means to insert these routes into
server.js
and create shortcuts with two arguments for Stremio:--development --streaming-server
(see: stremio/stremio-shell) -
BetterStremio loader will automatically update itself on next load (or past 24h) when BetterStremio.version is changed in this repository.
-
If you want to β€οΈ contribute to develop plugins & themes, note you can run stremio locally in your browser @
http://localhost:11470
to access Developer Tools. -
If you want to β€οΈ contribute to BetterStremio and its installer, clone this repository and run:
cd installer deno install deno task dev # develop the frontend with a mocked interface (check: installer\src\webui.ts) deno task build # compiles the frontend to dist/ deno task compile # (run after deno build) generates a webui executable with a working backend for patching files