feat(tor): add Tor endpoints for fiat-api and service-api (#2339)

This commit is contained in:
cyan 2025-06-27 14:05:54 +02:00 committed by GitHub
parent 1a5601f755
commit 73588071ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 8 deletions

View file

@ -5,8 +5,7 @@ import 'dart:convert';
import 'package:cake_wallet/.secrets.g.dart' as secrets;
const _fiatApiClearNetAuthority = 'fiat-api.cakewallet.com';
// const _fiatApiOnionAuthority = 'n4z7bdcmwk2oyddxvzaap3x2peqcplh3pzdy7tpkk5ejz5n4mhfvoxqd.onion';
const _fiatApiOnionAuthority = _fiatApiClearNetAuthority;
const _fiatApiOnionAuthority = 'kfkyguqtz5vcnbvar5pjgddkaeawbo4j3r4fj3e22k3tzqageplosiid.onion';
const _fiatApiPath = '/v2/rates';
Future<double> _fetchPrice(String crypto, String fiat, bool torOnly) async {

View file

@ -1123,13 +1123,18 @@ abstract class DashboardViewModelBase with Store {
Future<ServicesResponse> _getServicesStatus() async {
try {
if (isEnabledBulletinAction) {
final uri = Uri.https(
final res = await ProxyWrapper().get(
clearnetUri: Uri.https(
"service-api.cakewallet.com",
"/v1/active-notices",
{'key': secrets.fiatApiKey},
),
onionUri: Uri.http(
"jpirgl4lrwzjgdqj2nsv3g7twhp2efzty5d3cnypktyczzqfc5qcwwyd.onion",
"/v1/active-notices",
{'key': secrets.fiatApiKey},
),
);
final res = await ProxyWrapper().get(clearnetUri: uri);
if (res.statusCode < 200 || res.statusCode >= 300) {
throw res.body;
}