ce76bb8018
- 删除 design1 ui 遗留代码,修复加载竞态与新建不弹保存提示 - cloud-files 归一化旧版 .soon,IndexedDB 写入完成后再跳转设计页 - 模板/本地 .soon 首次保存须另存为,离开前统一确认 - 发版缓存 bust(version.js、soon-cache.js)及宝塔 Nginx 配置文档 Co-authored-by: Cursor <cursoragent@cursor.com>
75 lines
2.8 KiB
PowerShell
75 lines
2.8 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
|
|
|
|
$localJs = @"
|
|
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',
|
|
'templates_dir' => '/var/www/storage/templates',
|
|
],
|
|
'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 'local.js'), $localJs.Trim() + "`n", $enc)
|
|
[IO.File]::WriteAllText((Join-Path $dir 'local.php'), $localPhp.Trim() + "`n", $enc)
|
|
|
|
$webLocal = Join-Path $Root 'frontend-web\config\local.js'
|
|
New-Item -ItemType Directory -Force -Path (Split-Path $webLocal -Parent) | Out-Null
|
|
[IO.File]::WriteAllText($webLocal, $localJs.Trim() + "`n", $enc)
|
|
|
|
& (Join-Path $Root 'scripts\write-web-version.ps1') | Out-Null
|