Update front and config

This commit is contained in:
2025-07-29 03:02:33 +07:00
parent 09e2c704ef
commit 36cb672ce4
7 changed files with 5629 additions and 10 deletions

View File

@@ -39,5 +39,7 @@
"AllowedHosts": "*",
"WorkerBotManager": true,
"WorkerBalancesTracking": false,
"WorkerNotifyBundleBacktest": true
"WorkerNotifyBundleBacktest": true,
"KAIGEN_SECRET_KEY": "KaigenXCowchain",
"KAIGEN_CREDITS_ENABLED": true
}

View File

@@ -12,7 +12,7 @@
"AppSecret": "63Chz2z5M8TgR5qc8dznSLRAGTHTyPU4cjdQobrBF1Cx5tszZpTuFgyrRd7hZ2k6HpwDz3GEwQZzsCqHb8Z311bF"
},
"Kaigen": {
"BaseUrl": "https://kaigen-back-development.up.railway.app/",
"BaseUrl": "https://kaigen-back-development.up.railway.app",
"DebitEndpoint": "/api/credits/debit",
"RefundEndpoint": "/api/credits/refund"
},

View File

@@ -24,7 +24,7 @@
"BaseUrl": "http://localhost:4111"
},
"Kaigen": {
"BaseUrl": "https://api.kaigen.managing.live",
"BaseUrl": "https://kaigen-back-development.up.railway.app",
"DebitEndpoint": "/api/credits/debit",
"RefundEndpoint": "/api/credits/refund"
},

View File

@@ -92,7 +92,6 @@ public class KaigenService : IKaigenService
var requestPayload = new
{
requestId = requestId,
walletAddress = walletAddress,
debitAmount = debitAmount
};
@@ -114,6 +113,13 @@ public class KaigenService : IKaigenService
}
var result = await response.Content.ReadFromJsonAsync<KaigenResponse>(_jsonOptions);
if (result == null || !result.Success)
{
_logger.LogError("Debit request failed: {Message}", result?.Message ?? "Unknown error");
throw new Exception($"Debit request failed: {result?.Message}");
}
_logger.LogInformation(
"Successfully debited {Amount} credits for user {UserName} (wallet: {WalletAddress})",
debitAmount, user.Name, walletAddress);
@@ -145,7 +151,6 @@ public class KaigenService : IKaigenService
var requestPayload = new
{
requestId = requestId,
walletAddress = walletAddress
};
_logger.LogInformation(
@@ -180,21 +185,21 @@ public class KaigenService : IKaigenService
{
// Create the auth token: "walletaddress-username"
var authToken = $"{GetUserWalletAddress(user)}-{user.Name}";
// Encrypt the auth token using AES-256-GCM
var encryptedToken = CryptoHelpers.EncryptAesGcm(authToken, _settings.SecretKey);
// Create Basic Auth header with the encrypted token
var basicAuthString = $"{encryptedToken}:";
var base64Auth = Convert.ToBase64String(Encoding.ASCII.GetBytes(basicAuthString));
// Create a new request with the auth header
var request = new HttpRequestMessage(HttpMethod.Put, url)
{
Content = JsonContent.Create(payload, options: _jsonOptions)
};
request.Headers.Authorization = new AuthenticationHeaderValue("Basic", base64Auth);
return await _httpClient.SendAsync(request);
}

View File

@@ -111,7 +111,6 @@ const LogIn = () => {
<input
className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
{...register('name')}
disabled={true}
></input>
</div>
<button

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff