forked from Nolovenodie/emby-crx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sh
27 lines (22 loc) · 1.3 KB
/
script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# 创建emby-crx目录并下载所需文件
rm -rf emby-crx
mkdir -p emby-crx
wget https://raw.githubusercontent.com/Nolovenodie/emby-crx/master/static/css/style.css -P emby-crx/
wget https://raw.githubusercontent.com/Nolovenodie/emby-crx/master/static/js/common-utils.js -P emby-crx/
wget https://raw.githubusercontent.com/Nolovenodie/emby-crx/master/static/js/jquery-3.6.0.min.js -P emby-crx/
wget https://raw.githubusercontent.com/Nolovenodie/emby-crx/master/static/js/md5.min.js -P emby-crx/
wget https://raw.githubusercontent.com/Nolovenodie/emby-crx/master/content/main.js -P emby-crx/
# 读取index.html文件内容
content=$(cat index.html)
# 检查index.html是否包含emby-crx
if grep -q "emby-crx" index.html; then
echo "Index.html already contains emby-crx, skipping insertion."
else
# 定义要插入的代码
code='<link rel="stylesheet" id="theme-css" href="emby-crx/style.css" type="text/css" media="all" />\n<script src="emby-crx/common-utils.js"></script>\n<script src="emby-crx/jquery-3.6.0.min.js"></script>\n<script src="emby-crx/md5.min.js"></script>\n<script src="emby-crx/main.js"></script>'
# 在</head>之前插入代码
new_content=$(echo -e "${content/<\/head>/$code<\/head>}")
# 将新内容写入index.html文件
echo -e "$new_content" > index.html
fi