Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Version 1.2
Browse files Browse the repository at this point in the history
Selectable font styles.
Name field upped to 20 characters.
Improved configuration page including help screen.
  • Loading branch information
JumpMaster committed Apr 6, 2014
1 parent 670a0a0 commit 383854b
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 65 deletions.
28 changes: 25 additions & 3 deletions appinfo.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"versionLabel": "1.1.1",
"versionLabel": "1.2",
"uuid": "1f4d9835-3b9a-4ddd-907e-41a25d06f19c",
"appKeys": {
"transmit_key": 2,
"font_style": 7,
"key_count": 0,
"show_message": 4,
"request_key": 1,
Expand All @@ -11,7 +12,7 @@
"timezone": 3
},
"longName": "PebbleAuth",
"versionCode": 3,
"versionCode": 4,
"capabilities": [
"configurable"
],
Expand All @@ -22,6 +23,28 @@
},
"resources": {
"media": [
{
"characterRegex": "[0-9]",
"type": "font",
"name": "FONT_BD_CARTOON_28",
"file": "fonts/BD_Cartoon_Shout.ttf"
},
{
"type": "font",
"name": "FONT_BD_CARTOON_20",
"file": "fonts/BD_Cartoon_Shout.ttf"
},
{
"characterRegex": "[0-9]",
"type": "font",
"name": "FONT_DIGITAL_38",
"file": "fonts/ANDROID_24.ttf"
},
{
"type": "font",
"name": "FONT_DIGITAL_28",
"file": "fonts/ANDROID_24.ttf"
},
{
"menuIcon": true,
"type": "png",
Expand Down Expand Up @@ -49,7 +72,6 @@
"file": "fonts/ORBITRON_28.ttf"
},
{
"characterRegex": "[0-9A-Z?]",
"type": "font",
"name": "FONT_BITWISE_32",
"file": "fonts/BITWISE_32.ttf"
Expand Down
Binary file added resources/fonts/ANDROID_24.ttf
Binary file not shown.
Binary file added resources/fonts/BD_Cartoon_Shout.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/hmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ void hmac_sha1(const uint8_t *key, int keyLength,
uint8_t *result, int resultLength)
__attribute__((visibility("hidden")));

#endif /* _HMAC_H_ */
#endif /* _HMAC_H_ */
53 changes: 43 additions & 10 deletions src/js/pebble-js-app.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
var MAX_OTP = 16;
var MAX_LABEL_LENGTH = 20;
var MAX_KEY_LENGTH = 64;

var otp_count = 0;
var theme = 0;
var font_style = 0;
var timezoneOffset = 0;
var message_send_retries = 0;
var message_send_max_retries = 5;
var app_version = 3;
var app_version = 4;
var debug = false;

function loadLocalVariables() {
otp_count = parseInt(localStorage.getItem("otp_count"));
theme = parseInt(localStorage.getItem("theme"));
timezoneOffset = new Date().getTimezoneOffset();
font_style = parseInt(localStorage.getItem("font_style"));

if (!otp_count)
otp_count = 0;
timezoneOffset = new Date().getTimezoneOffset();

if (!theme)
theme = 0;
otp_count = !otp_count ? 0 : otp_count;
theme = !theme ? 0 : theme;
font_style = !font_style ? 0 : font_style;
}

function sendAppMessage(data) {
Expand Down Expand Up @@ -50,12 +54,18 @@ Pebble.addEventListener("ready",
loadLocalVariables();

// Send timezone, keycount, and theme to watch
sendAppMessage({"key_count":otp_count, "theme":theme, "timezone":timezoneOffset});
sendAppMessage({
"key_count":otp_count,
"theme":theme,
"timezone":timezoneOffset,
"font_style":font_style
});

if (debug) {
console.log("otp_count="+otp_count);
console.log("theme="+theme);
console.log("timezoneOffset="+timezoneOffset);
console.log("font_style="+font_style);
}
}
);
Expand Down Expand Up @@ -107,7 +117,12 @@ Pebble.addEventListener("appmessage",
});

Pebble.addEventListener('showConfiguration', function(e) {
var url = 'http://oncloudvirtual.com/pebble/pebbleauth/?version='+app_version+'&otp_count='+otp_count;
var url = 'http://oncloudvirtual.com/pebble/pebbleauth/v'+
app_version+'/'+
'?otp_count='+otp_count+
'&theme='+theme+
'&font_style='+font_style;

if (debug)
console.log(url);
Pebble.openURL(url);
Expand All @@ -126,10 +141,28 @@ Pebble.addEventListener("webviewclosed",
localStorage.setItem("theme",theme);
config.theme = theme;
}

if(!isNaN(configuration.font_style) && configuration.font_style != font_style) {
if (debug)
console.log("Font style changed:"+configuration.font_style);

font_style = configuration.font_style;
localStorage.setItem("font_style",font_style);
config.font_style = font_style;
}

if(configuration.label && configuration.secret) {
var secret = configuration.secret.replace(/0/g,"O").replace(/1/g, "I").replace(/\+/g, '').replace(/\s/g, '').toUpperCase();
var secretPair = configuration.label + ":" + secret;
var secret = configuration.secret
.replace(/0/g,"O")
.replace(/1/g, "I")
.replace(/\+/g, '')
.replace(/\s/g, '')
.toUpperCase()
.substring(0, MAX_KEY_LENGTH);
var label = configuration.label
.replace(/:/g, '')
.substring(0, MAX_LABEL_LENGTH);
var secretPair = label + ":" + secret;

var blnKeyExists = false;
for (var i=0;i<otp_count;i++) {
Expand Down
Loading

0 comments on commit 383854b

Please sign in to comment.