Skip to content
Merged
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
Binary file modified KeePassHttp.plgx
Binary file not shown.
7 changes: 7 additions & 0 deletions KeePassHttp/ConfigOpt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class ConfigOpt
const string SearchInAllOpenedDatabasesKey = "KeePassHttp_SearchInAllOpenedDatabases";
const string MatchSchemesKey = "KeePassHttp_MatchSchemes";
const string ReturnStringFieldsKey = "KeePassHttp_ReturnStringFields";
const string ReturnStringFieldsWithKphOnlyKey = "KeePassHttp_ReturnStringFieldsWithKphOnly";
const string SortResultByUsernameKey = "KeePassHttp_SortResultByUsername";
const string ListenerPortKey = "KeePassHttp_ListenerPort";
const string ListenerHostKey = "KeePassHttp_ListenerHost";
Expand Down Expand Up @@ -70,6 +71,12 @@ public bool ReturnStringFields
set { _config.SetBool(ReturnStringFieldsKey, value); }
}

public bool ReturnStringFieldsWithKphOnly
{
get { return _config.GetBool(ReturnStringFieldsWithKphOnlyKey, true); }
set { _config.SetBool(ReturnStringFieldsWithKphOnlyKey, value); }
}

public bool SortResultByUsername
{
get { return _config.GetBool(SortResultByUsernameKey, true); }
Expand Down
13 changes: 10 additions & 3 deletions KeePassHttp/Handlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,17 @@ private ResponseEntry PrepareElementForResponseEntries(ConfigOpt configOpt, PwEn
fields = new List<ResponseStringField>();
foreach (var sf in entryDatabase.entry.Strings)
{
if (sf.Key.StartsWith("KPH: "))
var sfValue = entryDatabase.entry.Strings.ReadSafe(sf.Key);
if (configOpt.ReturnStringFieldsWithKphOnly)
{
var sfValue = entryDatabase.entry.Strings.ReadSafe(sf.Key);
fields.Add(new ResponseStringField(sf.Key.Substring(5), sfValue));
if (sf.Key.StartsWith("KPH: "))
{
fields.Add(new ResponseStringField(sf.Key.Substring(5), sfValue));
}
}
else
{
fields.Add(new ResponseStringField(sf.Key, sfValue));
}
}

Expand Down
82 changes: 49 additions & 33 deletions KeePassHttp/OptionsForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions KeePassHttp/OptionsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ private void OptionsForm_Load(object sender, EventArgs e)
credSearchInAllOpenedDatabases.Checked = _config.SearchInAllOpenedDatabases;
matchSchemesCheckbox.Checked = _config.MatchSchemes;
returnStringFieldsCheckbox.Checked = _config.ReturnStringFields;
returnStringFieldsWithKphOnlyCheckBox.Checked = _config.ReturnStringFieldsWithKphOnly;
SortByUsernameRadioButton.Checked = _config.SortResultByUsername;
SortByTitleRadioButton.Checked = !_config.SortResultByUsername;
portNumber.Value = _config.ListenerPort;
hostName.Text = _config.ListenerHost;

this.returnStringFieldsCheckbox_CheckedChanged(null, EventArgs.Empty);
}

private void okButton_Click(object sender, EventArgs e)
Expand All @@ -59,6 +62,7 @@ private void okButton_Click(object sender, EventArgs e)
_config.SearchInAllOpenedDatabases = credSearchInAllOpenedDatabases.Checked;
_config.MatchSchemes = matchSchemesCheckbox.Checked;
_config.ReturnStringFields = returnStringFieldsCheckbox.Checked;
_config.ReturnStringFieldsWithKphOnly = returnStringFieldsWithKphOnlyCheckBox.Checked;
_config.SortResultByUsername = SortByUsernameRadioButton.Checked;
_config.ListenerPort = (int)portNumber.Value;
_config.ListenerHost = hostName.Text;
Expand Down Expand Up @@ -212,5 +216,10 @@ private void SetRestartRequired()
{
_restartRequired = (_config.ListenerPort != portNumber.Value) || (_config.ListenerHost != hostName.Text);
}

private void returnStringFieldsCheckbox_CheckedChanged(object sender, EventArgs e)
{
this.returnStringFieldsWithKphOnlyCheckBox.Enabled = this.returnStringFieldsCheckbox.Checked;
}
}
}
7 changes: 0 additions & 7 deletions KeePassHttp/OptionsForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="label3.Text" xml:space="preserve">
<value>If there are more fields needed than username + password,
normal "String Fields" are used, which can be defined in the
"Advanced" tab of an entry.
String fields are returned in alphabetical order and have to start
with "KPH: " (mind the space after KPH:).</value>
</data>
</root>