mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Log send type
This commit is contained in:
@@ -59,6 +59,7 @@ public class SendServlet extends HttpServlet {
|
||||
resp.getWriter().println(ERROR_STATUS + " (Must specify url parameter)");
|
||||
return;
|
||||
}
|
||||
logUrlType(url, sel);
|
||||
|
||||
String deviceName = reqInfo.getParameter("deviceName");
|
||||
String[] deviceNames = deviceName != null ?
|
||||
@@ -190,4 +191,17 @@ public class SendServlet extends HttpServlet {
|
||||
new ChannelMessage(channelToken, url));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void logUrlType(String url, String sel) {
|
||||
String type = "link"; // default
|
||||
if (sel != null && sel.matches("([Tt]el[:]?)?\\s?[+]?(\\(?[0-9|\\s|\\-|\\.]\\)?)+")) {
|
||||
type = "phone number";
|
||||
} else if (url.matches("http://maps\\.google\\.[a-z]{2,3}(\\.[a-z]{2})?[/?].*") ||
|
||||
url.matches("http://www\\.google\\.[a-z]{2,3}(\\.[a-z]{2})?/maps.*")) {
|
||||
type = "Maps";
|
||||
} else if (url.matches("http://www\\.youtube\\.[a-z]{2,3}(\\.[a-z]{2})?/.*")) {
|
||||
type = "YouTube";
|
||||
}
|
||||
log.info("URL type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user