Revert "Safari Web Extension Port from App Extension"

This commit is contained in:
Chad Scharf 2021-01-13 17:08:33 -05:00 committed by GitHub
parent ebd2439edd
commit 336f8f3117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 1950 additions and 664 deletions

View File

@ -30,6 +30,13 @@ const filters = {
safari: [
'!build/safari/**/*'
],
webExt: [
'!build/manifest.json'
],
nonSafariApp: [
'!build/background.html',
'!build/popup/index.html'
],
};
function buildString() {
@ -179,7 +186,6 @@ function safariCopyAssets(source, dest) {
.on('error', reject)
.pipe(gulpif('safari/Info.plist', replace('0.0.1', manifest.version)))
.pipe(gulpif('safari/Info.plist', replace('0.0.2', process.env.BUILD_NUMBER || manifest.version)))
.pipe(gulpif('desktop.xcodeproj/project.pbxproj', replace('../../../build', '../safari/app')))
.pipe(gulp.dest(dest))
.on('end', resolve);
});
@ -189,7 +195,8 @@ function safariCopyBuild(source, dest) {
return new Promise((resolve, reject) => {
gulp.src(source)
.on('error', reject)
.pipe(filter(['**'].concat(filters.fonts)))
.pipe(filter(['**'].concat(filters.fonts)
.concat(filters.webExt).concat(filters.nonSafariApp)))
.pipe(gulp.dest(dest))
.on('end', resolve);
});

View File

@ -20,7 +20,7 @@ export default class CommandsBackground {
}
async init() {
if (this.isVivaldi) {
if (this.isSafari || this.isVivaldi) {
BrowserApi.messageListener('commands.background', async (msg: any, sender: any, sendResponse: any) => {
if (msg.command === 'keyboardShortcutTriggered' && msg.shortcut) {
await this.processCommand(msg.shortcut, sender);

View File

@ -167,8 +167,8 @@ export default class MainBackground {
return promise.then((result) => result.response === 'unlocked');
}
});
this.storageService = new BrowserStorageService();
this.secureStorageService = new BrowserStorageService();
this.storageService = new BrowserStorageService(this.platformUtilsService);
this.secureStorageService = new BrowserStorageService(this.platformUtilsService);
this.i18nService = new I18nService(BrowserApi.getUILanguage(window));
this.cryptoFunctionService = new WebCryptoFunctionService(window, this.platformUtilsService);
this.consoleLogService = new ConsoleLogService(false);
@ -252,18 +252,21 @@ export default class MainBackground {
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService,
this.platformUtilsService, this.analytics, this.vaultTimeoutService);
this.tabsBackground = new TabsBackground(this);
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
this.passwordGenerationService, this.analytics, this.platformUtilsService, this.vaultTimeoutService,
this.eventService, this.totpService);
this.idleBackground = new IdleBackground(this.vaultTimeoutService, this.storageService,
this.notificationsService);
this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService,
this.vaultTimeoutService);
this.windowsBackground = new WindowsBackground(this);
if (!this.isSafari) {
this.tabsBackground = new TabsBackground(this);
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
this.passwordGenerationService, this.analytics, this.platformUtilsService, this.vaultTimeoutService,
this.eventService, this.totpService);
this.idleBackground = new IdleBackground(this.vaultTimeoutService, this.storageService,
this.notificationsService);
this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService,
this.vaultTimeoutService);
this.windowsBackground = new WindowsBackground(this);
}
}
async bootstrap() {
SafariApp.init();
this.analytics.ga('send', 'pageview', '/background.html');
this.containerService.attachToWindow(window);
@ -273,11 +276,13 @@ export default class MainBackground {
await this.runtimeBackground.init();
await this.commandsBackground.init();
await this.tabsBackground.init();
await this.contextMenusBackground.init();
await this.idleBackground.init();
await this.webRequestBackground.init();
await this.windowsBackground.init();
if (!this.isSafari) {
await this.tabsBackground.init();
await this.contextMenusBackground.init();
await this.idleBackground.init();
await this.webRequestBackground.init();
await this.windowsBackground.init();
}
return new Promise((resolve) => {
setTimeout(async () => {
@ -292,7 +297,7 @@ export default class MainBackground {
}
async setIcon() {
if (!chrome.browserAction && !this.sidebarAction) {
if (this.isSafari || (!chrome.browserAction && !this.sidebarAction)) {
return;
}
@ -311,7 +316,7 @@ export default class MainBackground {
}
async refreshBadgeAndMenu(forLocked: boolean = false) {
if (!chrome.windows || !chrome.contextMenus) {
if (this.isSafari || !chrome.windows || !chrome.contextMenus) {
return;
}
@ -442,7 +447,7 @@ export default class MainBackground {
}
private async buildContextMenu() {
if (!chrome.contextMenus || this.buildingContextMenu) {
if (this.isSafari || !chrome.contextMenus || this.buildingContextMenu) {
return;
}

View File

@ -4,6 +4,7 @@ import { CipherView } from 'jslib/models/view/cipherView';
import { LoginUriView } from 'jslib/models/view/loginUriView';
import { LoginView } from 'jslib/models/view/loginView';
import { AuthService } from 'jslib/abstractions/auth.service';
import { AutofillService } from '../services/abstractions/autofill.service';
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
import { CipherService } from 'jslib/abstractions/cipher.service';
@ -12,7 +13,10 @@ import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { NotificationsService } from 'jslib/abstractions/notifications.service';
import { PolicyService } from 'jslib/abstractions/policy.service';
import { PopupUtilsService } from '../popup/services/popup-utils.service';
import { StateService } from 'jslib/abstractions/state.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { SystemService } from 'jslib/abstractions/system.service';
import { UserService } from 'jslib/abstractions/user.service';
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
@ -20,6 +24,7 @@ import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
import { BrowserApi } from '../browser/browserApi';
import MainBackground from './main.background';
import { NativeMessagingBackground } from './nativeMessaging.background';
import { Analytics } from 'jslib/misc';
import { Utils } from 'jslib/misc/utils';
@ -31,6 +36,7 @@ export default class RuntimeBackground {
private runtime: any;
private autofillTimeout: any;
private pageDetailsToAutoFill: any[] = [];
private isSafari: boolean;
private onInstalledReason: string = null;
constructor(private main: MainBackground, private autofillService: AutofillService,
@ -40,15 +46,19 @@ export default class RuntimeBackground {
private systemService: SystemService, private vaultTimeoutService: VaultTimeoutService,
private environmentService: EnvironmentService, private policyService: PolicyService,
private userService: UserService) {
this.isSafari = this.platformUtilsService.isSafari();
this.runtime = this.isSafari ? {} : chrome.runtime;
// onInstalled listener must be wired up before anything else, so we do it in the ctor
chrome.runtime.onInstalled.addListener((details: any) => {
this.onInstalledReason = details.reason;
});
if (!this.isSafari) {
this.runtime.onInstalled.addListener((details: any) => {
this.onInstalledReason = details.reason;
});
}
}
async init() {
if (!chrome.runtime) {
if (!this.runtime) {
return;
}
@ -389,6 +399,20 @@ export default class RuntimeBackground {
}
private async checkOnInstalled() {
if (this.isSafari) {
const installedVersion = await this.storageService.get<string>(ConstantsService.installedVersionKey);
if (installedVersion == null) {
this.onInstalledReason = 'install';
} else if (BrowserApi.getApplicationVersion() !== installedVersion) {
this.onInstalledReason = 'update';
}
if (this.onInstalledReason != null) {
await this.storageService.save(ConstantsService.installedVersionKey,
BrowserApi.getApplicationVersion());
}
}
setTimeout(async () => {
if (this.onInstalledReason != null) {
if (this.onInstalledReason === 'install') {

View File

@ -4,16 +4,20 @@ import { Utils } from 'jslib/misc/utils';
export class BrowserApi {
static isWebExtensionsApi: boolean = (typeof browser !== 'undefined');
static isSafariApi: boolean = navigator.userAgent.indexOf(' Safari/') !== -1;
static isSafariApi: boolean = (window as any).safariAppExtension === true;
static isChromeApi: boolean = !BrowserApi.isSafariApi && (typeof chrome !== 'undefined');
static isFirefoxOnAndroid: boolean = navigator.userAgent.indexOf('Firefox/') !== -1 &&
navigator.userAgent.indexOf('Android') !== -1;
static async getTabFromCurrentWindowId(): Promise<any> {
return await BrowserApi.tabsQueryFirst({
active: true,
windowId: chrome.windows.WINDOW_ID_CURRENT,
});
if (BrowserApi.isChromeApi) {
return await BrowserApi.tabsQueryFirst({
active: true,
windowId: chrome.windows.WINDOW_ID_CURRENT,
});
} else if (BrowserApi.isSafariApi) {
return await BrowserApi.getTabFromCurrentWindow();
}
}
static async getTabFromCurrentWindow(): Promise<any> {
@ -30,11 +34,16 @@ export class BrowserApi {
}
static async tabsQuery(options: any): Promise<any[]> {
return new Promise((resolve) => {
chrome.tabs.query(options, (tabs: any[]) => {
resolve(tabs);
if (BrowserApi.isChromeApi) {
return new Promise((resolve) => {
chrome.tabs.query(options, (tabs: any[]) => {
resolve(tabs);
});
});
});
} else if (BrowserApi.isSafariApi) {
const tabs = await SafariApp.sendMessageToApp('tabs_query', JSON.stringify(options));
return tabs != null ? JSON.parse(tabs) : null;
}
}
static async tabsQueryFirst(options: any): Promise<any> {
@ -63,36 +72,81 @@ export class BrowserApi {
return;
}
return new Promise((resolve) => {
chrome.tabs.sendMessage(tab.id, obj, options, () => {
if (chrome.runtime.lastError) {
// Some error happened
}
resolve();
if (BrowserApi.isChromeApi) {
return new Promise((resolve) => {
chrome.tabs.sendMessage(tab.id, obj, options, () => {
if (chrome.runtime.lastError) {
// Some error happened
}
resolve();
});
});
});
} else if (BrowserApi.isSafariApi) {
if (options != null && options.frameId != null && obj.bitwardenFrameId == null) {
obj.bitwardenFrameId = options.frameId;
}
await SafariApp.sendMessageToApp('tabs_message', JSON.stringify({
tab: tab,
obj: JSON.stringify(obj),
options: options,
}), true);
}
}
static getBackgroundPage(): any {
return chrome.extension.getBackgroundPage();
if (BrowserApi.isChromeApi) {
return chrome.extension.getBackgroundPage();
} else if (BrowserApi.isSafariApi) {
return window;
} else {
return null;
}
}
static getApplicationVersion(): string {
return chrome.runtime.getManifest().version;
if (BrowserApi.isChromeApi) {
return chrome.runtime.getManifest().version;
} else if (BrowserApi.isSafariApi) {
return (window as any).bitwardenApplicationVersion;
} else {
return null;
}
}
static async isPopupOpen(): Promise<boolean> {
return Promise.resolve(chrome.extension.getViews({ type: 'popup' }).length > 0);
if (BrowserApi.isChromeApi) {
return Promise.resolve(chrome.extension.getViews({ type: 'popup' }).length > 0);
} else if (BrowserApi.isSafariApi) {
const open = await SafariApp.sendMessageToApp('isPopoverOpen');
return open === 'true';
} else {
return Promise.resolve(false);
}
}
static createNewTab(url: string, extensionPage: boolean = false) {
chrome.tabs.create({ url: url });
if (BrowserApi.isChromeApi) {
chrome.tabs.create({ url: url });
} else if (BrowserApi.isSafariApi) {
SafariApp.sendMessageToApp('createNewTab', url, true);
}
}
static messageListener(name: string, callback: (message: any, sender: any, response: any) => void) {
chrome.runtime.onMessage.addListener((msg: any, sender: any, response: any) => {
callback(msg, sender, response);
});
if (BrowserApi.isChromeApi) {
chrome.runtime.onMessage.addListener((msg: any, sender: any, response: any) => {
callback(msg, sender, response);
});
} else if (BrowserApi.isSafariApi) {
SafariApp.addMessageListener(name, (message: any, sender: any, response: any) => {
if (message.bitwardenFrameId != null) {
if (sender != null && typeof (sender) === 'object' && sender.frameId == null) {
sender.frameId = message.bitwardenFrameId;
}
}
callback(message, sender, response);
});
}
}
static closePopup(win: Window) {
@ -101,8 +155,10 @@ export class BrowserApi {
// condition is only called if the popup wasn't already dismissed (future proofing).
// ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1433604
browser.tabs.update({ active: true }).finally(win.close);
} else {
} else if (BrowserApi.isWebExtensionsApi || BrowserApi.isChromeApi) {
win.close();
} else if (BrowserApi.isSafariApi) {
SafariApp.sendMessageToApp('hidePopover');
}
}
@ -140,22 +196,30 @@ export class BrowserApi {
}
static getUILanguage(win: Window) {
return chrome.i18n.getUILanguage();
if (BrowserApi.isSafariApi) {
return win.navigator.language;
} else {
return chrome.i18n.getUILanguage();
}
}
static reloadExtension(win: Window) {
if (win != null) {
return win.location.reload(true);
} else {
} else if (BrowserApi.isSafariApi) {
SafariApp.sendMessageToApp('reloadExtension');
} else if (!BrowserApi.isSafariApi) {
return chrome.runtime.reload();
}
}
static reloadOpenWindows() {
const views = chrome.extension.getViews() as Window[];
views.filter((w) => w.location.href != null).forEach((w) => {
w.location.reload();
});
if (!BrowserApi.isSafariApi) {
const views = chrome.extension.getViews() as Window[];
views.filter((w) => w.location.href != null).forEach((w) => {
w.location.reload();
});
}
}
static connectNative(application: string): browser.runtime.Port | chrome.runtime.Port {

View File

@ -1,6 +1,23 @@
import { BrowserApi } from './browserApi';
export class SafariApp {
static init() {
if ((window as any).bitwardenSafariAppInited) {
return;
}
(window as any).bitwardenSafariAppInited = true;
if (BrowserApi.isSafariApi) {
(window as any).bitwardenSafariAppRequests =
new Map<string, { resolve: (value?: unknown) => void, timeoutDate: Date }>();
(window as any).bitwardenSafariAppMessageListeners =
new Map<string, (message: any, sender: any, response: any) => void>();
(window as any).bitwardenSafariAppMessageReceiver = (message: any) => {
SafariApp.receiveMessageFromApp(message);
};
setInterval(() => SafariApp.cleanupOldRequests(), 5 * 60000); // every 5 mins
}
}
static sendMessageToApp(command: string, data: any = null, resolveNow = false): Promise<any> {
if (!BrowserApi.isSafariApi) {
return Promise.resolve(null);
@ -8,14 +25,69 @@ export class SafariApp {
return new Promise((resolve) => {
const now = new Date();
const messageId = now.getTime().toString() + '_' + Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
(browser as any).runtime.sendNativeMessage('com.bitwarden.desktop', {
id: messageId,
command: command,
data: data,
responseData: null,
}, (response: any) => {
resolve(response);
if (typeof safari === typeof undefined) {
(window as any).webkit.messageHandlers.bitwardenApp.postMessage(JSON.stringify({
id: messageId,
command: command,
data: data,
responseData: null,
}));
} else {
safari.extension.dispatchMessage('bitwarden', {
command: command,
data: data,
responseData: null,
});
}
if (resolveNow) {
resolve();
} else {
(window as any).bitwardenSafariAppRequests.set(messageId, {
resolve: resolve,
timeoutDate: new Date(now.getTime() + 5 * 60000),
});
}
});
}
static addMessageListener(name: string, callback: (message: any, sender: any, response: any) => void) {
(window as any).bitwardenSafariAppMessageListeners.set(name, callback);
}
static sendMessageToListeners(message: any, sender: any, response: any) {
(window as any).bitwardenSafariAppMessageListeners.forEach((f: any) => f(message, sender, response));
}
private static receiveMessageFromApp(message: any) {
if (message == null) {
return;
}
if ((message.id == null || message.id === '') && message.command === 'app_message') {
try {
const msg = JSON.parse(message.data);
SafariApp.sendMessageToListeners(msg, {
id: 'app_message',
tab: message.senderTab,
}, null);
} catch { }
} else if (message.id != null && (window as any).bitwardenSafariAppRequests.has(message.id)) {
const p = (window as any).bitwardenSafariAppRequests.get(message.id);
p.resolve(message.responseData);
(window as any).bitwardenSafariAppRequests.delete(message.id);
}
}
private static cleanupOldRequests() {
const removeIds: string[] = [];
((window as any).bitwardenSafariAppRequests as
Map<string, { resolve: (value?: unknown) => void, timeoutDate: Date }>)
.forEach((v, key) => {
if (v.timeoutDate < new Date()) {
removeIds.push(key);
}
});
removeIds.forEach((id) => {
(window as any).bitwardenSafariAppRequests.delete(id);
});
}
}

View File

@ -989,6 +989,35 @@
End 1Password Extension
*/
if ((typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
navigator.userAgent.indexOf('Chrome') === -1) {
if (window.__bitwardenFrameId == null) {
window.__bitwardenFrameId = Math.floor(Math.random() * Math.floor(99999999));
}
safari.self.addEventListener('message', function (msgEvent) {
var msg = JSON.parse(msgEvent.message.msg);
if (msg.bitwardenFrameId != null && window.__bitwardenFrameId !== msg.bitwardenFrameId) {
return;
}
if (msg.command === 'collectPageDetails') {
var pageDetails = collect(document);
var pageDetailsObj = JSON.parse(pageDetails);
safari.extension.dispatchMessage('bitwarden', {
command: 'collectPageDetailsResponse',
tab: msg.tab,
details: pageDetailsObj,
sender: msg.sender,
bitwardenFrameId: window.__bitwardenFrameId
});
}
else if (msg.command === 'fillForm') {
fill(document, msg.fillScript);
}
}, false);
return;
}
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.command === 'collectPageDetails') {
var pageDetails = collect(document);

View File

@ -3,17 +3,44 @@ document.addEventListener('DOMContentLoaded', (event) => {
let filledThisHref = false;
let delayFillTimeout: number;
const enabledKey = 'enableAutoFillOnPageLoad';
chrome.storage.local.get(enabledKey, (obj: any) => {
if (obj != null && obj[enabledKey] === true) {
setInterval(() => doFillIfNeeded(), 500);
const isSafari = (typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
navigator.userAgent.indexOf('Chrome') === -1;
if (isSafari) {
if ((window as any).__bitwardenFrameId == null) {
(window as any).__bitwardenFrameId = Math.floor(Math.random() * Math.floor(99999999));
}
});
chrome.runtime.onMessage.addListener((msg: any, sender: any, sendResponse: Function) => {
if (msg.command === 'fillForm' && pageHref === msg.url) {
filledThisHref = true;
}
});
const responseCommand = 'autofillerAutofillOnPageLoadEnabledResponse';
safari.extension.dispatchMessage('bitwarden', {
command: 'bgGetDataForTab',
responseCommand: responseCommand,
bitwardenFrameId: (window as any).__bitwardenFrameId,
});
safari.self.addEventListener('message', (msgEvent: any) => {
const msg = JSON.parse(msgEvent.message.msg);
if (msg.bitwardenFrameId != null && (window as any).__bitwardenFrameId !== msg.bitwardenFrameId) {
return;
}
if (msg.command === responseCommand && msg.data.autofillEnabled === true) {
setInterval(() => doFillIfNeeded(), 500);
} else if (msg.command === 'fillForm' && pageHref === msg.url) {
filledThisHref = true;
}
}, false);
return;
} else {
const enabledKey = 'enableAutoFillOnPageLoad';
chrome.storage.local.get(enabledKey, (obj: any) => {
if (obj != null && obj[enabledKey] === true) {
setInterval(() => doFillIfNeeded(), 500);
}
});
chrome.runtime.onMessage.addListener((msg: any, sender: any, sendResponse: Function) => {
if (msg.command === 'fillForm' && pageHref === msg.url) {
filledThisHref = true;
}
});
}
function doFillIfNeeded(force: boolean = false) {
if (force || pageHref !== window.location.href) {
@ -37,7 +64,12 @@ document.addEventListener('DOMContentLoaded', (event) => {
sender: 'autofiller',
};
chrome.runtime.sendMessage(msg);
if (isSafari) {
msg.bitwardenFrameId = (window as any).__bitwardenFrameId;
safari.extension.dispatchMessage('bitwarden', msg);
} else {
chrome.runtime.sendMessage(msg);
}
}
}
});

View File

@ -17,30 +17,71 @@ document.addEventListener('DOMContentLoaded', (event) => {
const logInButtonNames = new Set(['log in', 'sign in', 'login', 'go', 'submit', 'continue', 'next']);
const changePasswordButtonNames = new Set(['save password', 'update password', 'change password', 'change']);
const changePasswordButtonContainsNames = new Set(['pass', 'change', 'contras', 'senha']);
let notificationBarData = null;
const isSafari = (typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
navigator.userAgent.indexOf('Chrome') === -1;
let disabledAddLoginNotification = false;
let disabledChangedPasswordNotification = false;
chrome.storage.local.get('neverDomains', (ndObj: any) => {
const domains = ndObj.neverDomains;
if (domains != null && domains.hasOwnProperty(window.location.hostname)) {
if (isSafari) {
if ((window as any).__bitwardenFrameId == null) {
(window as any).__bitwardenFrameId = Math.floor(Math.random() * Math.floor(99999999));
}
if (inIframe) {
return;
}
chrome.storage.local.get('disableAddLoginNotification', (disAddObj: any) => {
disabledAddLoginNotification = disAddObj != null && disAddObj.disableAddLoginNotification === true;
chrome.storage.local.get('disableChangedPasswordNotification', (disChangedObj: any) => {
disabledChangedPasswordNotification = disChangedObj != null &&
disChangedObj.disableChangedPasswordNotification === true;
const responseCommand = 'notificationBarDataResponse';
safari.extension.dispatchMessage('bitwarden', {
command: 'bgGetDataForTab',
responseCommand: responseCommand,
bitwardenFrameId: (window as any).__bitwardenFrameId,
});
safari.self.addEventListener('message', (msgEvent: any) => {
const msg = JSON.parse(msgEvent.message.msg);
if (msg.bitwardenFrameId != null && (window as any).__bitwardenFrameId !== msg.bitwardenFrameId) {
return;
}
if (msg.command === responseCommand && msg.data) {
notificationBarData = msg.data;
if (notificationBarData.neverDomains &&
notificationBarData.neverDomains.hasOwnProperty(window.location.hostname)) {
return;
}
disabledAddLoginNotification = notificationBarData.disabledAddLoginNotification === true;
disabledChangedPasswordNotification = notificationBarData.disabledChangedPasswordNotification === true;
if (!disabledAddLoginNotification || !disabledChangedPasswordNotification) {
collectIfNeededWithTimeout();
}
}
processMessages(msg, () => { /* do nothing on send response for Safari */ });
}, false);
return;
} else {
chrome.storage.local.get('neverDomains', (ndObj: any) => {
const domains = ndObj.neverDomains;
if (domains != null && domains.hasOwnProperty(window.location.hostname)) {
return;
}
chrome.storage.local.get('disableAddLoginNotification', (disAddObj: any) => {
disabledAddLoginNotification = disAddObj != null && disAddObj.disableAddLoginNotification === true;
chrome.storage.local.get('disableChangedPasswordNotification', (disChangedObj: any) => {
disabledChangedPasswordNotification = disChangedObj != null &&
disChangedObj.disableChangedPasswordNotification === true;
if (!disabledAddLoginNotification || !disabledChangedPasswordNotification) {
collectIfNeededWithTimeout();
}
});
});
});
});
chrome.runtime.onMessage.addListener((msg: any, sender: any, sendResponse: Function) => {
processMessages(msg, sendResponse);
});
chrome.runtime.onMessage.addListener((msg: any, sender: any, sendResponse: Function) => {
processMessages(msg, sendResponse);
});
}
function processMessages(msg: any, sendResponse: Function) {
if (msg.command === 'openNotificationBar') {
@ -429,7 +470,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
}
function closeExistingAndOpenBar(type: string, typeData: any) {
let barPage = 'notification/bar.html';
let barPage = (isSafari ? 'app/' : '') + 'notification/bar.html';
switch (type) {
case 'info':
barPage = barPage + '?info=' + typeData.text;
@ -469,7 +510,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
return;
}
const barPageUrl: string = chrome.extension.getURL(barPage);
const barPageUrl: string = isSafari ? (safari.extension.baseURI + barPage) : chrome.extension.getURL(barPage);
const iframe = document.createElement('iframe');
iframe.style.cssText = 'height: 42px; width: 100%; border: 0; min-height: initial;';
@ -539,6 +580,11 @@ document.addEventListener('DOMContentLoaded', (event) => {
}
function sendPlatformMessage(msg: any) {
chrome.runtime.sendMessage(msg);
if (isSafari) {
msg.bitwardenFrameId = (window as any).__bitwardenFrameId;
safari.extension.dispatchMessage('bitwarden', msg);
} else {
chrome.runtime.sendMessage(msg);
}
}
});

View File

@ -45,6 +45,11 @@ document.addEventListener('DOMContentLoaded', (event) => {
shortcut: shortcut,
};
chrome.runtime.sendMessage(msg);
if (isSafari) {
msg.bitwardenFrameId = (window as any).__bitwardenFrameId;
safari.extension.dispatchMessage('bitwarden', msg);
} else {
chrome.runtime.sendMessage(msg);
}
}
});

View File

@ -3,6 +3,15 @@ window.addEventListener('message', (event) => {
return;
if (event.data.command && (event.data.command === 'authResult')) {
if (typeof chrome === typeof undefined) {
safari.extension.dispatchMessage('bitwarden', {
command: event.data.command,
code: event.data.code,
state: event.data.state,
referrer: event.source.location.hostname,
});
return;
}
chrome.runtime.sendMessage({
command: event.data.command,
code: event.data.code,

View File

@ -3,21 +3,34 @@ require('./bar.scss');
document.addEventListener('DOMContentLoaded', () => {
var i18n = {};
var lang = window.navigator.language;
i18n.appName = chrome.i18n.getMessage('appName');
i18n.close = chrome.i18n.getMessage('close');
i18n.yes = chrome.i18n.getMessage('yes');
i18n.never = chrome.i18n.getMessage('never');
i18n.notificationAddSave = chrome.i18n.getMessage('notificationAddSave');
i18n.notificationNeverSave = chrome.i18n.getMessage('notificationNeverSave');
i18n.notificationAddDesc = chrome.i18n.getMessage('notificationAddDesc');
i18n.notificationChangeSave = chrome.i18n.getMessage('notificationChangeSave');
i18n.notificationChangeDesc = chrome.i18n.getMessage('notificationChangeDesc');
lang = chrome.i18n.getUILanguage();
if (typeof safari !== 'undefined') {
const responseCommand = 'notificationBarFrameDataResponse';
sendPlatformMessage({
command: 'bgGetDataForTab',
responseCommand: responseCommand
});
safari.self.addEventListener('message', (msgEvent) => {
const msg = JSON.parse(msgEvent.message.msg);
if (msg.command === responseCommand && msg.data) {
i18n = msg.data.i18n;
load();
}
}, false);
} else {
i18n.appName = chrome.i18n.getMessage('appName');
i18n.close = chrome.i18n.getMessage('close');
i18n.yes = chrome.i18n.getMessage('yes');
i18n.never = chrome.i18n.getMessage('never');
i18n.notificationAddSave = chrome.i18n.getMessage('notificationAddSave');
i18n.notificationNeverSave = chrome.i18n.getMessage('notificationNeverSave');
i18n.notificationAddDesc = chrome.i18n.getMessage('notificationAddDesc');
i18n.notificationChangeSave = chrome.i18n.getMessage('notificationChangeSave');
i18n.notificationChangeDesc = chrome.i18n.getMessage('notificationChangeDesc');
lang = chrome.i18n.getUILanguage();
// delay 50ms so that we get proper body dimensions
setTimeout(load, 50);
// delay 50ms so that we get proper body dimensions
setTimeout(load, 50);
}
function load() {
var closeButton = document.getElementById('close-button'),
@ -118,6 +131,10 @@ document.addEventListener('DOMContentLoaded', () => {
}
function sendPlatformMessage(msg) {
chrome.runtime.sendMessage(msg);
if (typeof safari !== 'undefined') {
safari.extension.dispatchMessage('bitwarden', msg);
} else {
chrome.runtime.sendMessage(msg);
}
}
});

View File

@ -58,12 +58,13 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
// ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1562620
this.initU2f = false;
}
const isSafari = this.platformUtilsService.isSafari();
await super.ngOnInit();
if (this.selectedProviderType == null) {
return;
}
if (this.selectedProviderType === TwoFactorProviderType.Email &&
if (!isSafari && this.selectedProviderType === TwoFactorProviderType.Email &&
this.popupUtilsService.inPopup(window)) {
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('popup2faCloseMessage'),
null, this.i18nService.t('yes'), this.i18nService.t('no'));

View File

@ -185,6 +185,8 @@ export const routerTransition = trigger('routerTransition', [
transition('tabs => premium', inSlideLeft),
transition('premium => tabs', outSlideRight),
transition('tabs => lock', inSlideDown),
]);
if (!BrowserApi.isSafariApi) {
routerTransition.definitions.push(transition('tabs => lock', inSlideDown));
}

View File

@ -1,4 +1,4 @@
<ng-container>
<ng-container *ngIf="show">
<button (click)="expand()" appA11yTitle="{{'popOutNewWindow' | i18n}}">
<i class="fa fa-external-link fa-rotate-270 fa-lg fa-fw" aria-hidden="true"></i>
</button>

View File

@ -22,7 +22,8 @@ export class PopOutComponent implements OnInit {
ngOnInit() {
if (this.show) {
if (this.popupUtilsService.inSidebar(window) && this.platformUtilsService.isFirefox()) {
this.show = !this.platformUtilsService.isSafari();
if (this.show && this.popupUtilsService.inSidebar(window) && this.platformUtilsService.isFirefox()) {
this.show = false;
}
}

View File

@ -68,6 +68,8 @@ export class PopupUtilsService {
chrome.tabs.create({
url: href,
});
} else if ((typeof safari !== 'undefined')) {
// Safari can't open popup in full page tab :(
}
}
}

View File

@ -96,7 +96,7 @@
</div>
<div class="box-footer">{{'disableChangedPasswordNotificationDesc' | i18n}}</div>
</div>
<div class="box">
<div class="box" *ngIf="showDisableContextMenu">
<div class="box-content">
<div class="box-content-row box-content-row-checkbox" appBoxRow>
<label for="context-menu">{{'disableContextMenuItem' | i18n}}</label>

View File

@ -29,6 +29,7 @@ export class OptionsComponent implements OnInit {
disableChangedPasswordNotification = false;
dontShowCards = false;
dontShowIdentities = false;
showDisableContextMenu = true;
showClearClipboard = true;
theme: string;
themeOptions: any[];
@ -67,6 +68,8 @@ export class OptionsComponent implements OnInit {
}
async ngOnInit() {
this.showDisableContextMenu = !this.platformUtilsService.isSafari();
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
ConstantsService.enableAutoFillOnPageLoadKey);

View File

@ -1,5 +1,5 @@
<header>
<div class="left">
<div class="left" *ngIf="showLeftHeader">
<app-pop-out [show]="!inSidebar"></app-pop-out>
<button type="button" appBlurClick (click)="refresh()" appA11yTitle="{{'refresh' | i18n}}" *ngIf="inSidebar">
<i class="fa fa-retweet fa-lg fa-fw" aria-hidden="true"></i>

View File

@ -49,6 +49,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
hostname: string;
searchText: string;
inSidebar = false;
showLeftHeader = false;
searchTypeSearch = false;
loaded = false;
@ -67,7 +68,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
}
async ngOnInit() {
this.searchTypeSearch = !this.platformUtilsService.isSafari();
this.showLeftHeader = this.searchTypeSearch = !this.platformUtilsService.isSafari();
this.inSidebar = this.popupUtilsService.inSidebar(window);
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {

View File

@ -1,5 +1,5 @@
<header>
<div class="left">
<div class="left" *ngIf="showLeftHeader">
<app-pop-out></app-pop-out>
</div>
<div class="search">

View File

@ -92,7 +92,8 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
async ngOnInit() {
this.searchTypeSearch = !this.platformUtilsService.isSafari();
this.showLeftHeader = !(this.popupUtils.inSidebar(window) && this.platformUtilsService.isFirefox());
this.showLeftHeader = !this.platformUtilsService.isSafari() &&
!(this.popupUtils.inSidebar(window) && this.platformUtilsService.isFirefox());
this.stateService.remove('CiphersComponent');
this.broadcasterService.subscribe(ComponentId, (message: any) => {

View File

@ -7,42 +7,37 @@
objects = {
/* Begin PBXBuildFile section */
55E0374D2577FA6B00979016 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E0374C2577FA6B00979016 /* AppDelegate.swift */; };
55E037502577FA6B00979016 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55E0374E2577FA6B00979016 /* Main.storyboard */; };
55E037522577FA6B00979016 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E037512577FA6B00979016 /* ViewController.swift */; };
55E037542577FA6E00979016 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55E037532577FA6E00979016 /* Assets.xcassets */; };
55E0375B2577FA6F00979016 /* safari.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 55E0375A2577FA6F00979016 /* safari.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
55E037602577FA6F00979016 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55E0375F2577FA6F00979016 /* Cocoa.framework */; };
55E037632577FA6F00979016 /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E037622577FA6F00979016 /* SafariWebExtensionHandler.swift */; };
55E037792577FA6F00979016 /* popup in Resources */ = {isa = PBXBuildFile; fileRef = 55E037702577FA6F00979016 /* popup */; };
55E0377A2577FA6F00979016 /* background.js in Resources */ = {isa = PBXBuildFile; fileRef = 55E037712577FA6F00979016 /* background.js */; };
55E0377B2577FA6F00979016 /* images in Resources */ = {isa = PBXBuildFile; fileRef = 55E037722577FA6F00979016 /* images */; };
55E0377C2577FA6F00979016 /* notification in Resources */ = {isa = PBXBuildFile; fileRef = 55E037732577FA6F00979016 /* notification */; };
55E0377D2577FA6F00979016 /* content in Resources */ = {isa = PBXBuildFile; fileRef = 55E037742577FA6F00979016 /* content */; };
55E0377E2577FA6F00979016 /* vendor.js in Resources */ = {isa = PBXBuildFile; fileRef = 55E037752577FA6F00979016 /* vendor.js */; };
55E0377F2577FA6F00979016 /* manifest.json in Resources */ = {isa = PBXBuildFile; fileRef = 55E037762577FA6F00979016 /* manifest.json */; };
55E037802577FA6F00979016 /* background.html in Resources */ = {isa = PBXBuildFile; fileRef = 55E037772577FA6F00979016 /* background.html */; };
55E037812577FA6F00979016 /* _locales in Resources */ = {isa = PBXBuildFile; fileRef = 55E037782577FA6F00979016 /* _locales */; };
27E5E98D22F3D5B2005EA1D9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E5E98C22F3D5B2005EA1D9 /* AppDelegate.swift */; };
27E5E98F22F3D5B2005EA1D9 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E5E98E22F3D5B2005EA1D9 /* ViewController.swift */; };
27E5E99122F3D5B4005EA1D9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 27E5E99022F3D5B4005EA1D9 /* Assets.xcassets */; };
27E5E99422F3D5B4005EA1D9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 27E5E99222F3D5B4005EA1D9 /* Main.storyboard */; };
27E5E9A322F3D5FE005EA1D9 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27E5E9A222F3D5FE005EA1D9 /* Cocoa.framework */; };
27E5E9A622F3D5FE005EA1D9 /* SafariExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E5E9A522F3D5FE005EA1D9 /* SafariExtensionHandler.swift */; };
27E5E9A822F3D5FE005EA1D9 /* SafariExtensionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E5E9A722F3D5FE005EA1D9 /* SafariExtensionViewController.swift */; };
27E5E9AB22F3D5FE005EA1D9 /* SafariExtensionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 27E5E9A922F3D5FE005EA1D9 /* SafariExtensionViewController.xib */; };
27E5E9B022F3D5FE005EA1D9 /* ToolbarItemIcon.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 27E5E9AF22F3D5FE005EA1D9 /* ToolbarItemIcon.pdf */; };
27E5E9B422F3D5FE005EA1D9 /* safari.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 27E5E9A022F3D5FE005EA1D9 /* safari.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
27E5E9BC22F4B9D5005EA1D9 /* app in Resources */ = {isa = PBXBuildFile; fileRef = 27E5E9BB22F4B9D5005EA1D9 /* app */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
55E0375C2577FA6F00979016 /* PBXContainerItemProxy */ = {
27E5E9B222F3D5FE005EA1D9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 55E037402577FA6B00979016 /* Project object */;
containerPortal = 27E5E98122F3D5B2005EA1D9 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 55E037592577FA6F00979016;
remoteInfo = "safari";
remoteGlobalIDString = 27E5E99F22F3D5FD005EA1D9;
remoteInfo = safari;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
55E0376B2577FA6F00979016 /* Embed App Extensions */ = {
27E5E9B822F3D5FE005EA1D9 /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
55E0375B2577FA6F00979016 /* safari.appex in Embed App Extensions */,
27E5E9B422F3D5FE005EA1D9 /* safari.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
@ -50,170 +45,151 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
55E037482577FA6B00979016 /* desktop.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = desktop.app; sourceTree = BUILT_PRODUCTS_DIR; };
55E0374B2577FA6B00979016 /* desktop.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = desktop.entitlements; sourceTree = "<group>"; };
55E0374C2577FA6B00979016 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
55E0374F2577FA6B00979016 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
55E037512577FA6B00979016 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
55E037532577FA6E00979016 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
55E037552577FA6E00979016 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
55E0375A2577FA6F00979016 /* safari.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = safari.appex; sourceTree = BUILT_PRODUCTS_DIR; };
55E0375F2577FA6F00979016 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
55E037622577FA6F00979016 /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = "<group>"; };
55E037642577FA6F00979016 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
55E037652577FA6F00979016 /* safari.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = safari.entitlements; sourceTree = "<group>"; };
55E037702577FA6F00979016 /* popup */ = {isa = PBXFileReference; lastKnownFileType = folder; name = popup; path = ../../../build/popup; sourceTree = "<group>"; };
55E037712577FA6F00979016 /* background.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = background.js; path = ../../../build/background.js; sourceTree = "<group>"; };
55E037722577FA6F00979016 /* images */ = {isa = PBXFileReference; lastKnownFileType = folder; name = images; path = ../../../build/images; sourceTree = "<group>"; };
55E037732577FA6F00979016 /* notification */ = {isa = PBXFileReference; lastKnownFileType = folder; name = notification; path = ../../../build/notification; sourceTree = "<group>"; };
55E037742577FA6F00979016 /* content */ = {isa = PBXFileReference; lastKnownFileType = folder; name = content; path = ../../../build/content; sourceTree = "<group>"; };
55E037752577FA6F00979016 /* vendor.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = vendor.js; path = ../../../build/vendor.js; sourceTree = "<group>"; };
55E037762577FA6F00979016 /* manifest.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = manifest.json; path = ../../../build/manifest.json; sourceTree = "<group>"; };
55E037772577FA6F00979016 /* background.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = background.html; path = ../../../build/background.html; sourceTree = "<group>"; };
55E037782577FA6F00979016 /* _locales */ = {isa = PBXFileReference; lastKnownFileType = folder; name = _locales; path = ../../../build/_locales; sourceTree = "<group>"; };
27E5E98922F3D5B2005EA1D9 /* desktop.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = desktop.app; sourceTree = BUILT_PRODUCTS_DIR; };
27E5E98C22F3D5B2005EA1D9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
27E5E98E22F3D5B2005EA1D9 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
27E5E99022F3D5B4005EA1D9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
27E5E99322F3D5B4005EA1D9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
27E5E99522F3D5B4005EA1D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
27E5E99622F3D5B4005EA1D9 /* desktop.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = desktop.entitlements; sourceTree = "<group>"; };
27E5E9A022F3D5FE005EA1D9 /* safari.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = safari.appex; sourceTree = BUILT_PRODUCTS_DIR; };
27E5E9A222F3D5FE005EA1D9 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
27E5E9A522F3D5FE005EA1D9 /* SafariExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariExtensionHandler.swift; sourceTree = "<group>"; };
27E5E9A722F3D5FE005EA1D9 /* SafariExtensionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariExtensionViewController.swift; sourceTree = "<group>"; };
27E5E9AA22F3D5FE005EA1D9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SafariExtensionViewController.xib; sourceTree = "<group>"; };
27E5E9AC22F3D5FE005EA1D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
27E5E9AF22F3D5FE005EA1D9 /* ToolbarItemIcon.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = ToolbarItemIcon.pdf; sourceTree = "<group>"; };
27E5E9B122F3D5FE005EA1D9 /* safari.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = safari.entitlements; sourceTree = "<group>"; };
27E5E9BB22F4B9D5005EA1D9 /* app */ = {isa = PBXFileReference; lastKnownFileType = folder; path = app; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
55E037452577FA6B00979016 /* Frameworks */ = {
27E5E98622F3D5B2005EA1D9 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
55E037572577FA6F00979016 /* Frameworks */ = {
27E5E99D22F3D5FD005EA1D9 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
55E037602577FA6F00979016 /* Cocoa.framework in Frameworks */,
27E5E9A322F3D5FE005EA1D9 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
55E0373F2577FA6B00979016 = {
27E5E98022F3D5B2005EA1D9 = {
isa = PBXGroup;
children = (
55E0374A2577FA6B00979016 /* desktop */,
55E037612577FA6F00979016 /* safari */,
55E0375E2577FA6F00979016 /* Frameworks */,
55E037492577FA6B00979016 /* Products */,
27E5E98B22F3D5B2005EA1D9 /* desktop */,
27E5E9A422F3D5FE005EA1D9 /* safari */,
27E5E9A122F3D5FE005EA1D9 /* Frameworks */,
27E5E98A22F3D5B2005EA1D9 /* Products */,
);
sourceTree = "<group>";
};
55E037492577FA6B00979016 /* Products */ = {
27E5E98A22F3D5B2005EA1D9 /* Products */ = {
isa = PBXGroup;
children = (
55E037482577FA6B00979016 /* desktop.app */,
55E0375A2577FA6F00979016 /* safari.appex */,
27E5E98922F3D5B2005EA1D9 /* desktop.app */,
27E5E9A022F3D5FE005EA1D9 /* safari.appex */,
);
name = Products;
sourceTree = "<group>";
};
55E0374A2577FA6B00979016 /* desktop */ = {
27E5E98B22F3D5B2005EA1D9 /* desktop */ = {
isa = PBXGroup;
children = (
55E0374B2577FA6B00979016 /* desktop.entitlements */,
55E0374C2577FA6B00979016 /* AppDelegate.swift */,
55E0374E2577FA6B00979016 /* Main.storyboard */,
55E037512577FA6B00979016 /* ViewController.swift */,
55E037532577FA6E00979016 /* Assets.xcassets */,
55E037552577FA6E00979016 /* Info.plist */,
27E5E98C22F3D5B2005EA1D9 /* AppDelegate.swift */,
27E5E98E22F3D5B2005EA1D9 /* ViewController.swift */,
27E5E99022F3D5B4005EA1D9 /* Assets.xcassets */,
27E5E99222F3D5B4005EA1D9 /* Main.storyboard */,
27E5E99522F3D5B4005EA1D9 /* Info.plist */,
27E5E99622F3D5B4005EA1D9 /* desktop.entitlements */,
);
path = desktop;
sourceTree = "<group>";
};
55E0375E2577FA6F00979016 /* Frameworks */ = {
27E5E9A122F3D5FE005EA1D9 /* Frameworks */ = {
isa = PBXGroup;
children = (
55E0375F2577FA6F00979016 /* Cocoa.framework */,
27E5E9A222F3D5FE005EA1D9 /* Cocoa.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
55E037612577FA6F00979016 /* safari */ = {
27E5E9A422F3D5FE005EA1D9 /* safari */ = {
isa = PBXGroup;
children = (
55E0376F2577FA6F00979016 /* Resources */,
55E037622577FA6F00979016 /* SafariWebExtensionHandler.swift */,
55E037642577FA6F00979016 /* Info.plist */,
55E037652577FA6F00979016 /* safari.entitlements */,
27E5E9BB22F4B9D5005EA1D9 /* app */,
27E5E9A522F3D5FE005EA1D9 /* SafariExtensionHandler.swift */,
27E5E9A722F3D5FE005EA1D9 /* SafariExtensionViewController.swift */,
27E5E9A922F3D5FE005EA1D9 /* SafariExtensionViewController.xib */,
27E5E9AC22F3D5FE005EA1D9 /* Info.plist */,
27E5E9AF22F3D5FE005EA1D9 /* ToolbarItemIcon.pdf */,
27E5E9B122F3D5FE005EA1D9 /* safari.entitlements */,
);
path = safari;
sourceTree = "<group>";
};
55E0376F2577FA6F00979016 /* Resources */ = {
isa = PBXGroup;
children = (
55E037702577FA6F00979016 /* popup */,
55E037712577FA6F00979016 /* background.js */,
55E037722577FA6F00979016 /* images */,
55E037732577FA6F00979016 /* notification */,
55E037742577FA6F00979016 /* content */,
55E037752577FA6F00979016 /* vendor.js */,
55E037762577FA6F00979016 /* manifest.json */,
55E037772577FA6F00979016 /* background.html */,
55E037782577FA6F00979016 /* _locales */,
);
name = Resources;
path = "safari";
sourceTree = SOURCE_ROOT;
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
55E037472577FA6B00979016 /* desktop */ = {
27E5E98822F3D5B2005EA1D9 /* desktop */ = {
isa = PBXNativeTarget;
buildConfigurationList = 55E0376C2577FA6F00979016 /* Build configuration list for PBXNativeTarget "desktop" */;
buildConfigurationList = 27E5E99922F3D5B4005EA1D9 /* Build configuration list for PBXNativeTarget "desktop" */;
buildPhases = (
55E037442577FA6B00979016 /* Sources */,
55E037452577FA6B00979016 /* Frameworks */,
55E037462577FA6B00979016 /* Resources */,
55E0376B2577FA6F00979016 /* Embed App Extensions */,
27E5E98522F3D5B2005EA1D9 /* Sources */,
27E5E98622F3D5B2005EA1D9 /* Frameworks */,
27E5E98722F3D5B2005EA1D9 /* Resources */,
27E5E9B822F3D5FE005EA1D9 /* Embed App Extensions */,
);
buildRules = (
);
dependencies = (
55E0375D2577FA6F00979016 /* PBXTargetDependency */,
27E5E9B322F3D5FE005EA1D9 /* PBXTargetDependency */,
);
name = desktop;
productName = desktop;
productReference = 55E037482577FA6B00979016 /* desktop.app */;
productReference = 27E5E98922F3D5B2005EA1D9 /* desktop.app */;
productType = "com.apple.product-type.application";
};
55E037592577FA6F00979016 /* safari */ = {
27E5E99F22F3D5FD005EA1D9 /* safari */ = {
isa = PBXNativeTarget;
buildConfigurationList = 55E037682577FA6F00979016 /* Build configuration list for PBXNativeTarget "safari" */;
buildConfigurationList = 27E5E9B522F3D5FE005EA1D9 /* Build configuration list for PBXNativeTarget "safari" */;
buildPhases = (
55E037562577FA6F00979016 /* Sources */,
55E037572577FA6F00979016 /* Frameworks */,
55E037582577FA6F00979016 /* Resources */,
27E5E99C22F3D5FD005EA1D9 /* Sources */,
27E5E99D22F3D5FD005EA1D9 /* Frameworks */,
27E5E99E22F3D5FD005EA1D9 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = safari;
productName = "safari";
productReference = 55E0375A2577FA6F00979016 /* safari.appex */;
productName = safari;
productReference = 27E5E9A022F3D5FE005EA1D9 /* safari.appex */;
productType = "com.apple.product-type.app-extension";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
55E037402577FA6B00979016 /* Project object */ = {
27E5E98122F3D5B2005EA1D9 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1220;
LastUpgradeCheck = 1220;
LastSwiftUpdateCheck = 1030;
LastUpgradeCheck = 1030;
ORGANIZATIONNAME = "8bit Solutions LLC";
TargetAttributes = {
55E037472577FA6B00979016 = {
CreatedOnToolsVersion = 12.2;
27E5E98822F3D5B2005EA1D9 = {
CreatedOnToolsVersion = 10.3;
};
55E037592577FA6F00979016 = {
CreatedOnToolsVersion = 12.2;
27E5E99F22F3D5FD005EA1D9 = {
CreatedOnToolsVersion = 10.3;
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 1;
@ -222,7 +198,7 @@
};
};
};
buildConfigurationList = 55E037432577FA6B00979016 /* Build configuration list for PBXProject "desktop" */;
buildConfigurationList = 27E5E98422F3D5B2005EA1D9 /* Build configuration list for PBXProject "desktop" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
@ -230,88 +206,92 @@
en,
Base,
);
mainGroup = 55E0373F2577FA6B00979016;
productRefGroup = 55E037492577FA6B00979016 /* Products */;
mainGroup = 27E5E98022F3D5B2005EA1D9;
productRefGroup = 27E5E98A22F3D5B2005EA1D9 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
55E037472577FA6B00979016 /* desktop */,
55E037592577FA6F00979016 /* safari */,
27E5E98822F3D5B2005EA1D9 /* desktop */,
27E5E99F22F3D5FD005EA1D9 /* safari */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
55E037462577FA6B00979016 /* Resources */ = {
27E5E98722F3D5B2005EA1D9 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
55E037542577FA6E00979016 /* Assets.xcassets in Resources */,
55E037502577FA6B00979016 /* Main.storyboard in Resources */,
27E5E99122F3D5B4005EA1D9 /* Assets.xcassets in Resources */,
27E5E99422F3D5B4005EA1D9 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
55E037582577FA6F00979016 /* Resources */ = {
27E5E99E22F3D5FD005EA1D9 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
55E037812577FA6F00979016 /* _locales in Resources */,
55E0377B2577FA6F00979016 /* images in Resources */,
55E0377F2577FA6F00979016 /* manifest.json in Resources */,
55E037802577FA6F00979016 /* background.html in Resources */,
55E0377A2577FA6F00979016 /* background.js in Resources */,
55E037792577FA6F00979016 /* popup in Resources */,
55E0377C2577FA6F00979016 /* notification in Resources */,
55E0377E2577FA6F00979016 /* vendor.js in Resources */,
55E0377D2577FA6F00979016 /* content in Resources */,
27E5E9BC22F4B9D5005EA1D9 /* app in Resources */,
27E5E9B022F3D5FE005EA1D9 /* ToolbarItemIcon.pdf in Resources */,
27E5E9AB22F3D5FE005EA1D9 /* SafariExtensionViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
55E037442577FA6B00979016 /* Sources */ = {
27E5E98522F3D5B2005EA1D9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
55E037522577FA6B00979016 /* ViewController.swift in Sources */,
55E0374D2577FA6B00979016 /* AppDelegate.swift in Sources */,
27E5E98F22F3D5B2005EA1D9 /* ViewController.swift in Sources */,
27E5E98D22F3D5B2005EA1D9 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
55E037562577FA6F00979016 /* Sources */ = {
27E5E99C22F3D5FD005EA1D9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
55E037632577FA6F00979016 /* SafariWebExtensionHandler.swift in Sources */,
27E5E9A822F3D5FE005EA1D9 /* SafariExtensionViewController.swift in Sources */,
27E5E9A622F3D5FE005EA1D9 /* SafariExtensionHandler.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
55E0375D2577FA6F00979016 /* PBXTargetDependency */ = {
27E5E9B322F3D5FE005EA1D9 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 55E037592577FA6F00979016 /* safari */;
targetProxy = 55E0375C2577FA6F00979016 /* PBXContainerItemProxy */;
target = 27E5E99F22F3D5FD005EA1D9 /* safari */;
targetProxy = 27E5E9B222F3D5FE005EA1D9 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
55E0374E2577FA6B00979016 /* Main.storyboard */ = {
27E5E99222F3D5B4005EA1D9 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
55E0374F2577FA6B00979016 /* Base */,
27E5E99322F3D5B4005EA1D9 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
27E5E9A922F3D5FE005EA1D9 /* SafariExtensionViewController.xib */ = {
isa = PBXVariantGroup;
children = (
27E5E9AA22F3D5FE005EA1D9 /* Base */,
);
name = SafariExtensionViewController.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
55E037662577FA6F00979016 /* Debug */ = {
27E5E99722F3D5B4005EA1D9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
@ -335,7 +315,6 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@ -361,7 +340,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@ -371,9 +350,10 @@
};
name = Debug;
};
55E037672577FA6F00979016 /* Release */ = {
27E5E99822F3D5B4005EA1D9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
@ -397,7 +377,6 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@ -417,7 +396,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
@ -426,12 +405,11 @@
};
name = Release;
};
55E0376D2577FA6F00979016 /* Debug */ = {
27E5E99A22F3D5B4005EA1D9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = desktop/desktop.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
@ -442,21 +420,19 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.bitwarden.desktop;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
55E0376E2577FA6F00979016 /* Release */ = {
27E5E99B22F3D5B4005EA1D9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = desktop/desktop.entitlements;
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = LTZ2PFU5D6;
@ -466,28 +442,28 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.bitwarden.desktop;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
55E037692577FA6F00979016 /* Debug */ = {
27E5E9B622F3D5FE005EA1D9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_ENTITLEMENTS = "safari/safari.entitlements";
CODE_SIGN_ENTITLEMENTS = safari/safari.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = LTZ2PFU5D6;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "safari/Info.plist";
INFOPLIST_FILE = safari/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.bitwarden.desktop.safari;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -495,22 +471,21 @@
};
name = Debug;
};
55E0376A2577FA6F00979016 /* Release */ = {
27E5E9B722F3D5FE005EA1D9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_ENTITLEMENTS = "safari/safari.entitlements";
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_ENTITLEMENTS = safari/safari.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = LTZ2PFU5D6;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "safari/Info.plist";
INFOPLIST_FILE = safari/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.bitwarden.desktop.safari;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -521,34 +496,34 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
55E037432577FA6B00979016 /* Build configuration list for PBXProject "desktop" */ = {
27E5E98422F3D5B2005EA1D9 /* Build configuration list for PBXProject "desktop" */ = {
isa = XCConfigurationList;
buildConfigurations = (
55E037662577FA6F00979016 /* Debug */,
55E037672577FA6F00979016 /* Release */,
27E5E99722F3D5B4005EA1D9 /* Debug */,
27E5E99822F3D5B4005EA1D9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
55E037682577FA6F00979016 /* Build configuration list for PBXNativeTarget "safari" */ = {
27E5E99922F3D5B4005EA1D9 /* Build configuration list for PBXNativeTarget "desktop" */ = {
isa = XCConfigurationList;
buildConfigurations = (
55E037692577FA6F00979016 /* Debug */,
55E0376A2577FA6F00979016 /* Release */,
27E5E99A22F3D5B4005EA1D9 /* Debug */,
27E5E99B22F3D5B4005EA1D9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
55E0376C2577FA6F00979016 /* Build configuration list for PBXNativeTarget "desktop" */ = {
27E5E9B522F3D5FE005EA1D9 /* Build configuration list for PBXNativeTarget "safari" */ = {
isa = XCConfigurationList;
buildConfigurations = (
55E0376D2577FA6F00979016 /* Debug */,
55E0376E2577FA6F00979016 /* Release */,
27E5E9B622F3D5FE005EA1D9 /* Debug */,
27E5E9B722F3D5FE005EA1D9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 55E037402577FA6B00979016 /* Project object */;
rootObject = 27E5E98122F3D5B2005EA1D9 /* Project object */;
}

View File

@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:">
location = "self:desktop.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "55E037472577FA6B00979016"
BuildableName = "desktop.app"
BlueprintName = "desktop"
ReferencedContainer = "container:desktop.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "55E037472577FA6B00979016"
BuildableName = "desktop.app"
BlueprintName = "desktop"
ReferencedContainer = "container:desktop.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "55E037472577FA6B00979016"
BuildableName = "desktop.app"
BlueprintName = "desktop"
ReferencedContainer = "container:desktop.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,18 +1,12 @@
import Cocoa
@main
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
func applicationDidFinishLaunching(_: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(_ notification: Notification) {
func applicationWillTerminate(_: Notification) {
// Insert code here to tear down your application
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}

View File

@ -1,11 +0,0 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,58 +1,54 @@
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "icon16.png",
"size" : "16x16",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "icon32.png",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"idiom" : "mac",
"filename" : "icon32.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "icon128.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,6 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
"version" : 1,
"author" : "xcode"
}
}
}

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16085" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11134" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16085"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
</dependencies>
<scenes>
<!--Application-->
@ -22,6 +21,13 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide desktop" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
@ -48,6 +54,607 @@
</items>
</menu>
</menuItem>
<menuItem title="File" id="dMs-cI-mzQ">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="File" id="bib-Uj-vzu">
<items>
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="newDocument:" target="Ady-hI-5gd" id="4Si-XN-c54"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
<connections>
<action selector="openDocument:" target="Ady-hI-5gd" id="bVn-NM-KNZ"/>
</connections>
</menuItem>
<menuItem title="Open Recent" id="tXI-mr-wws">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
<items>
<menuItem title="Clear Menu" id="vNY-rz-j42">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="clearRecentDocuments:" target="Ady-hI-5gd" id="Daa-9d-B3U"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
<connections>
<action selector="performClose:" target="Ady-hI-5gd" id="HmO-Ls-i7Q"/>
</connections>
</menuItem>
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
<connections>
<action selector="saveDocument:" target="Ady-hI-5gd" id="teZ-XB-qJY"/>
</connections>
</menuItem>
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
<connections>
<action selector="saveDocumentAs:" target="Ady-hI-5gd" id="mDf-zr-I0C"/>
</connections>
</menuItem>
<menuItem title="Revert to Saved" keyEquivalent="r" id="KaW-ft-85H">
<connections>
<action selector="revertDocumentToSaved:" target="Ady-hI-5gd" id="iJ3-Pv-kwq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="runPageLayout:" target="Ady-hI-5gd" id="Din-rz-gC5"/>
</connections>
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
<connections>
<action selector="print:" target="Ady-hI-5gd" id="qaZ-4w-aoO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="Ady-hI-5gd" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="Ady-hI-5gd" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="Ady-hI-5gd" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="Ady-hI-5gd" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="Ady-hI-5gd" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="Ady-hI-5gd" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="Ady-hI-5gd" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="Ady-hI-5gd" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="cD7-Qs-BN4"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="WD3-Gg-5AJ"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="NDo-RZ-v9R"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="HOh-sY-3ay"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="U76-nv-p5D"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<connections>
<action selector="centerSelectionInVisibleArea:" target="Ady-hI-5gd" id="IOG-6D-g5B"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="Ady-hI-5gd" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="Ady-hI-5gd" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="Ady-hI-5gd" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="Ady-hI-5gd" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="Ady-hI-5gd" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="Ady-hI-5gd" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="Ady-hI-5gd" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="Ady-hI-5gd" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="Ady-hI-5gd" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="Ady-hI-5gd" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="Ady-hI-5gd" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="Ady-hI-5gd" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="Ady-hI-5gd" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="Ady-hI-5gd" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="Ady-hI-5gd" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="Ady-hI-5gd" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="Ady-hI-5gd" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Format" id="jxT-CU-nIS">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
<items>
<menuItem title="Font" id="Gi5-1S-RQB">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
<items>
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
<connections>
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
</connections>
</menuItem>
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
</connections>
</menuItem>
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
</connections>
</menuItem>
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
<connections>
<action selector="underline:" target="Ady-hI-5gd" id="FYS-2b-JAY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
</connections>
</menuItem>
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
<menuItem title="Kern" id="jBQ-r6-VK2">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
<items>
<menuItem title="Use Default" id="GUa-eO-cwY">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardKerning:" target="Ady-hI-5gd" id="6dk-9l-Ckg"/>
</connections>
</menuItem>
<menuItem title="Use None" id="cDB-IK-hbR">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffKerning:" target="Ady-hI-5gd" id="U8a-gz-Maa"/>
</connections>
</menuItem>
<menuItem title="Tighten" id="46P-cB-AYj">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="tightenKerning:" target="Ady-hI-5gd" id="hr7-Nz-8ro"/>
</connections>
</menuItem>
<menuItem title="Loosen" id="ogc-rX-tC1">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="loosenKerning:" target="Ady-hI-5gd" id="8i4-f9-FKE"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Ligatures" id="o6e-r0-MWq">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
<items>
<menuItem title="Use Default" id="agt-UL-0e3">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardLigatures:" target="Ady-hI-5gd" id="7uR-wd-Dx6"/>
</connections>
</menuItem>
<menuItem title="Use None" id="J7y-lM-qPV">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffLigatures:" target="Ady-hI-5gd" id="iX2-gA-Ilz"/>
</connections>
</menuItem>
<menuItem title="Use All" id="xQD-1f-W4t">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useAllLigatures:" target="Ady-hI-5gd" id="KcB-kA-TuK"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Baseline" id="OaQ-X3-Vso">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
<items>
<menuItem title="Use Default" id="3Om-Ey-2VK">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unscript:" target="Ady-hI-5gd" id="0vZ-95-Ywn"/>
</connections>
</menuItem>
<menuItem title="Superscript" id="Rqc-34-cIF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="superscript:" target="Ady-hI-5gd" id="3qV-fo-wpU"/>
</connections>
</menuItem>
<menuItem title="Subscript" id="I0S-gh-46l">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="subscript:" target="Ady-hI-5gd" id="Q6W-4W-IGz"/>
</connections>
</menuItem>
<menuItem title="Raise" id="2h7-ER-AoG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="raiseBaseline:" target="Ady-hI-5gd" id="4sk-31-7Q9"/>
</connections>
</menuItem>
<menuItem title="Lower" id="1tx-W0-xDw">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowerBaseline:" target="Ady-hI-5gd" id="OF1-bc-KW4"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
<connections>
<action selector="orderFrontColorPanel:" target="Ady-hI-5gd" id="mSX-Xz-DV3"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="copyFont:" target="Ady-hI-5gd" id="GJO-xA-L4q"/>
</connections>
</menuItem>
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteFont:" target="Ady-hI-5gd" id="JfD-CL-leO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Text" id="Fal-I4-PZk">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Text" id="d9c-me-L2H">
<items>
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
<connections>
<action selector="alignLeft:" target="Ady-hI-5gd" id="zUv-R1-uAa"/>
</connections>
</menuItem>
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
<connections>
<action selector="alignCenter:" target="Ady-hI-5gd" id="spX-mk-kcS"/>
</connections>
</menuItem>
<menuItem title="Justify" id="J5U-5w-g23">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="alignJustified:" target="Ady-hI-5gd" id="ljL-7U-jND"/>
</connections>
</menuItem>
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
<connections>
<action selector="alignRight:" target="Ady-hI-5gd" id="r48-bG-YeY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
<menuItem title="Writing Direction" id="H1b-Si-o9J">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
<items>
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="YGs-j5-SAR">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionNatural:" target="Ady-hI-5gd" id="qtV-5e-UBP"/>
</connections>
</menuItem>
<menuItem id="Lbh-J2-qVU">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="S0X-9S-QSf"/>
</connections>
</menuItem>
<menuItem id="jFq-tB-4Kx">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="5fk-qB-AqJ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="Nop-cj-93Q">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionNatural:" target="Ady-hI-5gd" id="lPI-Se-ZHp"/>
</connections>
</menuItem>
<menuItem id="BgM-ve-c93">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="caW-Bv-w94"/>
</connections>
</menuItem>
<menuItem id="RB4-Sm-HuC">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="EXD-6r-ZUu"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
<menuItem title="Show Ruler" id="vLm-3I-IUL">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleRuler:" target="Ady-hI-5gd" id="FOx-HJ-KwY"/>
</connections>
</menuItem>
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="copyRuler:" target="Ady-hI-5gd" id="71i-fW-3W2"/>
</connections>
</menuItem>
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="pasteRuler:" target="Ady-hI-5gd" id="cSh-wd-qM2"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="toggleToolbarShown:" target="Ady-hI-5gd" id="BXY-wc-z0C"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runToolbarCustomizationPalette:" target="Ady-hI-5gd" id="pQI-g3-MTW"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleSidebar:" target="Ady-hI-5gd" id="iwa-gc-5KM"/>
</connections>
</menuItem>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleFullScreen:" target="Ady-hI-5gd" id="dU3-MA-1Rq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="Ady-hI-5gd" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="Ady-hI-5gd" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="Ady-hI-5gd" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
@ -70,15 +677,15 @@
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="76" y="-134"/>
<point key="canvasLocation" x="75" y="0.0"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController showSeguePresentationStyle="single" id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="desktop" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenNone="YES"/>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
@ -98,70 +705,13 @@
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="344"/>
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView distribution="fill" orientation="vertical" alignment="centerX" spacing="42" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZLV-xE-AGT">
<rect key="frame" x="0.0" y="34" width="480" height="265"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="FWV-e2-WQh" userLabel="IconView">
<rect key="frame" x="176" y="137" width="128" height="128"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" image="AppIcon" id="Hhb-TZ-Dhg"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EB0-ac-UZR">
<rect key="frame" x="38" y="63" width="404" height="32"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="400" id="pZE-0p-Ce8"/>
</constraints>
<textFieldCell key="cell" alignment="center" title="App Name's extension is currently off. You can turn it on in Safari Extensions preferences." id="S7v-7o-3vW">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ooh-eV-eLQ">
<rect key="frame" x="79" y="-7" width="322" height="32"/>
<buttonCell key="cell" type="push" title="Quit and Open Safari Extensions Preferences…" alternateTitle="Install" bezelStyle="rounded" alignment="center" lineBreakMode="truncatingMiddle" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Srx-0j-A4D">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
<connections>
<action selector="openSafariExtensionPreferences:" target="XfG-lQ-9wD" id="vKk-Xb-MPh"/>
</connections>
</buttonCell>
</button>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="ZLV-xE-AGT" secondAttribute="trailing" id="7aD-Ze-9ed"/>
<constraint firstItem="ZLV-xE-AGT" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="45" id="AJ3-sx-ZQx"/>
<constraint firstAttribute="bottom" secondItem="ZLV-xE-AGT" secondAttribute="bottom" constant="34" id="KVY-ss-lTJ"/>
<constraint firstItem="ZLV-xE-AGT" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" id="mT6-ee-vkp"/>
</constraints>
</view>
<connections>
<outlet property="appNameLabel" destination="EB0-ac-UZR" id="SDO-j1-PQa"/>
</connections>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
<resources>
<image name="AppIcon" width="128" height="128"/>
</resources>
</document>

View File

@ -11,13 +11,13 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>com.bitwarden.desktop</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<string>Bitwarden</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>

View File

@ -1,44 +1,14 @@
import Cocoa
import SafariServices.SFSafariApplication
import SafariServices.SFSafariExtensionManager
let appName = "desktop"
let extensionBundleIdentifier = "com.bitwarden.desktop.Extension"
class ViewController: NSViewController {
@IBOutlet var appNameLabel: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
self.appNameLabel.stringValue = appName
SFSafariExtensionManager.getStateOfSafariExtension(withIdentifier: extensionBundleIdentifier) { (state, error) in
guard let state = state, error == nil else {
// Insert code to inform the user that something went wrong.
return
}
DispatchQueue.main.async {
if (state.isEnabled) {
self.appNameLabel.stringValue = "\(appName)'s extension is currently on."
} else {
self.appNameLabel.stringValue = "\(appName)'s extension is currently off. You can turn it on in Safari Extensions preferences."
}
}
}
}
@IBAction func openSafariExtensionPreferences(_ sender: AnyObject?) {
SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in
guard error == nil else {
// Insert code to inform the user that something went wrong.
return
}
DispatchQueue.main.async {
NSApplication.shared.terminate(nil)
}
}
// Do any additional setup after loading the view.
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SafariExtensionViewController" customModule="safari" customModuleProvider="target">
<connections>
<outlet property="view" destination="c22-O7-iKe" id="vwT-Xx-Aiz"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="c22-O7-iKe">
<rect key="frame" x="0.0" y="0.0" width="330" height="119"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
</objects>
</document>

View File

@ -9,13 +9,13 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>com.bitwarden.desktop.safari</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<string>Bitwarden</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>CFBundleVersion</key>
@ -25,17 +25,63 @@
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.web-extension</string>
<string>com.apple.Safari.extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
<string>$(PRODUCT_MODULE_NAME).SafariExtensionHandler</string>
<key>SFSafariStyleSheet</key>
<array>
<dict>
<key>Style Sheet</key>
<string>app/content/autofill.css</string>
</dict>
</array>
<key>SFSafariContentScript</key>
<array>
<dict>
<key>Script</key>
<string>app/content/autofill.js</string>
</dict>
<dict>
<key>Script</key>
<string>app/content/autofiller.js</string>
</dict>
<dict>
<key>Script</key>
<string>app/content/notificationBar.js</string>
</dict>
<dict>
<key>Script</key>
<string>app/content/shortcuts.js</string>
</dict>
<dict>
<key>Script</key>
<string>app/content/sso.js</string>
</dict>
</array>
<key>SFSafariToolbarItem</key>
<dict>
<key>Action</key>
<string>Popover</string>
<key>Identifier</key>
<string>Button</string>
<key>Image</key>
<string>ToolbarItemIcon.pdf</string>
<key>Label</key>
<string>Bitwarden</string>
</dict>
<key>SFSafariWebsiteAccess</key>
<dict>
<key>Level</key>
<string>All</string>
</dict>
<key>SFSafariExtensionBundleIdentifiersToUninstall</key>
<array>
<string>com.bitwarden.safari</string>
</array>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2020 Bitwarden Inc. All rights reserved.</string>
<key>NSHumanReadableDescription</key>
<string>A secure and free password manager for all of your devices.</string>
<key>SFSafariAppExtensionBundleIdentifiersToReplace</key>
<array>
<string>com.bitwarden.desktop.safari</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,101 @@
import SafariServices
class SafariExtensionHandler: SFSafariExtensionHandler {
override init() {
super.init()
SafariExtensionViewController.shared.initWebView()
}
override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String: Any]?) {
// This method will be called when a content script provided by your extension
// calls safari.extension.dispatchMessage("message").
if messageName == "bitwarden" {
page.getPropertiesWithCompletionHandler { properties in
DispatchQueue.main.async {
makeSenderTabObject(page: page, props: properties, complete: { senderTab in
DispatchQueue.main.async {
self.sendMessage(msg: userInfo, sender: senderTab)
}
})
}
}
}
}
override func toolbarItemClicked(in _: SFSafariWindow) {
// This method will be called when your toolbar item is clicked.
}
override func validateToolbarItem(in _: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) {
// This is called when Safari's state changed in some way that would require the extension's
// toolbar item to be validated again.
validationHandler(true, "")
}
override func popoverViewController() -> SFSafariExtensionViewController {
return SafariExtensionViewController.shared
}
override func popoverWillShow(in _: SFSafariWindow) {
SafariExtensionViewController.shared.popoverOpenCount += 1
DispatchQueue.main.async {
self.sendMessage(msg: ["command": "reloadPopup"], sender: nil)
}
}
override func popoverDidClose(in _: SFSafariWindow) {
SafariExtensionViewController.shared.popoverOpenCount -= 1
}
func sendMessage(msg: [String: Any]?, sender: Tab? = nil) {
if SafariExtensionViewController.shared.webView == nil {
return
}
let newMsg = AppMessage()
newMsg.command = "app_message"
newMsg.senderTab = sender
do {
let jsonData = try JSONSerialization.data(withJSONObject: msg as Any, options: [])
newMsg.data = String(data: jsonData, encoding: .utf8)
} catch let error {
print("error converting to json: \(error)")
}
SafariExtensionViewController.shared.replyMessage(message: newMsg)
}
}
func makeSenderTabObject(page: SFSafariPage, props: SFSafariPageProperties?, complete: @escaping (Tab) -> Void) {
let t = Tab()
t.title = props?.title
t.url = props?.url?.absoluteString
page.getContainingTab { tab in
tab.getContainingWindow(completionHandler: { win in
guard let window = win else {
t.active = false;
t.windowId = -100
SFSafariApplication.getAllWindows(completionHandler: { allWins in
if (allWins.count == 0) {
return
}
allWins[0].getAllTabs { allWinTabs in
t.index = allWinTabs.firstIndex(of: tab) ?? -1
t.id = "\(t.windowId)_\(t.index)"
complete(t)
}
})
return
}
window.getActiveTab(completionHandler: { activeTab in
t.active = activeTab != nil && tab == activeTab
SFSafariApplication.getAllWindows(completionHandler: { allWins in
t.windowId = allWins.firstIndex(of: window) ?? -100
window.getAllTabs { allWinTabs in
t.index = allWinTabs.firstIndex(of: tab) ?? -1
t.id = "\(t.windowId)_\(t.index)"
complete(t)
}
})
})
})
}
}

View File

@ -0,0 +1,440 @@
import SafariServices
import WebKit
class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMessageHandler, WKNavigationDelegate {
var webView: WKWebView!
var initedWebView: Bool = false
var popoverOpenCount: Int = 0
static let shared: SafariExtensionViewController = {
let shared = SafariExtensionViewController()
shared.preferredContentSize = NSSize(width: 375, height: 600)
return shared
}()
func initWebView() {
if initedWebView {
return
}
initedWebView = true
let parentHeight = SafariExtensionViewController.shared.preferredContentSize.height
let parentWidth = SafariExtensionViewController.shared.preferredContentSize.width
let webViewConfig = WKWebViewConfiguration()
webViewConfig.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
webViewConfig.preferences.setValue(true, forKey: "developerExtrasEnabled")
webViewConfig.userContentController.add(self, name: "bitwardenApp")
webView = WKWebView(frame: CGRect(x: 0, y: 0, width: parentWidth, height: parentHeight),
configuration: webViewConfig)
webView.navigationDelegate = self
webView.allowsLinkPreview = false
navigateWebView("app/popup/index.html")
webView.alphaValue = 0.0
webView.uiDelegate = self
view.addSubview(webView)
}
func navigateWebView(_ relativeUrl: String){
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
let bundleUrl = Bundle.main.resourceURL!.absoluteURL
if var urlComponents = URLComponents(string: bundleUrl.absoluteString + relativeUrl) {
if (urlComponents.queryItems?.first(where: { $0.name == "appVersion" })?.value == nil) {
urlComponents.queryItems = urlComponents.queryItems ?? []
urlComponents.queryItems!.append(URLQueryItem(name: "appVersion", value: version))
}
webView.loadFileURL(urlComponents.url!, allowingReadAccessTo: bundleUrl)
}
}
func webView(_ webView: WKWebView, didFinish _: WKNavigation!) {
if #available(OSXApplicationExtension 10.12, *) {
NSAnimationContext.runAnimationGroup({ _ in
NSAnimationContext.current.duration = 0.35
webView.animator().alphaValue = 1.0
})
} else {
// Fallback on earlier versions
}
}
override func viewDidLoad() {
super.viewDidLoad()
let backgroundColor = NSColor(red: (39 / 255.0), green: (42 / 255.0), blue: (46 / 255.0), alpha: 1.0)
view.setValue(backgroundColor, forKey: "backgroundColor")
initWebView()
}
func userContentController(_: WKUserContentController, didReceive message: WKScriptMessage) {
if message.name != "bitwardenApp" {
return
}
guard let messageBody = message.body as? String else {
return
}
guard let m: AppMessage = jsonDeserialize(json: messageBody) else {
return
}
let command = m.command
NSLog("Command: \(command)")
if command == "storage_get" {
if let data = m.data {
let obj = UserDefaults.standard.string(forKey: data)
m.responseData = obj
replyMessage(message: m)
}
} else if command == "storage_save" {
guard let data: StorageData = jsonDeserialize(json: m.data) else {
return
}
if let obj = data.obj {
UserDefaults.standard.set(obj, forKey: data.key)
} else {
UserDefaults.standard.removeObject(forKey: data.key)
}
replyMessage(message: m)
} else if command == "storage_remove" {
if let data = m.data {
UserDefaults.standard.removeObject(forKey: data)
replyMessage(message: m)
}
} else if command == "getLocaleStrings" {
let language = m.data ?? "en"
guard let bundleUrl = Bundle.main.resourceURL?.absoluteURL else {
return
}
let messagesUrl = bundleUrl.appendingPathComponent("app/_locales/\(language)/messages.json")
do {
let json = try String(contentsOf: messagesUrl, encoding: .utf8)
webView.evaluateJavaScript("window.bitwardenLocaleStrings = \(json);", completionHandler: {(result, error) in
guard let err = error else {
return;
}
NSLog("evaluateJavaScript error : %@", err.localizedDescription);
})
} catch {
NSLog("ERROR on getLocaleStrings, \(error)")
}
replyMessage(message: m)
} else if command == "tabs_query" {
guard let options: TabQueryOptions = jsonDeserialize(json: m.data) else {
return
}
if options.currentWindow ?? false {
SFSafariApplication.getActiveWindow { win in
if win != nil {
processWindowsForTabs(wins: [win!], options: options, complete: { tabs in
m.responseData = jsonSerialize(obj: tabs)
self.replyMessage(message: m)
})
} else {
SFSafariApplication.getAllWindows { wins in
processWindowsForTabs(wins: wins, options: options, complete: { tabs in
m.responseData = jsonSerialize(obj: tabs)
self.replyMessage(message: m)
})
}
}
}
} else {
SFSafariApplication.getAllWindows { wins in
processWindowsForTabs(wins: wins, options: options, complete: { tabs in
m.responseData = jsonSerialize(obj: tabs)
self.replyMessage(message: m)
})
}
}
} else if command == "tabs_message" {
guard let tabMsg: TabMessage = jsonDeserialize(json: m.data) else {
return
}
SFSafariApplication.getAllWindows { wins in
var theWin: SFSafariWindow?
var winIndex = 0
for win in wins {
if tabMsg.tab.windowId == winIndex {
theWin = win
break
}
winIndex = winIndex + 1
}
var theTab: SFSafariTab?
theWin?.getAllTabs { tabs in
var tabIndex = 0
for tab in tabs {
if tabMsg.tab.index == tabIndex {
theTab = tab
break
}
tabIndex = tabIndex + 1
}
theTab?.getActivePage { activePage in
activePage?.dispatchMessageToScript(withName: "bitwarden", userInfo: ["msg": tabMsg.obj])
}
}
}
} else if command == "hidePopover" {
dismissPopover()
replyMessage(message: m)
} else if command == "showPopover" {
if popoverOpenCount <= 0 {
SFSafariApplication.getActiveWindow { win in
win?.getToolbarItem(completionHandler: { item in
item?.showPopover()
})
}
}
} else if command == "isPopoverOpen" {
m.responseData = popoverOpenCount > 0 ? "true" : "false"
replyMessage(message: m)
} else if command == "createNewTab" {
if let data = m.data, let url = URL(string: data) {
if !data.starts(with: "https://") && !data.starts(with: "http://") {
SFSafariApplication.getActiveWindow { win in
win?.getToolbarItem(completionHandler: { item in
item?.showPopover()
self.navigateWebView("app/" + url.absoluteString)
})
}
}
SFSafariApplication.getActiveWindow { win in
win?.openTab(with: url, makeActiveIfPossible: true, completionHandler: { _ in
// Tab opened
})
}
}
} else if command == "reloadExtension" {
webView?.reload()
replyMessage(message: m)
} else if command == "copyToClipboard" {
let pasteboard = NSPasteboard.general
pasteboard.declareTypes([NSPasteboard.PasteboardType.string], owner: nil)
pasteboard.setString(m.data ?? "", forType: NSPasteboard.PasteboardType.string)
replyMessage(message: m)
} else if command == "readFromClipboard" {
let pasteboard = NSPasteboard.general
m.responseData = pasteboard.pasteboardItems?.first?.string(forType: .string)
replyMessage(message: m)
} else if command == "downloadFile" {
guard let jsonData = m.data else {
return
}
guard let dlMsg: DownloadFileMessage = jsonDeserialize(json: jsonData) else {
return
}
var blobData: Data?
if dlMsg.blobOptions?.type == "text/plain" {
blobData = dlMsg.blobData?.data(using: .utf8)
} else if let blob = dlMsg.blobData {
blobData = Data(base64Encoded: blob)
}
guard let data = blobData else {
return
}
let panel = NSSavePanel()
panel.canCreateDirectories = true
panel.nameFieldStringValue = dlMsg.fileName
panel.begin { response in
if response == NSApplication.ModalResponse.OK {
if let url = panel.url {
do {
let fileManager = FileManager.default
if !fileManager.fileExists(atPath: url.absoluteString) {
fileManager.createFile(atPath: url.absoluteString, contents: Data(),
attributes: nil)
}
try data.write(to: url)
} catch {
print(error)
NSLog("ERROR in downloadFile, \(error)")
}
}
}
}
}
}
func replyMessage(message: AppMessage) {
if webView == nil {
return
}
let json = (jsonSerialize(obj: message) ?? "null")
webView.evaluateJavaScript("window.bitwardenSafariAppMessageReceiver(\(json));", completionHandler: {(result, error) in
guard let err = error else {
return;
}
NSLog("evaluateJavaScript error : %@", err.localizedDescription);
})
}
}
extension SafariExtensionViewController: WKUIDelegate {
@available(OSXApplicationExtension 10.12, *)
func webView(_: WKWebView, runOpenPanelWith _: WKOpenPanelParameters, initiatedByFrame _: WKFrameInfo,
completionHandler: @escaping ([URL]?) -> Void) {
let openPanel = NSOpenPanel()
openPanel.canChooseFiles = true
openPanel.begin { result in
if result == NSApplication.ModalResponse.OK && openPanel.url != nil {
completionHandler([openPanel.url!])
} else {
completionHandler(nil)
}
}
}
}
func processWindowsForTabs(wins: [SFSafariWindow], options: TabQueryOptions?, complete: @escaping ([Tab]) -> Void) {
if wins.count == 0 {
complete([])
return
}
var newTabs: [Tab] = []
let winGroup = DispatchGroup()
for win in wins {
winGroup.enter()
win.getActiveTab { activeTab in
win.getAllTabs { allTabs in
let tabGroup = DispatchGroup()
for tab in allTabs {
tabGroup.enter()
if options?.active ?? false {
if activeTab != nil && activeTab == tab {
let windowIndex = wins.firstIndex(of: win) ?? -100
let tabIndex = allTabs.firstIndex(of: tab) ?? -1
makeTabObject(tab: tab, activeTab: activeTab, windowIndex: windowIndex,
tabIndex: tabIndex, complete: { t in
newTabs.append(t)
tabGroup.leave()
})
} else {
tabGroup.leave()
}
} else {
let windowIndex = wins.firstIndex(of: win) ?? -100
let tabIndex = allTabs.firstIndex(of: tab) ?? -1
makeTabObject(tab: tab, activeTab: activeTab, windowIndex: windowIndex,
tabIndex: tabIndex, complete: { t in
newTabs.append(t)
tabGroup.leave()
})
}
}
tabGroup.notify(queue: .main) {
winGroup.leave()
}
}
}
}
winGroup.notify(queue: .main) {
complete(newTabs)
}
}
func makeTabObject(tab: SFSafariTab, activeTab: SFSafariTab?, windowIndex: Int, tabIndex: Int,
complete: @escaping (Tab) -> Void) {
let t = Tab()
t.active = activeTab != nil && tab == activeTab
t.windowId = windowIndex
t.index = tabIndex
t.id = "\(windowIndex)_\(tabIndex)"
tab.getActivePage { page in
guard let activePage = page else {
complete(t)
return
}
activePage.getPropertiesWithCompletionHandler({ props in
t.title = props?.title
t.url = props?.url?.absoluteString
complete(t)
})
}
}
func jsonSerialize<T: Encodable>(obj: T?) -> String? {
let encoder = JSONEncoder()
do {
let data = try encoder.encode(obj)
return String(data: data, encoding: .utf8) ?? "null"
} catch _ {
return "null"
}
}
func jsonDeserialize<T: Decodable>(json: String?) -> T? {
if json == nil {
return nil
}
let decoder = JSONDecoder()
do {
let obj = try decoder.decode(T.self, from: json!.data(using: .utf8)!)
return obj
} catch _ {
return nil
}
}
class AppMessage: Decodable, Encodable {
init() {
id = ""
command = ""
data = nil
responseData = nil
responseError = nil
}
var id: String
var command: String
var data: String?
var responseData: String?
var responseError: Bool?
var senderTab: Tab?
}
class StorageData: Decodable, Encodable {
var key: String
var obj: String?
}
class TabQueryOptions: Decodable, Encodable {
var currentWindow: Bool?
var active: Bool?
}
class Tab: Decodable, Encodable {
init() {
id = ""
index = -1
windowId = -100
title = ""
active = false
url = ""
}
var id: String
var index: Int
var windowId: Int
var title: String?
var active: Bool
var url: String?
}
class TabMessage: Decodable, Encodable {
var tab: Tab
var obj: String
var options: TabMessageOptions?
}
class TabMessageOptions: Decodable, Encodable {
var frameId: Int?
}
class DownloadFileMessage: Decodable, Encodable {
var fileName: String
var blobData: String?
var blobOptions: DownloadFileMessageBlobOptions?
}
class DownloadFileMessageBlobOptions: Decodable, Encodable {
var type: String?
}

View File

@ -1,109 +0,0 @@
import SafariServices
import os.log
let SFExtensionMessageKey = "message"
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
func beginRequest(with context: NSExtensionContext) {
let item = context.inputItems[0] as! NSExtensionItem
let message = item.userInfo?[SFExtensionMessageKey] as AnyObject?
os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg)
let response = NSExtensionItem()
guard let command = message?["command"] as? String else {
return
}
switch (command) {
case "readFromClipboard":
let pasteboard = NSPasteboard.general
response.userInfo = [ SFExtensionMessageKey: pasteboard.pasteboardItems?.first?.string(forType: .string) as Any ]
break
case "showPopover":
SFSafariApplication.getActiveWindow { win in
win?.getToolbarItem(completionHandler: { item in
item?.showPopover()
})
}
break
case "downloadFile":
guard let jsonData = message?["data"] as? String else {
return
}
guard let dlMsg: DownloadFileMessage = jsonDeserialize(json: jsonData) else {
return
}
var blobData: Data?
if dlMsg.blobOptions?.type == "text/plain" {
blobData = dlMsg.blobData?.data(using: .utf8)
} else if let blob = dlMsg.blobData {
blobData = Data(base64Encoded: blob)
}
guard let data = blobData else {
return
}
let panel = NSSavePanel()
panel.canCreateDirectories = true
panel.nameFieldStringValue = dlMsg.fileName
panel.begin { response in
if response == NSApplication.ModalResponse.OK {
if let url = panel.url {
do {
let fileManager = FileManager.default
if !fileManager.fileExists(atPath: url.absoluteString) {
fileManager.createFile(atPath: url.absoluteString, contents: Data(),
attributes: nil)
}
try data.write(to: url)
} catch {
print(error)
NSLog("ERROR in downloadFile, \(error)")
}
}
}
}
break
default:
return
}
context.completeRequest(returningItems: [response], completionHandler: nil)
}
}
func jsonSerialize<T: Encodable>(obj: T?) -> String? {
let encoder = JSONEncoder()
do {
let data = try encoder.encode(obj)
return String(data: data, encoding: .utf8) ?? "null"
} catch _ {
return "null"
}
}
func jsonDeserialize<T: Decodable>(json: String?) -> T? {
if json == nil {
return nil
}
let decoder = JSONDecoder()
do {
let obj = try decoder.decode(T.self, from: json!.data(using: .utf8)!)
return obj
} catch _ {
return nil
}
}
class DownloadFileMessage: Decodable, Encodable {
var fileName: String
var blobData: String?
var blobOptions: DownloadFileMessageBlobOptions?
}
class DownloadFileMessageBlobOptions: Decodable, Encodable {
var type: String?
}

Binary file not shown.

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html class="browser_safari">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bitwarden</title>
<base href="">
<link href="main.css" rel="stylesheet">
</head>
<body>
<app-root>
<div id="loading"><i class="fa fa-spinner fa-spin fa-3x" aria-hidden="true"></i></div>
</app-root>
<script type="text/javascript">
const urlParams = new URLSearchParams(window.location.search);
window.safariAppExtension = true;
window.bitwardenLocaleStrings = null;
window.bitwardenApplicationVersion = urlParams.get('appVersion');
</script>
<script type="text/javascript" src="../vendor.js"></script>
<script type="text/javascript" src="../background.js"></script>
<script type="text/javascript" src="vendor.js"></script>
<script type="text/javascript" src="vendor-angular.js"></script>
<script type="text/javascript" src="main.js"></script>
</body>
</html>

View File

@ -1,8 +1,16 @@
import { BrowserApi } from '../browser/browserApi';
import { SafariApp } from '../browser/safariApp';
import { MessagingService } from 'jslib/abstractions/messaging.service';
export default class BrowserMessagingService implements MessagingService {
send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
chrome.runtime.sendMessage(message);
if (BrowserApi.isSafariApi) {
SafariApp.sendMessageToApp(subscriber, arg);
SafariApp.sendMessageToListeners(message, 'BrowserMessagingService', null);
} else {
chrome.runtime.sendMessage(message);
}
}
}

View File

@ -27,7 +27,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
return this.deviceCache;
}
if (navigator.userAgent.indexOf(' Safari/') !== -1) {
if (this.isSafariExtension()) {
this.deviceCache = DeviceType.SafariExtension;
} else if (navigator.userAgent.indexOf(' Firefox/') !== -1 || navigator.userAgent.indexOf(' Gecko/') !== -1) {
this.deviceCache = DeviceType.FirefoxExtension;
@ -190,7 +190,13 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
}
const clearing = options ? !!options.clearing : false;
const clearMs: number = options && options.clearMs ? options.clearMs : null;
if (this.isFirefox() && (win as any).navigator.clipboard && (win as any).navigator.clipboard.writeText) {
if (this.isSafariExtension()) {
SafariApp.sendMessageToApp('copyToClipboard', text).then(() => {
if (!clearing && this.clipboardWriteCallback != null) {
this.clipboardWriteCallback(text, clearMs);
}
});
} else if (this.isFirefox() && (win as any).navigator.clipboard && (win as any).navigator.clipboard.writeText) {
(win as any).navigator.clipboard.writeText(text).then(() => {
if (!clearing && this.clipboardWriteCallback != null) {
this.clipboardWriteCallback(text, clearMs);
@ -238,7 +244,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
doc = options.doc;
}
if (this.isSafari()) {
if (this.isSafariExtension()) {
return await SafariApp.sendMessageToApp('readFromClipboard');
} else if (this.isFirefox() && (win as any).navigator.clipboard && (win as any).navigator.clipboard.readText) {
return await (win as any).navigator.clipboard.readText();
@ -305,6 +311,10 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
return false;
}
private isSafariExtension(): boolean {
return (window as any).safariAppExtension === true;
}
getDefaultSystemTheme() {
return this.prefersColorSchemeDark.matches ? 'dark' : 'light';
}

View File

@ -1,47 +1,63 @@
import { StorageService } from 'jslib/abstractions/storage.service';
import {
PlatformUtilsService,
StorageService,
} from 'jslib/abstractions';
import { SafariApp } from '../browser/safariApp';
export default class BrowserStorageService implements StorageService {
private chromeStorageApi: any;
private isSafari: boolean;
constructor() {
this.chromeStorageApi = chrome.storage.local;
constructor(platformUtilsService: PlatformUtilsService) {
this.isSafari = platformUtilsService.isSafari();
if (!this.isSafari) {
this.chromeStorageApi = chrome.storage.local;
}
}
async get<T>(key: string): Promise<T> {
return new Promise((resolve) => {
this.chromeStorageApi.get(key, (obj: any) => {
if (obj != null && obj[key] != null) {
resolve(obj[key] as T);
return;
}
resolve(null);
if (this.isSafari) {
const obj = await SafariApp.sendMessageToApp('storage_get', key);
return obj == null ? null : JSON.parse(obj) as T;
} else {
return new Promise((resolve) => {
this.chromeStorageApi.get(key, (obj: any) => {
if (obj != null && obj[key] != null) {
resolve(obj[key] as T);
return;
}
resolve(null);
});
});
});
}
}
async save(key: string, obj: any): Promise<any> {
if (obj == null) {
// Fix safari not liking null in set
const keyedObj = { [key]: obj };
if (this.isSafari) {
await SafariApp.sendMessageToApp('storage_save', JSON.stringify({
key: key,
obj: JSON.stringify(obj),
}));
} else {
return new Promise((resolve) => {
this.chromeStorageApi.set(keyedObj, () => {
resolve();
});
});
}
}
async remove(key: string): Promise<any> {
if (this.isSafari) {
await SafariApp.sendMessageToApp('storage_remove', key);
} else {
return new Promise((resolve) => {
this.chromeStorageApi.remove(key, () => {
resolve();
});
});
}
const keyedObj = { [key]: obj };
return new Promise((resolve) => {
this.chromeStorageApi.set(keyedObj, () => {
resolve();
});
});
}
async remove(key: string): Promise<any> {
return new Promise((resolve) => {
this.chromeStorageApi.remove(key, () => {
resolve();
});
});
}
}

View File

@ -1,11 +1,19 @@
import { I18nService as BaseI18nService } from 'jslib/services/i18n.service';
import { BrowserApi } from '../browser/browserApi';
import { SafariApp } from '../browser/safariApp';
export default class I18nService extends BaseI18nService {
constructor(systemLanguage: string) {
super(systemLanguage, null, async (formattedLocale: string) => {
// Deprecated
const file = await fetch(this.localesDirectory + formattedLocale + '/messages.json');
return await file.json();
super(systemLanguage, BrowserApi.isSafariApi ? 'safari' : null, async (formattedLocale: string) => {
if (BrowserApi.isSafariApi) {
await SafariApp.sendMessageToApp('getLocaleStrings', formattedLocale);
return (window as any).bitwardenLocaleStrings;
} else {
// Deprecated
const file = await fetch(this.localesDirectory + formattedLocale + '/messages.json');
return await file.json();
}
});
this.supportedTranslationLocales = [