CH-J SM MobilePalvelimen hallinta yli SSH
Valikko
Julkaistu lähde

CH-J SM Mobile

Selaile hakemistoja ja tiedostoja tietyn sovelluksen julkaisua varten.

Lataa lähde ZIP
CH-J / SM Mobile 134 tiedostot
sm-mobile-20261016T050549Z-3678f2a05fa9 Lisätty: · Rakennettu:
Tiedostot
profile_transfer.dart Lisätty: Kirjaamaton päivä 1,2 KB · 40 rivit
Lataa tiedosto
1import 'dart:convert';
2import '../core/failure.dart';
3import '../models/server_profile.dart';
5class ProfileTransfer {
6 static const maxBytes = 5 * 1024 * 1024;
7 static List<ServerProfile> decode(List<int> bytes) {
8 if (bytes.length > maxBytes) throw const Failure('invalidImport');
9 try {
10 final text = utf8.decode(bytes).replaceFirst(RegExp(r'^\uFEFF'), '');
11 final data = jsonDecode(text);
12 if (data is! Map ||
13 data['format'] != 'chj-server-profiles' ||
14 data['version'] != 1 ||
15 data['servers'] is! List ||
16 data['servers'].isEmpty ||
17 data['servers'].length > 10000) {
18 throw const Failure('invalidImport');
19 }
20 return (data['servers'] as List)
21 .map(
22 (e) => ServerProfile.fromJson(
23 Map<String, dynamic>.from(e),
24 portable: true,
25 ),
26 )
27 .toList();
28 } catch (_) {
29 throw const Failure('invalidImport');
30 }
31 }
33 static List<int> encode(List<ServerProfile> profiles) => utf8.encode(
34 const JsonEncoder.withIndent(' ').convert({
35 'format': 'chj-server-profiles',
36 'version': 1,
37 'servers': profiles.map((p) => p.portable()).toList(),
38 }),
39 );
SHA-2569d6b8526a0dabf2e6524e9ddf9a0ed29048131d73d927d0e3262a5e596f93b9a

CH-J Proprietary Software License 1.14 · Lähde ilmoitetaan CH-J Proprietary Software License 1.14-koodilla. Sen saatavuus ei muuta lisenssiehtoja eikä myönnä lisäoikeuksia.

Arkisto SHA-256c486a807e4828998b9c57ab0f2e760f7980b31965fe118e89d3e1a5a2b65be65