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
1 change: 1 addition & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var defaultSettings = {
theme: "auto",
enableOTP: false,
hideBadge: false,
nameTemplate: "%host%",
caps: {
save: false,
delete: false,
Expand Down
1 change: 1 addition & 0 deletions src/manifest-firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"tabs",
"clipboardRead",
"clipboardWrite",
"contextualIdentities",
"nativeMessaging",
"notifications",
"scripting",
Expand Down
8 changes: 8 additions & 0 deletions src/options/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ function view(ctl, params) {
createCheckbox.call(this, "enableOTP", "Enable support for OTP tokens (not recommended)")
);
nodes.push(createCheckbox.call(this, "hideBadge", "Hide badge counter on the toolbar icon"));

nodes.push(createInput.call(this, "username", "Default username", "john.smith"));
nodes.push(createInput.call(this, "gpgPath", "Custom gpg binary", "/path/to/gpg"));

nodes.push(
createInput.call(this, "nameTemplate", "Template for new credentials", "%container%/%host%")
);
nodes.push(
m("p", "%host%: tab's hostname; %container%: container name (for Firefox, username otherwise)")
);

nodes.push(m("h3", "Theme"));
nodes.push(
createDropdown.call(this, "theme", [
Expand Down
27 changes: 27 additions & 0 deletions src/popup/addEditInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,33 @@ function AddEditInterface(settingsModel) {
} else {
// view instance should be a Login
loginObj = new Login(settings);
const template =
helpers.getSetting("nameTemplate", loginObj, settings) || "%host%";
const tab = await chrome.tabs
.query({
lastFocusedWindow: true,
active: true,
})
.then((it) => it[0]);

const host = new URL(tab.url).host;
const defaultUser = helpers.getSetting("username", loginObj, settings);

const containerName =
(await browser?.contextualIdentities
?.query({})
?.then(
(a) =>
a.find((a) => a.cookieStoreId === tab.cookieStoreId)?.name ||
defaultUser
)) || defaultUser;

// Apply to a template
rendered = template
.replaceAll("%container%", containerName)
.replaceAll("%host%", host);

loginObj.login = rendered;
}

// set the storePath and get tree dirs
Expand Down