From 02b4965f5b3fa01b67a4af8fa061da71c4ed50e5 Mon Sep 17 00:00:00 2001 From: arho Date: Tue, 23 Jan 2024 15:09:09 +0800 Subject: [PATCH] First Commit --- .github/workflows/BuildImage.yml | 45 ++++++++++++++++++ .github/workflows/call_issue_pr_tracker.yml | 25 ++++++++++ .github/workflows/permissions.yml | 10 ++++ .gitignore | 0 Dockerfile | 4 ++ README.md | 7 +++ .../dependencies.d/init-mods | 0 .../run | 46 +++++++++++++++++++ .../type | 1 + .../up | 1 + .../init-mod-emby-custom-css-js-add-package | 0 .../init-mod-emby-custom-css-js-add-package | 0 12 files changed, 139 insertions(+) create mode 100644 .github/workflows/BuildImage.yml create mode 100644 .github/workflows/call_issue_pr_tracker.yml create mode 100644 .github/workflows/permissions.yml create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/dependencies.d/init-mods create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/run create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/type create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/up create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-emby-custom-css-js-add-package create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-emby-custom-css-js-add-package diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml new file mode 100644 index 0000000..d937cbd --- /dev/null +++ b/.github/workflows/BuildImage.yml @@ -0,0 +1,45 @@ +name: Build Image + +on: [push, pull_request_target, workflow_dispatch] + +env: + GITHUB_REPO: "linuxserver/docker-mods" #don't modify + ENDPOINT: "linuxserver/mods" #don't modify + BASEIMAGE: "emby" #replace + MODNAME: "custom-css-js" #replace + +jobs: + set-vars: + runs-on: ubuntu-latest + steps: + - name: Set Vars + id: outputs + run: | + echo "GITHUB_REPO=${{ env.GITHUB_REPO }}" >> $GITHUB_OUTPUT + echo "ENDPOINT=${{ env.ENDPOINT }}" >> $GITHUB_OUTPUT + echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT + echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT + # **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. **** + MOD_VERSION="" + echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT + outputs: + GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }} + ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }} + BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }} + MODNAME: ${{ steps.outputs.outputs.MODNAME }} + MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }} + + build: + uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1 + needs: set-vars + secrets: + CR_USER: ${{ secrets.CR_USER }} + CR_PAT: ${{ secrets.CR_PAT }} + DOCKERUSER: ${{ secrets.DOCKERUSER }} + DOCKERPASS: ${{ secrets.DOCKERPASS }} + with: + GITHUB_REPO: ${{ needs.set-vars.outputs.GITHUB_REPO }} + ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }} + BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }} + MODNAME: ${{ needs.set-vars.outputs.MODNAME }} + MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }} diff --git a/.github/workflows/call_issue_pr_tracker.yml b/.github/workflows/call_issue_pr_tracker.yml new file mode 100644 index 0000000..e294423 --- /dev/null +++ b/.github/workflows/call_issue_pr_tracker.yml @@ -0,0 +1,25 @@ +name: Issue & PR Tracker + +on: + issues: + types: [opened, reopened, labeled, unlabeled, closed] + pull_request_target: + types: + [ + opened, + reopened, + review_requested, + review_request_removed, + labeled, + unlabeled, + closed, + ] + pull_request_review: + types: [submitted, edited, dismissed] + +jobs: + manage-project: + permissions: + issues: write + uses: linuxserver/github-workflows/.github/workflows/issue-pr-tracker.yml@v1 + secrets: inherit diff --git a/.github/workflows/permissions.yml b/.github/workflows/permissions.yml new file mode 100644 index 0000000..0833e2e --- /dev/null +++ b/.github/workflows/permissions.yml @@ -0,0 +1,10 @@ +name: Permission check +on: + pull_request_target: + paths: + - "**/run" + - "**/finish" + - "**/check" +jobs: + permission_check: + uses: linuxserver/github-workflows/.github/workflows/init-svc-executable-permissions.yml@v1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..79d6129 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM scratch + +# copy local files +COPY root/ / \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..74db9bf --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Emby CustomCssJs 插件 Docker Mod + +这个模块将[CustomCssJs](https://github.com/Shurelol/Emby.CustomCssJS)插件安装到 Linuxserver.io 的 emby 中。插件具体使用方法请看作者仓库:[Shurelol/Emby.CustomCssJs](https://github.com/Shurelol/Emby.CustomCssJS) + +## 使用方法 + +在 Emby docker 参数中加入环境变量`DOCKER_MODS=arho14/emby-custom-css-js`,多个模块使用`|`隔开,例如:`DOCKER_MODS=arho14/emby-custom-css-js|linuxserver/mods:emby-second-mod` diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/dependencies.d/init-mods b/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/dependencies.d/init-mods new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/run b/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/run new file mode 100644 index 0000000..a73b091 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/run @@ -0,0 +1,46 @@ +#!/usr/bin/with-contenv bash + +# 设置临时文件夹路径 +temp_folder="/config/mods/emby_custom_css_js" + +# 设置目标目录路径 +plugins_folder="/config/plugins" +modules_folder="/app/emby/dashboard-ui/modules" + +# 创建临时文件夹 +mkdir -p "$temp_folder" + +# 下载GitHub项目的tar文件 +curl -L -o "$temp_folder/emby_custom_css_js.tar.gz" https://mirror.ghproxy.com/https://github.com/Shurelol/Emby.CustomCssJS/archive/refs/heads/main.tar.gz + +# 检查下载是否成功 +if [ $? -eq 0 ]; then + echo "**** CustomCssJS下载成功 ****" + # 解压tar文件 + tar -xzf "$temp_folder/emby_custom_css_js.tar.gz" -C "$temp_folder" + + # 复制文件到目标目录(覆盖同名文件) + cp -f "$temp_folder/Emby.CustomCssJS-main/src/Emby.CustomCssJS.dll" "$plugins_folder" + cp -f "$temp_folder/Emby.CustomCssJS-main/src/CustomCssJS.js" "$modules_folder" + # 设置文件权限 + lsiown -R abc:abc $plugins_folder + + # 检查复制是否成功 + if [ $? -eq 0 ]; then + + # 修改app.js文件 + if grep -q "CustomCssJS" "/app/emby/dashboard-ui/app.js"; then + echo "app.js文件已包含指定内容,无需修改。" + else + sed -i 's/Promise.all(list.map(loadPlugin))/list.push(".\/modules\/CustomCssJS.js"),Promise.all(list.map(loadPlugin))/g' /app/emby/dashboard-ui/app.js + fi + echo "**** CustomCssJS安装成功 ****" + + # 清理临时文件 + rm -rf "$temp_folder" + else + echo "**** CustomCssJS安装失败,请检查目标目录是否存在或具有适当的权限。 ****" + fi +else + echo "**** CustomCssJS下载失败,请检查网络连接或URL是否正确。 ****" +fi diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/type b/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/type new file mode 100644 index 0000000..3d92b15 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/up b/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/up new file mode 100644 index 0000000..60665bd --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-mod-emby-custom-css-js-add-package/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-emby-custom-css-js-add-package b/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-emby-custom-css-js-add-package new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-emby-custom-css-js-add-package b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-emby-custom-css-js-add-package new file mode 100644 index 0000000..e69de29