CH-J SM Mobilegestión de servidores a través de SSH
Menú
Fuente publicada

CH-J SM Mobile

Busque directorios y archivos para obtener una versión de aplicación específica.

Descargar fuente ZIP
CH-J / SM Mobile 134 archivos
sm-mobile-20261016T050549Z-3678f2a05fa9 Añadido: · Construido:
Archivos
profile_transfer.dart Añadido: Fecha no registrada 1,2 KB · 40 líneas
Descargar archivo
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 · La fuente se proporciona en el CH-J Proprietary Software License 1.14. Su disponibilidad no cambia los términos de la licencia ni otorga derechos adicionales.

Archivo SHA-256c486a807e4828998b9c57ab0f2e760f7980b31965fe118e89d3e1a5a2b65be65