no message

This commit is contained in:
kuaifan 2025-05-13 00:55:20 +08:00
parent 3809aca09d
commit 35dfb9d1ff
4 changed files with 27 additions and 14 deletions

View File

@ -123,6 +123,13 @@ class AppsController extends AbstractController
*/ */
public function install__callback() public function install__callback()
{ {
// 用户权限验证
$authorization = Base::leftDelete(Request::header("Authorization"), "Bearer ");
if ($authorization != md5(env('APP_KEY'))) {
return 'Authorization error';
}
// 获取参数
$appName = Request::input('app_name'); $appName = Request::input('app_name');
$status = Request::input('status'); $status = Request::input('status');

View File

@ -533,20 +533,21 @@ class Apps
$readmePatterns = [ $readmePatterns = [
"/^README(_|-|\.)?{$lang}\.md$/i", // README_zh.md, README-zh.md, README.zh.md "/^README(_|-|\.)?{$lang}\.md$/i", // README_zh.md, README-zh.md, README.zh.md
]; ];
if ($lang == 'zh') { if ($lang == 'ZH') {
$readmePatterns[] = "/^README(_|-|\.)?CN\.md$/i"; // README_CN.md, README-cn.md, README.cn.md $readmePatterns[] = "/^README(_|-|\.)?CN\.md$/i"; // README_CN.md, README-cn.md, README.cn.md
} }
if ($lang == 'zh-CHT') { if ($lang == 'ZH-CHT') {
$readmePatterns[] = "/^README(_|-|\.)?TW\.md$/i"; // README_TW.md, README-tw.md, README.tw.md $readmePatterns[] = "/^README(_|-|\.)?TW\.md$/i"; // README_TW.md, README-tw.md, README.tw.md
} }
$readmePatterns[] = "/^README\.md$/i"; // README.md $readmePatterns[] = "/^README\.md$/i"; // README.md
foreach ($files as $filePath) { // 遍历所有 README 模式进行匹配
$fileName = basename($filePath); foreach ($readmePatterns as $pattern) {
foreach ($files as $filePath) {
// 检查是否为文件且匹配 README 模式 $fileName = basename($filePath);
if (is_file($filePath) && self::matchReadmePattern($fileName, $readmePatterns)) { if (preg_match($pattern, $fileName)) {
return file_get_contents($filePath); return file_get_contents($filePath);
}
} }
} }
@ -823,7 +824,7 @@ class Apps
$url = "http://nginx/appstore/api/{$path}"; $url = "http://nginx/appstore/api/{$path}";
$extra = [ $extra = [
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . env('APP_KEY'), 'Authorization' => 'Bearer ' . md5(env('APP_KEY')),
]; ];
// 执行请求 // 执行请求

13
cmd
View File

@ -229,7 +229,7 @@ run_mysql() {
fi fi
} }
down_by_network() { remove_by_network() {
local app_id=$(env_get APP_ID) local app_id=$(env_get APP_ID)
local network_name="dootask-networks-${app_id}" local network_name="dootask-networks-${app_id}"
for container_id in $(docker ps -q --filter network="$network_name"); do for container_id in $(docker ps -q --filter network="$network_name"); do
@ -237,6 +237,10 @@ down_by_network() {
done done
} }
uninstall_appstore() {
docker run -it --rm -v ${cur_path}/docker/appstore:/appstore alpine sh -c "find /appstore/configs -mindepth 1 -type d | sort -r | xargs rm -rf; rm -f /appstore/logs/*.log"
}
https_auto() { https_auto() {
restart_nginx="n" restart_nginx="n"
if [[ "$(env_get APP_PORT)" != "80" ]]; then if [[ "$(env_get APP_PORT)" != "80" ]]; then
@ -467,7 +471,8 @@ if [ $# -gt 0 ]; then
exit 2 exit 2
;; ;;
esac esac
down_by_network remove_by_network
uninstall_appstore
$COMPOSE down --remove-orphans $COMPOSE down --remove-orphans
env_set APP_DEBUG "false" env_set APP_DEBUG "false"
rm -rf "./docker/mysql/data" rm -rf "./docker/mysql/data"
@ -597,12 +602,12 @@ if [ $# -gt 0 ]; then
$COMPOSE start "$@" $COMPOSE start "$@"
elif [[ "$1" == "reup" ]]; then elif [[ "$1" == "reup" ]]; then
shift 1 shift 1
down_by_network remove_by_network
$COMPOSE down --remove-orphans $COMPOSE down --remove-orphans
$COMPOSE up -d $COMPOSE up -d
elif [[ "$1" == "down" ]]; then elif [[ "$1" == "down" ]]; then
shift 1 shift 1
down_by_network remove_by_network
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
$COMPOSE down --remove-orphans $COMPOSE down --remove-orphans
else else

View File

@ -221,7 +221,7 @@ services:
appstore: appstore:
container_name: "dootask-appstore-${APP_ID}" container_name: "dootask-appstore-${APP_ID}"
privileged: true privileged: true
image: "kuaifan/dootask-appstore:0.0.1" image: "kuaifan/dootask-appstore:0.0.2"
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- ./:/var/www - ./:/var/www