1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-02 08:40:08 +01:00

get app version from url

This commit is contained in:
Kyle Spearrin 2019-08-20 23:16:35 -04:00
parent 8defddfdd1
commit 972fef9d50
2 changed files with 3 additions and 12 deletions

View File

@ -69,11 +69,7 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
} }
let command = m!.command let command = m!.command
// print(command) // print(command)
if command == "windowLoaded" { if command == "storage_get" {
// let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
// webView.evaluateJavaScript("window.bitwardenApplicationVersion = '\(version!)';", completionHandler: nil)
// Set things
} else if command == "storage_get" {
let obj = UserDefaults.standard.string(forKey: m!.data!) let obj = UserDefaults.standard.string(forKey: m!.data!)
m!.responseData = obj m!.responseData = obj
replyMessage(message: m!) replyMessage(message: m!)

View File

@ -14,15 +14,10 @@
<div id="loading"><i class="fa fa-spinner fa-spin fa-3x"></i></div> <div id="loading"><i class="fa fa-spinner fa-spin fa-3x"></i></div>
</app-root> </app-root>
<script type="text/javascript"> <script type="text/javascript">
const urlParams = new URLSearchParams(window.location.search);
window.safariAppExtension = true; window.safariAppExtension = true;
window.bitwardenLocaleStrings = null; window.bitwardenLocaleStrings = null;
window.bitwardenApplicationVersion = null; window.bitwardenApplicationVersion = urlParams.get('appVersion');
document.addEventListener('DOMContentLoaded', (event) => {
window.webkit.messageHandlers.bitwardenApp.postMessage(JSON.stringify({
id: '123',
command: 'windowLoaded'
}));
});
</script> </script>
<script type="text/javascript" src="../vendor.js"></script> <script type="text/javascript" src="../vendor.js"></script>
<script type="text/javascript" src="../background.js"></script> <script type="text/javascript" src="../background.js"></script>