Migrate Laysense to upstream LaySite 1.4.3 with external site data
This commit is contained in:
@@ -8,11 +8,15 @@ use RuntimeException;
|
||||
|
||||
final class Assets
|
||||
{
|
||||
public const DEFAULT_ICON = '/assets/system/laysite-mark.webp';
|
||||
public const JQUERY = '/assets/jquery-4.0.0.min.js';
|
||||
public const TOAST_UI_EDITOR = '/assets/vendor/toastui/toastui-editor.min.js';
|
||||
|
||||
public static function cdn(string $value): string
|
||||
{
|
||||
$value = rtrim(trim($value), '/');
|
||||
if ($value !== '' && (strlen($value) > 263 || !preg_match('~^https://(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?::[0-9]{1,5})?$~iD', $value))) {
|
||||
throw new RuntimeException('请填写 HTTPS CDN 源站地址,例如 https://cdn.laysense.cn。');
|
||||
throw new RuntimeException('请填写 HTTPS CDN 源站地址,例如 https://cdn.example.com。');
|
||||
}
|
||||
if (($port = parse_url($value, PHP_URL_PORT)) !== null && ($port === false || $port < 1)) {
|
||||
throw new RuntimeException('CDN 端口无效。');
|
||||
|
||||
Reference in New Issue
Block a user