-
Notifications
You must be signed in to change notification settings - Fork 49
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
Transport Tester GUI App: add support for generic transport, send report, UI polish #170
Transport Tester GUI App: add support for generic transport, send report, UI polish #170
Conversation
This reverts commit e793764.
(cherry picked from commit 909904e)
(cherry picked from commit 2d7a657)
(cherry picked from commit 87da88a)
(cherry picked from commit 40f4ef1)
(cherry picked from commit 651c520)
(cherry picked from commit 5854d2c)
(cherry picked from commit 2feeaea)
(cherry picked from commit 87868ea)
(cherry picked from commit 79f7fb8)
(cherry picked from commit ed94c54)
(cherry picked from commit 4cc5676)
(cherry picked from commit 4e465d7)
@daniellacosse could you please review this PR? I applied the comments on the previous PR which is now closed over to this one; I had to refactor and rebase the previous PR and it got a bit messy and I decided to start off on a new branch and cherrypick the changes over to this one. BTW, I tested the app on MacOS, iOS and Android and everything checked out in the overall functionality. Popover on Android emulator breaks before WenView is upgraded which should not be a problem on physical devices that have already logged into Google Play services. I guess Google is going to include a more updated version of WebView as default soon which automatically fixes this issue on Android emulator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be using slots instead of unsafeHTML https://lit.dev/docs/frameworks/react/#using-slots
|
||
One simple approach to set up a remote collector using Google Spreadsheet is discussed [here](https://github.com/amircybersec/report-collector). | ||
|
||
The following are app screenshots on Android and iOS. The app can also run on Linux, MacOs and Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: MacOS
@@ -4,6 +4,22 @@ | |||
|
|||
This is a simple cross-platform app to test connectivity to Outline servers, using the Outline SDK. It is built with [Wails](https://wails.app/) and [Capacitor](https://capacitorjs.com/). | |||
|
|||
## Usage | |||
|
|||
This is an example application that accepts a transport configuration (for example `shadowsocks`) as defined [here](https://pkg.go.dev/github.com/Jigsaw-Code/outline-sdk/x/config) and performs DNS resolution over the specified transport using provided list of resolvers and domain name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line slightly conflicts with the line above. I might merge the below line with the above and rename this section.
type ConnectivityTestError struct { | ||
// TODO: add Shadowsocks/Transport error | ||
Op string `json:"operation"` | ||
Op string `json:"op,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally not a fan of abbreviations? Maybe we change Op
to Operation
instead
} | ||
retryCollector := &report.RetryCollector{ | ||
Collector: remoteCollector, | ||
MaxRetry: 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pass in a config object with these values?
x/examples/outline-connectivity-app/shared_frontend/pages/connectivity_test/index.ts
Show resolved
Hide resolved
@@ -0,0 +1,50 @@ | |||
import { css, html, LitElement, nothing } from "lit"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that the use of separate component here is a bit overkill. Why not <img src='./outline_logo.svg' />
and style that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daniellacosse that was the first approach I tried but I could not figure out a way to serve static content as the app could not find ./outline_logo.svg
file location. Do you have any tips on serving static content in Index.ts
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may require some doing. This is how to serve static assets in Wails: https://wails.io/docs/guides/dynamic-assets/ And I think Capacitor mounts a webdir: https://capacitorjs.com/docs/config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I opted for creating a custom Lit element for the logo was to avoid framework specific setup. The current approach only works for SVG or text-based assets though. It seems like we don't need to do that for CSS assets here since they are encapsulated in custom Lite elements in the code.
For PNG/JPG/etc images, we need to offer a way to serve static assets though.
If you agree, I can add this as TODO
item as technical debt / improvement to README
and do it via a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, okay with a TODO.
<div @click="${this.showPopover}" popovertarget="my-popover" popovertargetaction="show">ℹ️</div> | ||
<div popover="auto" class="popup" id="my-popover"> | ||
<span @click="${this.closePopover}" class="close-button" popovertargetaction="hide">×</span> | ||
${unsafeHTML(this.popupText)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should definitely be using slots instead of unsafeHTML
https://lit.dev/docs/frameworks/react/#using-slots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to use slots to show the popover
message but I am not able to display HTML formatted text (HTML tags) to display correctly using slots. For example, currently I am using <strong>
and <a>
url tags in one of the popovers:
<info-popup popupText="Options include <strong>ss://</strong>, <strong>split://</strong>,
<strong>tls://</strong>, <strong>socks5://</strong>, and/or a combination of them.
For examples and more information check out the documentation
<a href='https://pkg.go.dev/github.com/Jigsaw-Code/outline-sdk/x/config'> here</a>.">
</info-popup>
which looks like this:
If I use slot
, the message would look like this:
<info-popup>
<p> Options include <strong>ss://</strong>, <strong>split://</strong>,
<strong>tls://</strong>, <strong>socks5://</strong>, and/or a combination of them.
For examples and more information check out the documentation
<a href='https://pkg.go.dev/github.com/Jigsaw-Code/outline-sdk/x/config'> here</a>.
</p>
</info-popup>
The main reason I used unsafeHTML
was to be able to render HTML formatted text. Even though I am rendering static text and unsafeHTML
does not pose a security issue, I agree it is not a clean solution here.
I can ditch HTML formatting altogether here but if you have any suggestions to support markup or HTML tags in the popover text, please do let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show me how you implemented the slot? Here's an example I did recently that works: Jigsaw-Code/outline-server#1482
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The slot works but the HTML formatting of the text is ignored...
This is the change in popover_info.ts
file:
render() {
return html`
<div @click="${this.showPopover}" popovertarget="my-popover" popovertargetaction="show">ℹ️</div>
<div popover="auto" class="popup" id="my-popover">
<span @click="${this.closePopover}" class="close-button" popovertargetaction="hide">×</span>
<slot></slot>
</div>
`;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe the CSS reset is taking effect when you use the <slot></slot>
, which is intentional. There's no telling how different browsers will style things, so to ensure consistency we strip the default styles and re-implement them.
|
||
static styles = css` | ||
.popup { | ||
top: -50%; /* Position above the element */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that I'm saving most of my HTML/CSS comments for last
This PR replaces PR #137; since I had to rebase and refactor the PR #137 that it got a bit out of hand and decided to cherry pick commits into a clean branch off main. Here's is the summary of changes made to the Transport Tester GUI App:
CHANGELOG:
UserInfo
from transports in reports, e.g.:ss://[email protected]:65496
udp
) in response error fieldPowered By Outline
logo