Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void preformTransmitPendingState(Route route, String hash, Context
Gson gson = new Gson();

String url =
"http://" + route.address + "/api/" + hash + "/lights/" + pState.hubBulb.getHubBulbNumber()
route.address + "/api/" + hash + "/lights/" + pState.hubBulb.getHubBulbNumber()
+ "/state";

GsonRequest<LightsPutResponse[]> req =
Expand All @@ -45,7 +45,7 @@ public static void PreformGetBulbAttributes(Route route, String hash, Context co
return;
}

String url = "http://" + route.address + "/api/" + hash + "/lights/" + bulb;
String url = route.address + "/api/" + hash + "/lights/" + bulb;

GsonRequest<BulbAttributes> req =
new GsonRequest<BulbAttributes>(Method.GET, url, null, BulbAttributes.class, null,
Expand All @@ -65,7 +65,7 @@ public static void setBulbAttributes(Route route, String hash, Context context,
}

Gson gson = new Gson();
String url = "http://" + route.address + "/api/" + hash + "/lights/" + bulbNum;
String url = route.address + "/api/" + hash + "/lights/" + bulbNum;

GsonRequest<LightsPutResponse[]> req =
new GsonRequest<>(Method.PUT, url, gson.toJson(bulbAtt.getSettableAttributes()),
Expand All @@ -85,7 +85,7 @@ public static void PreformGetBulbList(Route route, String hash, Context context,
return;
}

String url = "http://" + route.address + "/api/" + hash + "/lights";
String url = route.address + "/api/" + hash + "/lights";

GsonRequest<BulbList> req =
new GsonRequest<BulbList>(Method.GET, url, null, BulbList.class, null,
Expand All @@ -112,7 +112,7 @@ public static void PreformRegister(RequestQueue queue,

for (int i = 0; i < bridges.length; i++) {

String url = "http://" + bridges[i].internalipaddress + "/api/";
String url = bridges[i].internalipaddress + "/api/";

GsonRequest<RegistrationResponse[]> req =
new GsonRequest<RegistrationResponse[]>(Method.POST, url, registrationRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,19 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
@Override
public void onClick(DialogInterface dialog, int id) {
HubData hd = new HubData();
hd.localHubAddress = mLocalAddress.getText().toString();
hd.portForwardedAddress = mRemoteAddress.getText().toString();
String localAddress = mLocalAddress.getText().toString();
String remoteAddress = mRemoteAddress.getText().toString();

if (!localAddress.matches("(?i:https?:).*")) {
localAddress = "http://" + localAddress;
}

if (!remoteAddress.matches("(?i:https?:).*")) {
remoteAddress = "http://" + remoteAddress;
}

hd.localHubAddress = localAddress;
hd.portForwardedAddress = remoteAddress;

if (mPriorConnection != null) {
hd.hashedUsername = mPriorConnection.getHubData().hashedUsername;
Expand Down