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

This commit is contained in:
Czarek Nakamoto 2025-06-27 10:04:05 +02:00
parent 1a5601f755
commit a63374669c
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; import 'package:cake_wallet/.secrets.g.dart' as secrets;
const _fiatApiClearNetAuthority = 'fiat-api.cakewallet.com'; const _fiatApiClearNetAuthority = 'fiat-api.cakewallet.com';
// const _fiatApiOnionAuthority = 'n4z7bdcmwk2oyddxvzaap3x2peqcplh3pzdy7tpkk5ejz5n4mhfvoxqd.onion'; const _fiatApiOnionAuthority = 'kfkyguqtz5vcnbvar5pjgddkaeawbo4j3r4fj3e22k3tzqageplosiid.onion';
const _fiatApiOnionAuthority = _fiatApiClearNetAuthority;
const _fiatApiPath = '/v2/rates'; const _fiatApiPath = '/v2/rates';
Future<double> _fetchPrice(String crypto, String fiat, bool torOnly) async { 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 { Future<ServicesResponse> _getServicesStatus() async {
try { try {
if (isEnabledBulletinAction) { if (isEnabledBulletinAction) {
final uri = Uri.https( final res = await ProxyWrapper().get(
"service-api.cakewallet.com", clearnetUri: Uri.https(
"/v1/active-notices", "service-api.cakewallet.com",
{'key': secrets.fiatApiKey}, "/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) { if (res.statusCode < 200 || res.statusCode >= 300) {
throw res.body; throw res.body;
} }