Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/fix voltron remote server url parse #3722

Closed
Closed
Show file tree
Hide file tree
Changes from 5 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
8 changes: 8 additions & 0 deletions framework/voltron/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.0.39

- resolve remoteServerUrl connect without '/'

## 0.0.38

- resolve remoteServerUrl parse version id failed

## 0.0.37

- resolve merge conflicts
Expand Down
8 changes: 3 additions & 5 deletions framework/voltron/lib/inspector/dev_remote_server_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ class DevRemoteServerData {
_wsUrl = url.queryParameters['debugUrl'];
var tempPath = _path;
if (tempPath != null && tempPath.startsWith("/")) {
if (tempPath.startsWith("/")) {
_path = tempPath.substring(1); // remove first character /
}
int index = tempPath.indexOf("/");
_path = tempPath.substring(1); // remove first character /
int index = _path?.indexOf("/") ?? -1;
if (index >= 0) {
_versionId = tempPath.substring(0, index);
_versionId = _path?.substring(0, index);
}
}
LogUtils.i(
Expand Down
2 changes: 1 addition & 1 deletion framework/voltron/lib/inspector/dev_server_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DevServerHelper {
bool jsMinify,
) {
if (_remoteServerData.isValid()) {
return "${_remoteServerData.getScheme()}://${_remoteServerData.getHost()}${_remoteServerData.getPath()}?dev=$devMode&hot=$hmr&minify=$jsMinify";
return "${_remoteServerData.getScheme()}://${_remoteServerData.getHost()}/${_remoteServerData.getPath()}?dev=$devMode&hot=$hmr&minify=$jsMinify";
}
return "http://$host/$bundleName?dev=$devMode&hot=$hmr&minify=$jsMinify";
}
Expand Down
2 changes: 1 addition & 1 deletion framework/voltron/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

name: voltron
description: A flutter plugin project to render hippy page.
version: 0.0.37
version: 0.0.39
homepage: https://hippyjs.org
repository: https://github.com/Tencent/Hippy

Expand Down
28 changes: 28 additions & 0 deletions framework/voltron/test/flutter_render_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
//
// Tencent is pleased to support the open source community by making
// Hippy available.
//
// Copyright (C) 2022 THL A29 Limited, a Tencent company.
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import 'package:flutter_test/flutter_test.dart';
import 'package:voltron/inspector/dev_remote_server_data.dart';

void main() {
TestWidgetsFlutterBinding.ensureInitialized();
Expand All @@ -15,4 +36,11 @@ void main() {
Function function = addNum;
expect(Function.apply(function, [1, 2]), 3);
});

test('dev_server_data', () {
final data = DevRemoteServerData('http://1.1.1.1:8080/abcdefg/index.bundle?debugUrl=ws%3A%2F%2F0.0.0.0%3A8080%2Fdebugger-proxy');
expect(data.isValid(), true);
expect(data.getVersionId(), 'abcdefg');
expect(data.getHost(), '1.1.1.1:8080');
});
}
Loading