Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#189
Browse files Browse the repository at this point in the history
# Conflicts:
#	services/unlockedState.js
#	src/components/EntryListItem.vue
  • Loading branch information
zmilonas committed Oct 5, 2018
2 parents f902251 + 3636cf2 commit ca1eae5
Show file tree
Hide file tree
Showing 52 changed files with 2,696 additions and 2,638 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
### This issue is a
---
name: 🐛 Bug Report
about: If something isn't working as expected 🤔.

bug / feature / question
---

<!-- Please leave only one -->
## Bug report

### Steps to reproduce - current behaviour

Expand Down Expand Up @@ -33,13 +35,13 @@ bug / feature / question

**Operating System:**

**Browser:**
**Browser vendor and version:**

**Storage:**
**Storage Provider:**

<!--
For example:
Operating System: macOS 10.XX.X / Windows 10 Pro
Browser: Chrome XX.XXX.XXX / Firefox XX.XXX
Browser: Chrome XX.XXX.XXX / Firefox XX.XXX (find at chrome://version or about:version)
Storage: Nextcloud / Google Drive / Dropbox
-->
-->
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: 🚀 Feature Request
about: I have a suggestion

---

## Feature Request

### A feature you'd like to see
<!-- A clear and concise description of what you want to happen. Add any considered drawbacks. -->

### Alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. (if applicable) -->

### Additional remarks
<!-- If you can, explain how users will be able to use this and if possible write a initial version of the documentation for the feature.
Maybe a screenshot or design? -->
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/OTHER_ISSUE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: 🤔 Other
about: My issue doesn't fit other types.

---

7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.insertSpaces": false,
"editor.tabSize": 2,
"editor.detectIndentation": false,
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.format.defaultFormatter.html": "none",
}
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,8 @@ yarn build
# this step generates the zip archives submitted to Chrome/Firefox addon marketplaces.
yarn bundle

# build the tests
yarn build-tests

# static reload with file watch for tests
yarn watch-tests
yarn dev-tests
```

For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
Expand Down
2 changes: 1 addition & 1 deletion chrome.manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "KeePass Tusk - Password Access and Autofill",
"short_name": "KeePass Tusk",
"version": "2018.9.16",
"version": "2018.9.27",
"manifest_version": 2,
"minimum_chrome_version": "48",
"description": "Readonly KeePass password database integration for Chrome™",
Expand Down
2 changes: 1 addition & 1 deletion firefox.manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "KeePass Tusk - Password Access and Autofill",
"short_name": "KeePass Tusk",
"version": "2018.9.16",
"version": "2018.9.27",
"manifest_version": 2,
"minimum_chrome_version": "48",
"description": "Readonly KeePass password database integration for Firefox",
Expand Down
18 changes: 9 additions & 9 deletions services/dropboxFileManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function DropboxFileManager(settings) {
chooseDescription: 'Access password files stored on Dropbox. Files will be retrieved from Dropbox each time they are used.',
};

oauth.searchRequestFunction = function(token) {
oauth.searchRequestFunction = function (token) {
return axios({
method: 'post',
url: 'https://api.dropbox.com/2/files/search',
Expand All @@ -45,27 +45,27 @@ function DropboxFileManager(settings) {
})
}

oauth.searchRequestHandler = function(response) {
return response.data.matches.map(function(fileInfo) {
oauth.searchRequestHandler = function (response) {
return response.data.matches.map(function (fileInfo) {
return {
title: fileInfo.metadata.path_display
};
});
}

//get the minimum information needed to identify this file for future retrieval
oauth.getDatabaseChoiceData = function(dbInfo) {
oauth.getDatabaseChoiceData = function (dbInfo) {
return {
title: dbInfo.title
}
}

//given minimal file information, retrieve the actual file
oauth.fileRequestFunction = function(dbInfo, token) {
oauth.fileRequestFunction = function (dbInfo, token) {
function http_header_safe_json(v) {
var charsToEncode = /[\u007f-\uffff]/g;
return JSON.stringify(v).replace(charsToEncode,
function(c) {
function (c) {
return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4);
}
);
Expand All @@ -84,11 +84,11 @@ function DropboxFileManager(settings) {
})
}

oauth.revokeAuth = function() {
oauth.revokeAuth = function () {
return Promise.resolve()
}

oauth.handleAuthRedirectURI = function(redirect_url, randomState, resolve, reject) {
oauth.handleAuthRedirectURI = function (redirect_url, randomState, resolve, reject) {

var tokenMatches = /access_token=([^&]+)/.exec(redirect_url);
var stateMatches = /state=([^&]+)/.exec(redirect_url);
Expand All @@ -100,7 +100,7 @@ function DropboxFileManager(settings) {
var uid = uidMatches[1];
if (checkState === randomState) {
state.loggedIn = true;
settings.getSetAccessToken(accessTokenType, access_token).then(function() {
settings.getSetAccessToken(accessTokenType, access_token).then(function () {
resolve(access_token);
});
} else {
Expand Down
36 changes: 18 additions & 18 deletions services/googleDrivePasswordFileManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function GoogleDrivePasswordFileManager(settings) {
chooseDescription: 'Access password files stored on Google Drive. Files will be fetched from Google Drive each time they are used.',
};

oauth.searchRequestFunction = function(token) {
oauth.searchRequestFunction = function (token) {
var request = {
method: 'GET',
url: "https://www.googleapis.com/drive/v2/files?q=" + urlencode("fileExtension = 'kdbx' and trashed=false"),
Expand All @@ -46,8 +46,8 @@ function GoogleDrivePasswordFileManager(settings) {
return axios(request)
}

oauth.searchRequestHandler = function(response) {
return response.data.items.map(function(entry) {
oauth.searchRequestHandler = function (response) {
return response.data.items.map(function (entry) {
return {
title: entry.title,
url: entry.selfLink
Expand All @@ -56,15 +56,15 @@ function GoogleDrivePasswordFileManager(settings) {
}

//get the minimum information needed to identify this file for future retrieval
oauth.getDatabaseChoiceData = function(dbInfo) {
oauth.getDatabaseChoiceData = function (dbInfo) {
return {
title: dbInfo.title,
url: dbInfo.url
}
}

//given minimal file information, retrieve the actual file
oauth.fileRequestFunction = function(dbInfo, token) {
oauth.fileRequestFunction = function (dbInfo, token) {
function getFileFromDatabase(attempt) {
var requestmeta = {
method: "GET",
Expand All @@ -83,8 +83,8 @@ function GoogleDrivePasswordFileManager(settings) {
}
};
return axios(requestfile).then(response => {
return response
})
return response
})
.catch(err => {
attempt = attempt || 0;
if (attempt == 0) {
Expand All @@ -99,8 +99,8 @@ function GoogleDrivePasswordFileManager(settings) {
return getFileFromDatabase(0)
}

oauth.revokeAuth = function() {
return settings.getSetAccessToken(accessTokenType).then(function(accessToken) {
oauth.revokeAuth = function () {
return settings.getSetAccessToken(accessTokenType).then(function (accessToken) {
if (accessToken) {
var url = 'https://accounts.google.com/o/oauth2/revoke?token=' + accessToken
return axios({
Expand All @@ -117,15 +117,15 @@ function GoogleDrivePasswordFileManager(settings) {
})
}

oauth.handleAuthRedirectURI = function(redirect_url, randomState, resolve, reject) {
oauth.handleAuthRedirectURI = function (redirect_url, randomState, resolve, reject) {
var tokenMatches = /access_token=([^&]+)/.exec(redirect_url);
var stateMatches = /state=([^&]+)/.exec(redirect_url);

if (tokenMatches && stateMatches) {
var access_token = tokenMatches[1];
var checkState = decodeURIComponent(stateMatches[1]);
if (checkState === randomState) {
settings.getSetAccessToken(accessTokenType, access_token).then(function() {
settings.getSetAccessToken(accessTokenType, access_token).then(function () {
resolve(access_token);
});
} else {
Expand All @@ -140,17 +140,17 @@ function GoogleDrivePasswordFileManager(settings) {
}
}

function chrome_auth (interactive){
function chrome_auth(interactive) {
// chrome_auth is an alternative auth function run when the
// browser is Chrome. It uses chrome.identity.getAuthToken rather than
// a standard Oauth flow.
interactive = !!interactive;
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
chrome.identity.getAuthToken({
interactive : interactive
}, function(token) {
interactive: interactive
}, function (token) {
if (token)
settings.getSetAccessToken(accessTokenType, token).then(function() {
settings.getSetAccessToken(accessTokenType, token).then(function () {
resolve(token);
});
else {
Expand All @@ -171,10 +171,10 @@ function GoogleDrivePasswordFileManager(settings) {

// If this browser has the getAuthToken function. Hack for #64
try {
if (chrome.identity.getAuthToken !== undefined){
if (chrome.identity.getAuthToken !== undefined) {
oauth['auth'] = chrome_auth;
}
}
}
catch (e) {
console.info("Firefox mobile detected.")
}
Expand Down
2 changes: 1 addition & 1 deletion services/keepassHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function KeepassHeader() {
};

var AES_CIPHER_UUID = new Uint8Array([0x31, 0xc1, 0xf2, 0xe6, 0xbf, 0x71, 0x43, 0x50, 0xbe, 0x58, 0x05, 0x21, 0x6a, 0xfc, 0x5a, 0xff]);
var littleEndian = (function() {
var littleEndian = (function () {
var buffer = new ArrayBuffer(2);
new DataView(buffer).setInt16(0, 256, true);
return new Int16Array(buffer)[0] === 256;
Expand Down
18 changes: 9 additions & 9 deletions services/keepassReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ function KeepassReference() {
majorVersion: 3 // Defaults to 3, unless told otherwise
};

my.hasReferences = function(fieldValue) {
my.hasReferences = function (fieldValue) {
return !!/\{.+\}/.test(fieldValue || '');
}

/*
* Process all references found in fieldValue to their final values
*/
my.processAllReferences = function(majorVersion, fieldValue, currentEntry, allEntries) {
my.processAllReferences = function (majorVersion, fieldValue, currentEntry, allEntries) {
my.majorVersion = majorVersion; //update the major version if it changed.
var re = /(\{[^\{\}]+\})/g;
var expressions = re.exec(fieldValue || '');
Expand All @@ -37,7 +37,7 @@ function KeepassReference() {
return result;
}

my.keewebGetDecryptedFieldValue = function(entry, fieldName) {
my.keewebGetDecryptedFieldValue = function (entry, fieldName) {
if (entry.protectedData === undefined || !(fieldName in entry['protectedData'])) {
return entry[fieldName] || ""; //not an encrypted field
}
Expand All @@ -46,14 +46,14 @@ function KeepassReference() {
entry['protectedData'][fieldName].salt).getText();
}

my.getFieldValue = function(currentEntry, fieldName, allEntries) {
my.getFieldValue = function (currentEntry, fieldName, allEntries) {
// entries are JSON serializable.
// Convert back to a keeweb.ProtectedValue for parsing.
let plainText = my.keewebGetDecryptedFieldValue(currentEntry, fieldName);
return my.processAllReferences(my.majorVersion, plainText, currentEntry, allEntries);
}

my.resolveReference = function(referenceText, currentEntry, allEntries) {
my.resolveReference = function (referenceText, currentEntry, allEntries) {
var localParts = /^\{([a-zA-Z]+)\}$/.exec(referenceText)
if (localParts) {
// local field
Expand All @@ -73,7 +73,7 @@ function KeepassReference() {

// https://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case
let camelize = (str) => {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(letter, index) {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (letter, index) {
return index == 0 ? letter.toLowerCase() : letter.toUpperCase();
}).replace(/\s+/g, '');
}
Expand All @@ -89,10 +89,10 @@ function KeepassReference() {
var wantedField = getPropertyNameFromCode(refString[1]);
var searchIn = getPropertyNameFromCode(refString[2]);
var text = refString[3];
var matches = allEntries.filter(function(e) {

var matches = allEntries.filter(function (e) {
if (searchIn === '*') {
var customFieldMatches = e.keys.filter(function(key) {
var customFieldMatches = e.keys.filter(function (key) {
return String(e[key] || '').indexOf(text) !== -1;
});
return customFieldMatches.length > 0;
Expand Down
Loading

0 comments on commit ca1eae5

Please sign in to comment.