CH-J Tools MobileSSH를 통한 서버 관리
메뉴
공개된 소스

CH-J Tools Mobile

특정 애플리케이션 릴리스의 디렉터리와 파일을 살펴보세요.

소스 ZIP 다운로드
CH-J / CH-J Tools Mobile 175 개 파일
sm-mobile-20261016T185235Z-8e93ecc1b59a 추가됨: · 빌드됨:
profile_transfer.dart 추가됨: 날짜 기록 없음 1.2 KB · 40 줄
코드 파일 다운로드
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 · 소스는 CH-J Proprietary Software License 1.14에 따라 제공됩니다. 소스를 공개한다고 해서 라이선스 조항이 바뀌거나 추가 권리가 부여되지는 않습니다.

압축 파일 SHA-25646e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655
파일