Skip to content

Commit

Permalink
feat(stremio): add example js patcher script
Browse files Browse the repository at this point in the history
  • Loading branch information
n0bodysec committed Nov 2, 2022
1 parent 7f67226 commit 1bfb21d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stremio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apk add --no-cache git wget dos2unix
RUN git clone https://github.com/Stremio/stremio-web.git

WORKDIR /srv/stremio/dist
COPY patches.sh run.sh ./
COPY files/*.sh ./
RUN chmod +x *.sh && dos2unix *.sh

WORKDIR /srv/stremio/dist/shell
Expand Down
2 changes: 2 additions & 0 deletions stremio/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ services:
- '8081:8081'
volumes:
- ./data/:/root/.stremio-server
- ./files/patches.js:/srv/stremio/web/patches.js:ro
- ./files/patches.js:/srv/stremio/shell/patches.js:ro
env_file:
- .env
2 changes: 2 additions & 0 deletions stremio/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ services:
- '8081:8081'
volumes:
- ./data/:/root/.stremio-server
- ./files/patches.js:/srv/stremio/web/patches.js:ro
- ./files/patches.js:/srv/stremio/shell/patches.js:ro
env_file:
- .env
17 changes: 17 additions & 0 deletions stremio/files/patches.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
*
* @name Stremio JavaScript Patcher
* @author n0bodysec
* @description A simple JS that is executed on document load. You can apply custom client patches with it.
* @example https://gist.github.com/n0bodysec/2896438d8578f13c4a9e30373f7200c1
* This script can be loaded using nginx sub_filter
* sub_filter '</body>' '<script src="https://your.stremio.url/patches.js"></script></body>';
* sub_filter_once on;
*
*/

window.addEventListener('DOMContentLoaded', async (event) =>
{
const isLegacy = localStorage.streamingServerUrl !== undefined;
console.log(`[STREMIO PATCHER] Detected ${isLegacy ? 'Legacy' : 'Web'} UI`);
});
File renamed without changes.
File renamed without changes.

0 comments on commit 1bfb21d

Please sign in to comment.