From f93ffb969537aec4e48ab5b61af60850e618bb4d Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Thu, 6 Jul 2023 18:02:37 -0400 Subject: [PATCH] fix missing string crash --- app/src/index.ts | 29 +++++++++++++---------------- app/src/telemetry.ts | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/src/index.ts b/app/src/index.ts index 3d47add93..02da8a1eb 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -28,10 +28,7 @@ const createSystemtray = () => { }) } - - const contextMenu = Menu.buildFromTemplate([ - { role: 'quit', label: 'Quit Ollama', accelerator: 'Command+Q' }, - ]) + const contextMenu = Menu.buildFromTemplate([{ role: 'quit', label: 'Quit Ollama', accelerator: 'Command+Q' }]) tray.setContextMenu(contextMenu) tray.setToolTip('Ollama') @@ -91,7 +88,7 @@ function installCLI() { .showMessageBox({ type: 'info', title: 'Ollama CLI installation', - message: 'To install the Ollama CLI, we need to ask you for administrator privileges.', + message: 'To make the Ollama command line work in your terminal, it needs administrator privileges.', buttons: ['OK'], }) .then(result => { @@ -111,35 +108,36 @@ function installCLI() { }) } -if (!SingleInstanceLock) { +if (!SingleInstanceLock) { app.quit() } else { app.on('ready', () => { if (process.platform === 'darwin') { app.dock.hide() - + if (!app.isInApplicationsFolder()) { const chosen = dialog.showMessageBoxSync({ type: 'question', buttons: ['Move to Applications', 'Do Not Move'], - message: 'Move Ollama to the Applications directory?', + message: 'Ollama works best when run from the Applications directory.', defaultId: 0, - cancelId: 1 + cancelId: 1, }) - + if (chosen === 0) { try { app.moveToApplicationsFolder({ - conflictHandler: (conflictType) => { + conflictHandler: conflictType => { if (conflictType === 'existsAndRunning') { dialog.showMessageBoxSync({ type: 'info', message: 'Cannot move to Applications directory', - detail: 'Another version of Ollama is currently running from your Applications directory. Close it first and try again.' + detail: + 'Another version of Ollama is currently running from your Applications directory. Close it first and try again.', }) } return true - } + }, }) return } catch (e) { @@ -149,16 +147,15 @@ if (!SingleInstanceLock) { } } } - + createSystemtray() - + if (app.isPackaged) { installCLI() } }) } - // Quit when all windows are closed, except on macOS. There, it's common // for applications and their menu bar to stay active until the user quits // explicitly with Cmd + Q. diff --git a/app/src/telemetry.ts b/app/src/telemetry.ts index b585f2eb9..a2dc81f07 100644 --- a/app/src/telemetry.ts +++ b/app/src/telemetry.ts @@ -4,7 +4,7 @@ import { v4 as uuidv4 } from 'uuid' const Store = require('electron-store') const store = new Store() -export const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || '' }) +export const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || '' }) export function id(): string { const id = store.get('id')