88c6ce8ccc
- 迁移为 frontend-web、frontend-electron、backend-web 与 docker 部署结构 - 网页端:订阅门禁二次弹窗、套餐/支付组件化、顶栏分组对齐 - 首页:最近文件与模板库布局优化,缩略图对齐,下载与删除操作 - 新增管理后台、支付与云端文件 API,更新 README 与项目规范 Co-authored-by: Cursor <cursoragent@cursor.com>
71 lines
2.6 KiB
PowerShell
71 lines
2.6 KiB
PowerShell
param([string]$EnvFile = "$PSScriptRoot\.env", [string]$Root = (Split-Path $PSScriptRoot -Parent))
|
|
|
|
if (-not (Test-Path $EnvFile)) { Copy-Item "$PSScriptRoot\.env.example" $EnvFile }
|
|
|
|
$ports = @{ WEB_PORT = '8100'; ELECTRON_PORT = '8101'; BACKEND_PORT = '8102' }
|
|
Get-Content $EnvFile -Encoding UTF8 | ForEach-Object {
|
|
if ($_ -match '^\s*(WEB_PORT|ELECTRON_PORT|BACKEND_PORT)\s*=\s*(\d+)') { $ports[$matches[1]] = $matches[2] }
|
|
}
|
|
$w, $e, $b = $ports.WEB_PORT, $ports.ELECTRON_PORT, $ports.BACKEND_PORT
|
|
|
|
$deployJs = @"
|
|
window.SOON_DEPLOY_CONFIG = {
|
|
api_v1_base: 'http://localhost:$b/api/v1',
|
|
api_admin_base: 'http://localhost:$b/api/admin',
|
|
front_base_url: 'http://localhost:$w',
|
|
web_base: 'http://localhost:$w',
|
|
version: 'local-dev'
|
|
};
|
|
"@
|
|
|
|
$localPhp = @"
|
|
<?php
|
|
return [
|
|
'app' => [
|
|
'env' => 'development',
|
|
'debug' => true,
|
|
'timezone' => 'Asia/Shanghai',
|
|
'jwt_secret' => 'local-dev-jwt-secret-minimum-32-chars',
|
|
'jwt_ttl' => 3600,
|
|
'jwt_refresh_ttl' => 2592000,
|
|
'cors_origins' => [
|
|
'http://localhost:$w', 'http://127.0.0.1:$w',
|
|
'http://localhost:$e', 'http://127.0.0.1:$e',
|
|
],
|
|
],
|
|
'db' => [
|
|
'host' => 'mysql', 'port' => 3306, 'name' => 'soondesign',
|
|
'user' => 'soondesign', 'pass' => 'soondesign', 'charset' => 'utf8mb4',
|
|
],
|
|
'site' => [
|
|
'base_url' => 'http://localhost:$b',
|
|
'front_base_url' => 'http://localhost:$w',
|
|
],
|
|
'storage' => [
|
|
'users_dir' => '/var/www/storage/users',
|
|
'models_dir' => '/var/soonModels',
|
|
],
|
|
'limits' => ['free_quota_mb' => 20, 'preview_require_membership' => false],
|
|
'rate_limits' => [
|
|
'admin/*' => ['capacity' => 120, 'window' => 60],
|
|
'POST /api/v1/auth/login' => ['capacity' => 10, 'window' => 60],
|
|
'POST /api/v1/auth/register' => ['capacity' => 5, 'window' => 60],
|
|
'POST /api/v1/files' => ['capacity' => 30, 'window' => 60],
|
|
],
|
|
'alipay' => ['app_id' => '', 'private_key' => '', 'public_key' => '', 'sandbox' => true],
|
|
'wechat' => [
|
|
'app_id' => '', 'mch_id' => '', 'mch_serial_no' => '',
|
|
'mch_private_key' => '', 'api_v3_key' => '', 'sandbox' => true,
|
|
],
|
|
];
|
|
"@
|
|
|
|
$dir = Join-Path $PSScriptRoot 'config'
|
|
New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
|
$enc = [Text.UTF8Encoding]::new($false)
|
|
[IO.File]::WriteAllText((Join-Path $dir 'deploy-config.js'), $deployJs.Trim() + "`n", $enc)
|
|
[IO.File]::WriteAllText((Join-Path $dir 'local.php'), $localPhp.Trim() + "`n", $enc)
|
|
|
|
$webDeploy = Join-Path $Root 'frontend-web\assets\deploy-config.js'
|
|
[IO.File]::WriteAllText($webDeploy, $deployJs.Trim() + "`n", $enc)
|