更新
This commit is contained in:
@@ -120,14 +120,27 @@ class DesktopWorkstationValidate extends BaseValidate
|
||||
unset($data);
|
||||
$url = trim((string) ($row['url'] ?? ''));
|
||||
$sha256 = strtolower(trim((string) ($row['sha256'] ?? '')));
|
||||
$filename = trim((string) ($row['filename'] ?? ''));
|
||||
$size = $row['size'] ?? 0;
|
||||
$filename = trim((string) ($row['filename'] ?? ''));
|
||||
$type = strtolower(trim((string) ($row['type'] ?? 'archive')));
|
||||
$size = $row['size'] ?? 0;
|
||||
$labels = [
|
||||
'windows_x64' => 'Windows 64 位',
|
||||
'macos_arm64' => 'macOS Apple 芯片',
|
||||
'macos_x64' => 'macOS Intel',
|
||||
];
|
||||
$label = $labels[$key] ?? $key;
|
||||
$label = $labels[$key] ?? $key;
|
||||
if (!in_array($type, DesktopWorkstationLogic::PACKAGE_TYPES, true)) {
|
||||
return $label . '安装包类型不受支持';
|
||||
}
|
||||
if ($type === 'inno_setup' && $key !== 'windows_x64') {
|
||||
return $label . '不能使用 Windows Inno Setup 安装包';
|
||||
}
|
||||
if ($type === 'inno_setup' && $filename !== '' && !str_ends_with(strtolower($filename), '.exe')) {
|
||||
return $label . ' Inno Setup 文件名必须以 .exe 结尾';
|
||||
}
|
||||
if ($type === 'inno_setup' && preg_match('#^http://#i', $url)) {
|
||||
return $label . '自动安装程序必须使用 HTTPS 下载地址';
|
||||
}
|
||||
if ($url !== '' && !$this->isAllowedPackageUrl($url)) {
|
||||
return $label . '安装包地址必须是 http(s) 链接或站内 uploads 路径';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user