feat: add flagged remote user icon upload
This commit is contained in:
@@ -212,6 +212,9 @@ $result = Util::generateFileUsingSimpleTemplate(
|
||||
'gameImagePath' => $gameImagePath,
|
||||
'imageRequestPath' => $imageRequestPath,
|
||||
'imageRequestKey' => $imageRequestKey,
|
||||
'remoteUserIconUploadEnabled' => 'false',
|
||||
'remoteUserIconUploadPath' => 'https://sam-image.hided.net',
|
||||
'remoteUserIconUploadSecretFile' => 'd_setting/image_upload_core_secret',
|
||||
'serverList' => [
|
||||
['che', '체', 'white'],
|
||||
['kwe', '퀘', 'yellow'],
|
||||
|
||||
@@ -33,7 +33,12 @@ if ($servHost) {
|
||||
[
|
||||
'serverBasePath' => $servHost,
|
||||
'sharedIconPath' => $sharedIconPath,
|
||||
'gameImagePath' => $gameImagePath
|
||||
'gameImagePath' => $gameImagePath,
|
||||
'imageRequestPath' => ServConfig::$imageRequestPath,
|
||||
'imageRequestKey' => ServConfig::$imageRequestKey,
|
||||
'remoteUserIconUploadEnabled' => ServConfig::$remoteUserIconUploadEnabled ? 'true' : 'false',
|
||||
'remoteUserIconUploadPath' => ServConfig::$remoteUserIconUploadPath,
|
||||
'remoteUserIconUploadSecretFile' => ServConfig::$remoteUserIconUploadSecretFile
|
||||
],
|
||||
true
|
||||
);
|
||||
@@ -64,7 +69,12 @@ if ($servHost) {
|
||||
[
|
||||
'serverBasePath' => $servHost,
|
||||
'sharedIconPath' => $sharedIconPath,
|
||||
'gameImagePath' => $gameImagePath
|
||||
'gameImagePath' => $gameImagePath,
|
||||
'imageRequestPath' => ServConfig::$imageRequestPath,
|
||||
'imageRequestKey' => ServConfig::$imageRequestKey,
|
||||
'remoteUserIconUploadEnabled' => ServConfig::$remoteUserIconUploadEnabled ? 'true' : 'false',
|
||||
'remoteUserIconUploadPath' => ServConfig::$remoteUserIconUploadPath,
|
||||
'remoteUserIconUploadSecretFile' => ServConfig::$remoteUserIconUploadSecretFile
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
@@ -13,6 +13,9 @@ class ServConfig
|
||||
public static $gameImagePath = "_tK_gameImagePath_";
|
||||
public static $imageRequestPath = "_tK_imageRequestPath_";
|
||||
public static $imageRequestKey = '_tK_imageRequestKey_';
|
||||
public static $remoteUserIconUploadEnabled = _tK_remoteUserIconUploadEnabled_;
|
||||
public static $remoteUserIconUploadPath = '_tK_remoteUserIconUploadPath_';
|
||||
public static $remoteUserIconUploadSecretFile = '_tK_remoteUserIconUploadSecretFile_';
|
||||
private static $serverList = null;
|
||||
|
||||
public static function getSharedIconPath(string $filepath = ''): string
|
||||
@@ -41,6 +44,32 @@ class ServConfig
|
||||
return static::$imageRequestPath;
|
||||
}
|
||||
|
||||
public static function isRemoteUserIconUploadEnabled(): bool
|
||||
{
|
||||
return static::$remoteUserIconUploadEnabled;
|
||||
}
|
||||
|
||||
public static function getRemoteUserIconUploadURI(string $filename): string
|
||||
{
|
||||
return rtrim(static::$remoteUserIconUploadPath, '/') . '/v1/uploads/user-icons/core/' . $filename;
|
||||
}
|
||||
|
||||
public static function getRemoteUserIconUploadSecret(): string
|
||||
{
|
||||
$path = static::$remoteUserIconUploadSecretFile;
|
||||
if ($path === '' || str_contains($path, "\0")) {
|
||||
throw new \RuntimeException('Remote user icon upload secret file is not configured');
|
||||
}
|
||||
if ($path[0] !== '/') {
|
||||
$path = ROOT . '/' . $path;
|
||||
}
|
||||
$secret = trim((string)file_get_contents($path));
|
||||
if (strlen($secret) < 32) {
|
||||
throw new \RuntimeException('Remote user icon upload secret must be at least 32 characters');
|
||||
}
|
||||
return $secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버 설정 반환
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user