feat: Offline version supports creating PHP (#10585)

This commit is contained in:
CityFun 2025-10-09 14:51:24 +08:00 committed by GitHub
parent e7b1aadb0e
commit f977a2488d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 23 deletions

View file

@ -40,6 +40,7 @@ type SystemDir struct {
LocalAppInstallDir string
RemoteAppResourceDir string
CustomAppResourceDir string
OfflineAppResourceDir string
RuntimeDir string
RecycleBinDir string
SSLLogDir string

View file

@ -27,6 +27,7 @@ func Init() {
global.Dir.LocalAppInstallDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/apps/local"))
global.Dir.RemoteAppResourceDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/resource/apps/remote"))
global.Dir.CustomAppResourceDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/resource/apps/custom"))
global.Dir.OfflineAppResourceDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/resource/offline"))
global.Dir.RuntimeDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/runtime"))
global.Dir.RecycleBinDir, _ = fileOp.CreateDirWithPath(true, "/.1panel_clash")
global.Dir.SSLLogDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/log/ssl"))

View file

@ -24,7 +24,7 @@
v-model="runtime.resource"
@change="changeResource(runtime.resource)"
>
<el-radio :value="'appstore'">
<el-radio :value="'appstore'" v-if="!globalStore.isOffLine">
{{ $t('menu.apps') }}
</el-radio>
<el-radio :value="'local'">
@ -195,9 +195,9 @@ import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message';
import { FormInstance } from 'element-plus';
import { reactive, ref } from 'vue';
import { GlobalStore } from '@/store';
import { getLabel } from '@/utils/util';
const globalStore = GlobalStore();
import { useGlobalStore } from '@/composables/useGlobalStore';
const { globalStore } = useGlobalStore();
interface OperateRrops {
id?: number;
@ -472,7 +472,11 @@ const acceptParams = async (props: OperateRrops) => {
initParam.value = false;
if (props.mode === 'create') {
Object.assign(runtime, initData(props.type));
if (globalStore.isOffLine) {
runtime.resource = 'local';
} else {
searchAppList(null);
}
} else {
searchAppList(props.appID);
getRuntime(props.id);

View file

@ -153,9 +153,8 @@ import { disabledButton } from '@/utils/runtime';
import DockerStatus from '@/views/container/docker-status/index.vue';
import { operateRuntime, updateRuntimeRemark } from '../common/utils';
import { routerToFileWithPath } from '@/utils/router';
import { MsgWarning } from '@/utils/message';
import { useGlobalStore } from '@/composables/useGlobalStore';
const { globalStore, isOffLine } = useGlobalStore();
const { globalStore } = useGlobalStore();
const mobile = computed(() => {
return globalStore.isMobile();
@ -286,10 +285,6 @@ const search = async () => {
};
const openCreate = () => {
if (isOffLine.value) {
MsgWarning(i18n.global.t('commons.msg.offlineTips'));
return;
}
createRef.value.acceptParams({ type: 'php', mode: 'create' });
};