Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
e751e47d
Commit
e751e47d
authored
Jul 26, 2023
by
Jeffrey Morgan
Browse files
app: remove dialog, icons for updates
parent
19d0f2b4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
63 additions
and
54 deletions
+63
-54
app/assets/iconTemplate.png
app/assets/iconTemplate.png
+0
-0
app/assets/iconTemplate@2x.png
app/assets/iconTemplate@2x.png
+0
-0
app/assets/iconUpdateTemplate.png
app/assets/iconUpdateTemplate.png
+0
-0
app/assets/iconUpdateTemplate@2x.png
app/assets/iconUpdateTemplate@2x.png
+0
-0
app/assets/ollama_icon_16x16Template.png
app/assets/ollama_icon_16x16Template.png
+0
-0
app/assets/ollama_icon_16x16Template@2x.png
app/assets/ollama_icon_16x16Template@2x.png
+0
-0
app/assets/ollama_outline_icon_16x16Template.png
app/assets/ollama_outline_icon_16x16Template.png
+0
-0
app/forge.config.ts
app/forge.config.ts
+4
-4
app/src/index.ts
app/src/index.ts
+56
-48
scripts/publish.sh
scripts/publish.sh
+3
-2
No files found.
app/assets/iconTemplate.png
0 → 100644
View file @
e751e47d
447 Bytes
app/assets/
ollama_outline_icon_16x16
Template@2x.png
→
app/assets/
icon
Template@2x.png
View file @
e751e47d
File moved
app/assets/iconUpdateTemplate.png
0 → 100644
View file @
e751e47d
443 Bytes
app/assets/iconUpdateTemplate@2x.png
0 → 100644
View file @
e751e47d
844 Bytes
app/assets/ollama_icon_16x16Template.png
deleted
100644 → 0
View file @
19d0f2b4
403 Bytes
app/assets/ollama_icon_16x16Template@2x.png
deleted
100644 → 0
View file @
19d0f2b4
741 Bytes
app/assets/ollama_outline_icon_16x16Template.png
deleted
100644 → 0
View file @
19d0f2b4
445 Bytes
app/forge.config.ts
View file @
e751e47d
...
...
@@ -19,10 +19,10 @@ const config: ForgeConfig = {
icon
:
'
./assets/icon.icns
'
,
extraResource
:
[
'
../ollama
'
,
path
.
join
(
__dirname
,
'
./assets/
ollama_icon_16x16
Template.png
'
),
path
.
join
(
__dirname
,
'
./assets/
ollama_icon_16x16
Template@2x.png
'
),
path
.
join
(
__dirname
,
'
./assets/
ollama_outline_icon_16x16
Template.png
'
),
path
.
join
(
__dirname
,
'
./assets/
ollama_outline_icon_16x16
Template@2x.png
'
),
path
.
join
(
__dirname
,
'
./assets/
icon
Template.png
'
),
path
.
join
(
__dirname
,
'
./assets/
icon
Template@2x.png
'
),
path
.
join
(
__dirname
,
'
./assets/
iconUpdate
Template.png
'
),
path
.
join
(
__dirname
,
'
./assets/
iconUpdate
Template@2x.png
'
),
...(
process
.
platform
===
'
darwin
'
?
[
'
../llama/ggml-metal.metal
'
]
:
[]),
],
...(
process
.
env
.
SIGN
...
...
app/src/index.ts
View file @
e751e47d
import
{
spawn
}
from
'
child_process
'
import
{
app
,
autoUpdater
,
dialog
,
Tray
,
Menu
,
BrowserWindow
,
nativeTheme
}
from
'
electron
'
import
{
app
,
autoUpdater
,
dialog
,
Tray
,
Menu
,
BrowserWindow
,
MenuItemConstructorOptions
,
nativeTheme
,
systemPreferences
,
}
from
'
electron
'
import
Store
from
'
electron-store
'
import
winston
from
'
winston
'
import
'
winston-daily-rotate-file
'
...
...
@@ -11,7 +21,7 @@ import { installed } from './install'
require
(
'
@electron/remote/main
'
).
initialize
()
const
store
=
new
Store
()
let
tray
:
Tray
|
null
=
null
let
welcomeWindow
:
BrowserWindow
|
null
=
null
declare
const
MAIN_WINDOW_WEBPACK_ENTRY
:
string
...
...
@@ -61,35 +71,42 @@ function firstRunWindow() {
}
}
function
createSystemtray
()
{
let
iconPath
=
nativeTheme
.
shouldUseDarkColors
?
path
.
join
(
__dirname
,
'
..
'
,
'
..
'
,
'
assets
'
,
'
ollama_icon_16x16Template.png
'
)
:
path
.
join
(
__dirname
,
'
..
'
,
'
..
'
,
'
assets
'
,
'
ollama_outline_icon_16x16Template.png
'
)
let
tray
:
Tray
|
null
=
null
if
(
app
.
isPackaged
)
{
iconPath
=
nativeTheme
.
shouldUseDarkColors
?
path
.
join
(
process
.
resourcesPath
,
'
ollama_icon_16x16Template.png
'
)
:
path
.
join
(
process
.
resourcesPath
,
'
ollama_outline_icon_16x16Template.png
'
)
function
setTray
(
updateAvailable
:
boolean
)
{
const
menuItemAvailable
:
MenuItemConstructorOptions
=
{
label
:
'
Restart to update
'
,
click
:
()
=>
autoUpdater
.
quitAndInstall
(),
}
tray
=
new
Tray
(
iconPath
)
nativeTheme
.
on
(
'
updated
'
,
function
theThemeHasChanged
()
{
if
(
nativeTheme
.
shouldUseDarkColors
)
{
app
.
isPackaged
?
tray
.
setImage
(
path
.
join
(
process
.
resourcesPath
,
'
ollama_icon_16x16Template.png
'
))
:
tray
.
setImage
(
path
.
join
(
__dirname
,
'
..
'
,
'
..
'
,
'
assets
'
,
'
ollama_icon_16x16Template.png
'
))
}
else
{
app
.
isPackaged
?
tray
.
setImage
(
path
.
join
(
process
.
resourcesPath
,
'
ollama_outline_icon_16x16Template.png
'
))
:
tray
.
setImage
(
path
.
join
(
__dirname
,
'
..
'
,
'
..
'
,
'
assets
'
,
'
ollama_outline_icon_16x16Template.png
'
))
}
})
const
menuItemUpToDate
:
MenuItemConstructorOptions
=
{
label
:
'
Ollama is up to date
'
,
enabled
:
false
,
}
const
contextMenu
=
Menu
.
buildFromTemplate
([{
role
:
'
quit
'
,
label
:
'
Quit Ollama
'
,
accelerator
:
'
Command+Q
'
}])
const
menu
=
Menu
.
buildFromTemplate
([
...(
updateAvailable
?
[{
label
:
'
An update is available
'
,
enabled
:
false
},
menuItemAvailable
]
:
[
menuItemUpToDate
]),
{
type
:
'
separator
'
},
{
role
:
'
quit
'
,
label
:
'
Quit Ollama
'
,
accelerator
:
'
Command+Q
'
},
])
const
iconPath
=
app
.
isPackaged
?
updateAvailable
?
path
.
join
(
process
.
resourcesPath
,
'
iconUpdateTemplate.png
'
)
:
path
.
join
(
process
.
resourcesPath
,
'
iconTemplate.png
'
)
:
updateAvailable
?
path
.
join
(
__dirname
,
'
..
'
,
'
..
'
,
'
assets
'
,
'
iconUpdateTemplate.png
'
)
:
path
.
join
(
__dirname
,
'
..
'
,
'
..
'
,
'
assets
'
,
'
iconTemplate.png
'
)
if
(
!
tray
)
{
tray
=
new
Tray
(
iconPath
)
}
tray
.
setContextMenu
(
contextMenu
)
tray
.
setToolTip
(
'
Ollama
'
)
tray
.
setToolTip
(
updateAvailable
?
'
An update is available
'
:
'
Ollama
'
)
tray
.
setContextMenu
(
menu
)
tray
.
setImage
(
iconPath
)
}
if
(
require
(
'
electron-squirrel-startup
'
))
{
...
...
@@ -128,6 +145,17 @@ if (process.platform === 'darwin') {
}
app
.
on
(
'
ready
'
,
()
=>
{
setTray
(
false
)
if
(
app
.
isPackaged
)
{
heartbeat
()
autoUpdater
.
checkForUpdates
()
setInterval
(()
=>
{
heartbeat
()
autoUpdater
.
checkForUpdates
()
},
60
*
60
*
1000
)
}
if
(
process
.
platform
===
'
darwin
'
)
{
if
(
app
.
isPackaged
)
{
if
(
!
app
.
isInApplicationsFolder
())
{
...
...
@@ -163,7 +191,6 @@ app.on('ready', () => {
}
}
createSystemtray
()
server
()
if
(
store
.
get
(
'
first-time-run
'
)
&&
installed
())
{
...
...
@@ -201,29 +228,10 @@ async function heartbeat() {
})
}
if
(
app
.
isPackaged
)
{
heartbeat
()
autoUpdater
.
checkForUpdates
()
setInterval
(()
=>
{
heartbeat
()
autoUpdater
.
checkForUpdates
()
},
60
*
60
*
1000
)
}
autoUpdater
.
on
(
'
error
'
,
e
=>
{
console
.
error
(
`update check failed -
${
e
.
message
}
`
)
})
autoUpdater
.
on
(
'
update-downloaded
'
,
(
_
,
releaseNotes
,
releaseName
)
=>
{
dialog
.
showMessageBox
({
type
:
'
info
'
,
buttons
:
[
'
Restart Now
'
,
'
Later
'
],
title
:
'
New update available
'
,
message
:
process
.
platform
===
'
win32
'
?
releaseNotes
:
releaseName
,
detail
:
'
A new version of Ollama is available. Restart to apply the update.
'
,
})
.
then
(
returnValue
=>
{
if
(
returnValue
.
response
===
0
)
autoUpdater
.
quitAndInstall
()
})
autoUpdater
.
on
(
'
update-downloaded
'
,
()
=>
{
setTray
(
true
)
})
scripts/publish.sh
View file @
e751e47d
...
...
@@ -17,15 +17,16 @@ npm --prefix app run make:sign
# Create a new tag if it doesn't exist.
if
!
git rev-parse v
$VERSION
>
/dev/null 2>&1
;
then
git tag v
$VERSION
git push origin v
$VERSION
fi
git push origin v
$VERSION
mkdir
-p
dist
cp
app/out/make/zip/
${
OS
}
/
${
ARCH
}
/Ollama-
${
OS
}
-
${
ARCH
}
-
${
VERSION
}
.zip dist/Ollama-
${
OS
}
-
${
ARCH
}
.zip
cp
./ollama dist/ollama-
${
OS
}
-
${
ARCH
}
# Create a new release.
gh release create
-p
v
$VERSION
gh release create
-p
v
$VERSION
-t
v
$VERSION
# Upload the zip file.
gh release upload v
$VERSION
./dist/Ollama-
${
OS
}
-
${
ARCH
}
.zip
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment