Skip to content

Commit

Permalink
add --no_customization --disable_api_server_forced
Browse files Browse the repository at this point in the history
  • Loading branch information
eltorio committed Apr 20, 2024
1 parent ec49a96 commit ee83754
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
23 changes: 18 additions & 5 deletions build-sctg.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,19 @@ def make_parser():
help='Build flutter package', default=False)
parser.add_argument('--debug', action='store_true',
help='Build flutter package with debug flag', default=False)
parser.add_argument('--no_customization', action='store_true',
help='Disable application customization', default=False)
parser.add_argument(
'--quic',
action='store_true',
help='Enable feature Quic'
)
API_SERVER = os.environ['API_SERVER']
parser.add_argument(
'--disable_api_server_forced',
action='store_true',
help=f'Disable API server forced to https://{API_SERVER}/'
)
parser.add_argument(
'--vram',
action='store_true',
Expand Down Expand Up @@ -481,9 +489,10 @@ def insert_line_after(file_path, search_string, new_line):
with open(file_path, 'w') as file:
file.writelines(lines)

def sctgdesk_customization():
def sctgdesk_customization(args):
MACOS_CODESIGN_IDENTITY = os.environ.get('MACOS_CODESIGN_IDENTITY')
APP_NAME = os.environ['APP_NAME']
APP_NAME_CAPITALIZED = APP_NAME.lower().capitalize()
RENDEZVOUS_SERVER = os.environ['RENDEZVOUS_SERVER']
RS_PUB_KEY = os.environ['RS_PUB_KEY']
API_SERVER = os.environ['API_SERVER']
Expand All @@ -494,7 +503,6 @@ def sctgdesk_customization():
if match:
TEAM_ID = match.group(1)
replace_in_file('flutter/ios/Runner.xcodeproj/project.pbxproj',"HZF9JMC8YN",TEAM_ID)
replace_in_file('flutter/web/client.html', '__API_SERVER__', f'https://{API_SERVER}')
replace_in_file('libs/hbb_common/src/config.rs', 'rs-ny.rustdesk.com', RENDEZVOUS_SERVER)
replace_in_file('libs/hbb_common/src/config.rs', 'OeVuKk5nlHiXp+APNn0Y3pC1Iwpwn44JGqrQCsWqmBw=', RS_PUB_KEY)
replace_in_file('flutter/web/js/src/connection.ts', 'const PORT = 21116', 'const PORT = 21118')
Expand Down Expand Up @@ -535,8 +543,12 @@ def sctgdesk_customization():
replace_in_all_typed_files('xcconfig', 'com.carriez', f'com.{ORG_NAME}'.lower())
replace_in_all_typed_files('desktop', 'RustDesk', f'{APP_NAME}')
replace_in_all_typed_files('service', 'RustDesk', f'{APP_NAME}')
insert_line_after('src/common.rs','pub fn get_api_server',f' return format!("https://{API_SERVER}");')
insert_line_after('flutter/web/js/src/globals.js','function getApiServer()',f' return "https://{API_SERVER}";')
replace_in_file('flutter/lib/models/platform_model.dart', 'RustdeskImpl', f'{APP_NAME_CAPITALIZED}Impl')
replace_in_file('flutter/lib/models/native_model.dart', 'RustdeskImpl', f'{APP_NAME_CAPITALIZED}Impl')
if not args.disable_api_server_forced:
replace_in_file('flutter/web/client.html', '__API_SERVER__', f'https://{API_SERVER}')
insert_line_after('src/common.rs','pub fn get_api_server',f' return format!("https://{API_SERVER}");')
insert_line_after('flutter/web/js/src/globals.js','function getApiServer()',f' return "https://{API_SERVER}";')

def build_ios_ipa(version, features):
MACOS_CODESIGN_IDENTITY = os.environ.get('MACOS_CODESIGN_IDENTITY')
Expand Down Expand Up @@ -652,7 +664,8 @@ def main():
web = args.web
if not flutter:
system2('python3 res/inline-sciter.py')
sctgdesk_customization()
if not args.no_customization:
sctgdesk_customization(args)
print(args.skip_cargo)
if args.skip_cargo:
skip_cargo = True
Expand Down
10 changes: 5 additions & 5 deletions flutter/lib/desktop/pages/desktop_setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ class _NetworkState extends State<_Network> with AutomaticKeepAliveClientMixin {
apiController, apiErrMsg.value, enabled, secure)),
_LabeledTextField(
context, 'Key', keyController, '', enabled, secure),
_OptionCheckBox(context, 'UDP mode', 'disable-udp-mode',
_OptionCheckBox(context, 'UDP mode', 'enable-tcp-mode',
enabled: enabled),
Row(
mainAxisAlignment: MainAxisAlignment.end,
Expand Down Expand Up @@ -1609,7 +1609,7 @@ class _AboutState extends State<_About> {
child: SingleChildScrollView(
controller: scrollController,
physics: DraggableNeverScrollableScrollPhysics(),
child: _Card(title: '${translate('About')} RustDesk', children: [
child: _Card(title: '${translate('About')} SCTGDesk', children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand All @@ -1627,15 +1627,15 @@ class _AboutState extends State<_About> {
.marginSymmetric(vertical: 4.0)),
InkWell(
onTap: () {
launchUrlString('https://rustdesk.com/privacy.html');
launchUrlString('https://sctg.eu.org/privacy.html');
},
child: Text(
translate('Privacy Statement'),
style: linkStyle,
).marginSymmetric(vertical: 4.0)),
InkWell(
onTap: () {
launchUrlString('https://rustdesk.com');
launchUrlString('https://sctg.eu.org');
},
child: Text(
translate('Website'),
Expand All @@ -1653,7 +1653,7 @@ class _AboutState extends State<_About> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Copyright © ${DateTime.now().toString().substring(0, 4)} Purslane Ltd.\n$license',
'Copyright © ${DateTime.now().toString().substring(0, 4)} Sctg and Purslane Ltd.\n$license',
style: const TextStyle(color: Colors.white),
),
Text(
Expand Down
4 changes: 2 additions & 2 deletions src/rendezvous_mediator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ impl RendezvousMediator {
}

pub fn is_udp_disabled() -> bool {
let option_tcp = Config::get_option("disable-udp-mode");
log::debug!("disable-udp-mode: {}", option_tcp);
let option_tcp = Config::get_option("enable-tcp-mode");
log::debug!("enable-tcp-mode: {}", option_tcp);
if option_tcp == "N"{
return true;
}else{
Expand Down

0 comments on commit ee83754

Please sign in to comment.