From 7a9dc41f79a886f0c6bfee00652c32ed42d0613a Mon Sep 17 00:00:00 2001
From: janson <janson@gmail.com>
Date: Wed, 13 Mar 2024 15:35:41 +0800
Subject: [PATCH] typecho OK

---
 applications/luci-app-typecho/luasrc/model/cbi/typecho.lua  | 1 -
 .../luci-app-typecho/luasrc/view/typecho/status.htm         | 2 +-
 applications/luci-app-typecho/root/etc/config/typecho       | 2 --
 .../luci-app-typecho/root/usr/libexec/istorec/typecho.sh    | 6 ++++--
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/applications/luci-app-typecho/luasrc/model/cbi/typecho.lua b/applications/luci-app-typecho/luasrc/model/cbi/typecho.lua
index 910ee9a..af6c446 100644
--- a/applications/luci-app-typecho/luasrc/model/cbi/typecho.lua
+++ b/applications/luci-app-typecho/luasrc/model/cbi/typecho.lua
@@ -34,7 +34,6 @@ s.anonymous=true
 o = s:option(Value, "port", translate("Port").."<b>*</b>")
 o.default = "9080"
 o.datatype = "port"
-o:depends("hostnet", 0)
 
 o = s:option(Value, "image_name", translate("Image").."<b>*</b>")
 o.rmempty = false
diff --git a/applications/luci-app-typecho/luasrc/view/typecho/status.htm b/applications/luci-app-typecho/luasrc/view/typecho/status.htm
index 80a62e0..7dc1d4d 100644
--- a/applications/luci-app-typecho/luasrc/view/typecho/status.htm
+++ b/applications/luci-app-typecho/luasrc/view/typecho/status.htm
@@ -25,7 +25,7 @@ if container_running then
     <label class="cbi-value-title">&nbsp;</label>
     <div class="cbi-value-field">
 
-    <input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open TypeCho%>" onclick="window.open('http://'+location.hostname+':<%=port%>/web/', '_blank')">
+    <input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open TypeCho%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
     </div>
 </div>
 <% end %>
diff --git a/applications/luci-app-typecho/root/etc/config/typecho b/applications/luci-app-typecho/root/etc/config/typecho
index ec8adcd..8feb9f5 100644
--- a/applications/luci-app-typecho/root/etc/config/typecho
+++ b/applications/luci-app-typecho/root/etc/config/typecho
@@ -1,6 +1,4 @@
 config main
-	option 'hostnet' '0'
-	option 'claim_token' ''
 	option 'port' '9080'
 	option 'config_path' ''
 
diff --git a/applications/luci-app-typecho/root/usr/libexec/istorec/typecho.sh b/applications/luci-app-typecho/root/usr/libexec/istorec/typecho.sh
index 4689f8f..ea53918 100755
--- a/applications/luci-app-typecho/root/usr/libexec/istorec/typecho.sh
+++ b/applications/luci-app-typecho/root/usr/libexec/istorec/typecho.sh
@@ -13,7 +13,6 @@ do_install() {
     echo "config path is empty!"
     exit 1
   fi
-
   [ -z "$image_name" ] && image_name="joyqi/typecho:nightly-php7.4"
   echo "docker pull ${image_name}"
   docker pull ${image_name}
@@ -21,7 +20,9 @@ do_install() {
 
   [ -z "$port" ] && port=9080
 
-  local cmd="docker run --restart=unless-stopped -d -h TypeChoServer -v \"$config:/config\" "
+  mkdir -p $config
+  chmod 777 $config
+  local cmd="docker run --restart=unless-stopped -d -h TypeChoServer -v \"$config:/app/usr\" "
 
   cmd="$cmd\
   --dns=172.17.0.1 \
@@ -29,6 +30,7 @@ do_install() {
 
   local tz="`uci get system.@system[0].zonename | sed 's/ /_/g'`"
   [ -z "$tz" ] || cmd="$cmd -e TZ=$tz"
+
   cmd="$cmd -v /mnt:/mnt"
   mountpoint -q /mnt && cmd="$cmd:rslave"
   cmd="$cmd --name typecho \"$image_name\""