diff --git a/main.go b/main.go index 99f75f9..0fe973c 100644 --- a/main.go +++ b/main.go @@ -37,6 +37,7 @@ var ( debug bool rt = mux.NewRouter() + udidNames = map[string]string{} ) type statusResp struct { @@ -147,6 +148,12 @@ func main() { if pWda == "" { return } + // device name + nameBytes, _ := exec.Command("idevicename", "-u", udid).Output() + deviceName := strings.TrimSpace(string(nameBytes)) + udidNames[udid] = deviceName + log.Printf("device name: %s", deviceName) + log.Printf("launch WebDriverAgent(dir=%s)", pWda) c := exec.Command("xcodebuild", "-verbose", diff --git a/revproxy.go b/revproxy.go index 95161ae..6c67d1d 100644 --- a/revproxy.go +++ b/revproxy.go @@ -9,6 +9,7 @@ import ( "net/url" "strconv" "strings" + // "fmt" ) type transport struct { @@ -36,7 +37,10 @@ func (t *transport) RoundTrip(req *http.Request) (resp *http.Response, err error return nil, err } resp.Body.Close() - jsonResp.Value["udid"] = udid + jsonResp.Value["device"] = map[string]interface{}{ + "udid": udid, + "name": udidNames[udid], + } data, _ := json.Marshal(jsonResp) // update body and fix length resp.Body = ioutil.NopCloser(bytes.NewReader(data)) diff --git a/web/assets/remote-control.html b/web/assets/remote-control.html index abdf288..103c0b2 100644 --- a/web/assets/remote-control.html +++ b/web/assets/remote-control.html @@ -78,6 +78,10 @@ height: 100%; } + .cursor-pointer { + cursor: pointer; + } + video::-webkit-media-controls-panel { /* always show video controls */ display: flex !important; @@ -96,7 +100,7 @@
UDID | ++ | |
ScreenSize | x | |
SessionId | -+ | + + + |
RefreshCount | ||
Current | -{{current.toFixed(3)}} mA | -