added more browser extensions to the native host

This commit is contained in:
antelle 2021-04-11 18:01:36 +02:00
parent fa60d02129
commit 101aee81c0
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
2 changed files with 10 additions and 4 deletions

View File

@ -10,7 +10,7 @@ format:
clang-format -i src/*.cpp
run:
echo -n 020000007b7d | xxd -r -p | build/keeweb-native-messaging-host chrome-extension://enjifmdnhaddmajefhfaoglcfdobkcpj
echo -n 020000007b7d | xxd -r -p | build/keeweb-native-messaging-host chrome-extension://enjifmdnhaddmajefhfaoglcfdobkcpj/
tests:
../../node_modules/.bin/mocha test/native-messaging-host-test.mjs

View File

@ -24,7 +24,13 @@ constexpr auto kKeeWebLaunchArg = "--browser-extension";
constexpr auto kSockName = "keeweb-browser.sock";
constexpr std::array kAllowedOrigins = {
std::string_view("chrome-extension://enjifmdnhaddmajefhfaoglcfdobkcpj/")};
// KeeWeb Connect: Chrome
std::string_view("chrome-extension://enjifmdnhaddmajefhfaoglcfdobkcpj/"),
// KeePassXC-Browser: Chrome
std::string_view("chrome-extension://oboonakemofpalcgghocfoadofidjkkk/"),
// KeePassXC-Browser: Edge
std::string_view("chrome-extension://pdffhmdngciaglkoonimfcmckehcpafo/"),
};
constexpr uint32_t kMaxKeeWebConnectAttempts = 10;
constexpr uint32_t kMaxKeeWebConnectRetryTimeoutMillis = 500;
@ -57,8 +63,8 @@ bool check_args(int argc, char *argv[]) {
std::string origin = argv[1];
auto found = std::find(kAllowedOrigins.begin(), kAllowedOrigins.end(), origin);
if (found == kAllowedOrigins.end()) {
std::cerr << "Bad origin: " << origin << std::endl;
return false;
std::cerr << "Bad origin: " << origin << std::endl;
return false;
}
return true;