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()
{
// 用户权限验证
$authorization = Base::leftDelete(Request::header("Authorization"), "Bearer ");
if ($authorization != md5(env('APP_KEY'))) {
return 'Authorization error';
}
// 获取参数
$appName = Request::input('app_name');
$status = Request::input('status');

View File

@ -533,20 +533,21 @@ class Apps
$readmePatterns = [
"/^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
}
if ($lang == 'zh-CHT') {
if ($lang == 'ZH-CHT') {
$readmePatterns[] = "/^README(_|-|\.)?TW\.md$/i"; // README_TW.md, README-tw.md, README.tw.md
}
$readmePatterns[] = "/^README\.md$/i"; // README.md
foreach ($files as $filePath) {
$fileName = basename($filePath);
// 检查是否为文件且匹配 README 模式
if (is_file($filePath) && self::matchReadmePattern($fileName, $readmePatterns)) {
return file_get_contents($filePath);
// 遍历所有 README 模式进行匹配
foreach ($readmePatterns as $pattern) {
foreach ($files as $filePath) {
$fileName = basename($filePath);
if (preg_match($pattern, $fileName)) {
return file_get_contents($filePath);
}
}
}
@ -823,7 +824,7 @@ class Apps
$url = "http://nginx/appstore/api/{$path}";
$extra = [
'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
}
down_by_network() {
remove_by_network() {
local app_id=$(env_get APP_ID)
local network_name="dootask-networks-${app_id}"
for container_id in $(docker ps -q --filter network="$network_name"); do
@ -237,6 +237,10 @@ down_by_network() {
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() {
restart_nginx="n"
if [[ "$(env_get APP_PORT)" != "80" ]]; then
@ -467,7 +471,8 @@ if [ $# -gt 0 ]; then
exit 2
;;
esac
down_by_network
remove_by_network
uninstall_appstore
$COMPOSE down --remove-orphans
env_set APP_DEBUG "false"
rm -rf "./docker/mysql/data"
@ -597,12 +602,12 @@ if [ $# -gt 0 ]; then
$COMPOSE start "$@"
elif [[ "$1" == "reup" ]]; then
shift 1
down_by_network
remove_by_network
$COMPOSE down --remove-orphans
$COMPOSE up -d
elif [[ "$1" == "down" ]]; then
shift 1
down_by_network
remove_by_network
if [[ $# -eq 0 ]]; then
$COMPOSE down --remove-orphans
else

View File

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