Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/windows-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Windows Release

on:
push:
tags:
- "v1.0.0"
branches:
- dev

jobs:
build:
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.0'
flutter-version: '3.27.3'
channel: 'stable'
cache: true

Expand All @@ -31,7 +31,7 @@ jobs:
- name: Create ZIP archive
run: |
cd build/windows/x64/runner
Compress-Archive -Path Release/* -DestinationPath ../../../Begzar-Windows.zip
Compress-Archive -Path Release/* -DestinationPath ../../../Begzar-Windows-x64.zip

- name: Create Release
uses: softprops/action-gh-release@v1
Expand All @@ -40,5 +40,6 @@ jobs:
draft: false
prerelease: false
generate_release_notes: true
tag_name: v1.0.${{ github.run_number }}-beta
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
45 changes: 0 additions & 45 deletions .vscode/launch.json

This file was deleted.

3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion Bcore/lib/sing/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class V2raySingParser {
throw V2rayParserError;
}
final raw = (res.stdout as String);
final json = jsonDecode(raw);
final json = jsonDecode(raw.replaceAll("tcp", 'http')); // just a litte issue in sing-parser (i lost the source code for sing-parser so i guess its the only way ...)
return Map<String, dynamic>.from(json);
}

Expand Down
4 changes: 2 additions & 2 deletions Bcore/windows/resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ go build -tags "with_utls,with_clash_api,with_gvisor" -ldflags "-X 'github.com/s

=====

// for ARM windows ( new surface & ... )
// for ARM windows ( new microsoft surface & ... )
$Env:GOOS="windows"
$Env:GOARCH="arm64"

go build -tags "with_utls,with_clash_api,with_gvisor" -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=1.10.1'" ./cmd/sing-box
```
Fuck all of your documentions...
Fuck all of sing-box & xray docs...
Binary file modified cache.db
Binary file not shown.
137 changes: 63 additions & 74 deletions lib/screens/home_screens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:begzar_windows/common/http_client.dart';
import 'package:begzar_windows/widgets/connection_widgets.dart';
import 'package:begzar_windows/widgets/logs_widget.dart';
import 'package:begzar_windows/widgets/server_selection_modal_widget.dart';
import 'package:begzar_windows/widgets/vpn_status.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
Expand All @@ -26,6 +25,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:begzar_windows/common/settings_manager.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';


class HomePage extends StatefulWidget {
final ValueNotifier<SingStatus> mainSingStatus;
final ValueNotifier<String> logsNotifier;
Expand Down Expand Up @@ -332,20 +332,7 @@ class _HomePageState extends State<HomePage> {
);
}

Widget _buildVpnStatus(double contentWidth) {
return Container(
width: contentWidth,
child: VpnCard(
downloadSpeed: singStatus.value.download.toInt(),
uploadSpeed: singStatus.value.upload.toInt(),
download: singStatus.value.downloadSpeed.toInt(),
upload: singStatus.value.uploadSpeed.toInt(),
selectedServer: selectedServer,
selectedServerLogo: selectedServerLogo ?? 'assets/images/auto.png',
duration: singStatus.value.duration,
),
);
}


void _handleConnectionTap(SingStatus value) async {
if (value.state == "DISCONNECTED") {
Expand Down Expand Up @@ -516,14 +503,14 @@ class _HomePageState extends State<HomePage> {
}

String decrypt(String secureData, String x1, String x2, String key) {
final encryptedData = {
'ciphertext': secureData, // secure
'nonce': x1, // x1
'tag': x2 // x2
};
final savedKey = key;
final encryptedData = {
'ciphertext': secureData, // secure
'nonce': x1, // x1
'tag': x2 // x2
};
final savedKey = key;
try {
final decrypted = Decryptor.decryptChaCha20(encryptedData, savedKey);
final decrypted = Decryptor.decryptChaCha20(encryptedData, savedKey);
return decrypted.toString();
} catch (e) {
return 'Error during decryption: $e';
Expand All @@ -532,18 +519,18 @@ class _HomePageState extends State<HomePage> {

Future<void> getDomain() async {
try {
singStatus.value = SingStatus(
state: 'CONNECTING',
duration: "00:00:00",
uploadSpeed: 0,
downloadSpeed: 0,
upload: 0,
download: 0);

singStatus.value = SingStatus(
state: 'CONNECTING',
duration: "00:00:00",
uploadSpeed: 0,
downloadSpeed: 0,
upload: 0,
download: 0);
setState(() {
isLoading = true;
});
final response = await httpClient.get('/');
final response = await httpClient.get('/');
domainName = response.data;
checkUpdate();
} catch (e) {
Expand All @@ -564,38 +551,39 @@ class _HomePageState extends State<HomePage> {
try {
//final serverParam = getServerParam();
String userKey = await storage.read(key: 'user') ?? '';
if (userKey == '') {
final response = await Dio().get(
"https://$domainName/api/firebase/init/android"); // change latar
if(userKey == ''){
final response = await Dio().get("https://$domainName/api/firebase/init/android"); // change latar
final dataJson = response.data as Map<String, dynamic>;
final key = dataJson['key'];
userKey = key;
await storage.write(key: 'user', value: key);
} else {
}else{
userKey = await storage.read(key: 'user') ?? '';
}
}

final response = await Dio().get(
"https://$domainName/api/firebase/init/data/$userKey"); // change latar

final response = await Dio().get("https://$domainName/api/firebase/init/data/$userKey"); // change latar
final dataJson = response.data as Map<String, dynamic>;
if (dataJson['status'] == true) {
if(dataJson['status'] == true){
final secureData = dataJson['data']['secure'];
final x1 = dataJson['data']['x1'];
final x2 = dataJson['data']['x2'];

final serverEncode = decrypt(secureData, x1, x2, userKey);

final List<String> serverList = await fetchServers(serverEncode);
print(serverList);
await connect(serverList);
} else {
}else{
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(dataJson['error'].toString()),
content:
Text(dataJson['error'].toString()),
),
);
}


// final data_base64 = utf8.decode(base64.decode(response.data));

// final decode_json = jsonDecode(data_base64);
Expand Down Expand Up @@ -633,37 +621,37 @@ class _HomePageState extends State<HomePage> {
// }
// }

// if (updateUrl.isNotEmpty) {
// AwesomeDialog(
// context: context,
// dialogType: DialogType.warning,
// animType: AnimType.rightSlide,
// title: 'آپدیت جدید',
// desc: 'برای دانلود ورژن جدید روی دکمه دانلود کلیک کنید',
// dialogBackgroundColor: Colors.white,
// btnCancelOnPress: () {},
// btnOkOnPress: () async {
// await launchUrl(Uri.parse(utf8.decode(base64Decode(updateUrl))),
// mode: LaunchMode.externalApplication);
// },
// btnOkText: 'دانلود',
// btnCancelText: 'بستن',
// buttonsTextStyle:
// TextStyle(fontFamily: 'sm', color: Colors.white, fontSize: 14),
// titleTextStyle:
// TextStyle(fontFamily: 'sb', color: Colors.black, fontSize: 16),
// descTextStyle:
// TextStyle(fontFamily: 'sm', color: Colors.black, fontSize: 14),
// ).show();
// } else {
// if (mounted) {
// ScaffoldMessenger.of(context).showSnackBar(
// const SnackBar(
// content: Text('نسخه ی مجاز پدیت برای گوشی شما یافت نشد !'),
// ),
// );
// }
// }
// if (updateUrl.isNotEmpty) {
// AwesomeDialog(
// context: context,
// dialogType: DialogType.warning,
// animType: AnimType.rightSlide,
// title: 'آپدیت جدید',
// desc: 'برای دانلود ورژن جدید روی دکمه دانلود کلیک کنید',
// dialogBackgroundColor: Colors.white,
// btnCancelOnPress: () {},
// btnOkOnPress: () async {
// await launchUrl(Uri.parse(utf8.decode(base64Decode(updateUrl))),
// mode: LaunchMode.externalApplication);
// },
// btnOkText: 'دانلود',
// btnCancelText: 'بستن',
// buttonsTextStyle:
// TextStyle(fontFamily: 'sm', color: Colors.white, fontSize: 14),
// titleTextStyle:
// TextStyle(fontFamily: 'sb', color: Colors.black, fontSize: 16),
// descTextStyle:
// TextStyle(fontFamily: 'sm', color: Colors.black, fontSize: 14),
// ).show();
// } else {
// if (mounted) {
// ScaffoldMessenger.of(context).showSnackBar(
// const SnackBar(
// content: Text('نسخه ی مجاز پدیت برای گوشی شما یافت نشد !'),
// ),
// );
// }
// }
// }
} catch (e) {
print(e.toString());
Expand All @@ -684,7 +672,8 @@ class _HomePageState extends State<HomePage> {

Future<List<String>> fetchServers(String serverEncode) async {
try {
final List<String> serverList = LineSplitter.split(serverEncode).toList();
final List<String> serverList =
LineSplitter.split(serverEncode).toList();
return serverList;
} catch (e) {
if (mounted) {
Expand Down
5 changes: 2 additions & 3 deletions lib/widgets/navigation_rail_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ class _NavigationRailWidgetState extends State<NavigationRailWidget> {
ip!,
style: TextStyle(
color: Colors.grey[300],
fontFamily:
context.locale.languageCode == 'fa' ? 'sm' : 'GB',
fontFamily: context.locale.languageCode == 'fa' ? 'sm' : 'GB',
fontSize: 12,
),
),
Expand Down Expand Up @@ -237,7 +236,7 @@ class _NavigationRailWidgetState extends State<NavigationRailWidget> {
children: [
const SizedBox(height: 64),
if (isExtraWideScreen) ...[
_buildConnectionInfo(isExtraWideScreen),
_buildConnectionInfo(isExtraWideScreen),
],
const Spacer(),
_buildNavItems(isExtraWideScreen),
Expand Down
Loading