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
b9a186c8
Commit
b9a186c8
authored
Jul 06, 2023
by
Jeffrey Morgan
Browse files
basic telemetry
parent
8681ba0e
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
334 additions
and
37 deletions
+334
-37
app/package-lock.json
app/package-lock.json
+296
-35
app/package.json
app/package.json
+6
-2
app/src/index.ts
app/src/index.ts
+13
-0
app/src/telemetry.ts
app/src/telemetry.ts
+19
-0
No files found.
app/package-lock.json
View file @
b9a186c8
This diff is collapsed.
Click to expand it.
app/package.json
View file @
b9a186c8
...
@@ -31,8 +31,10 @@
...
@@ -31,8 +31,10 @@
"@electron-forge/plugin-webpack"
:
"^6.2.1"
,
"@electron-forge/plugin-webpack"
:
"^6.2.1"
,
"@electron-forge/publisher-github"
:
"^6.2.1"
,
"@electron-forge/publisher-github"
:
"^6.2.1"
,
"@types/chmodr"
:
"^1.0.0"
,
"@types/chmodr"
:
"^1.0.0"
,
"@types/node"
:
"^20.3.1"
,
"@types/react"
:
"^18.2.14"
,
"@types/react"
:
"^18.2.14"
,
"@types/react-dom"
:
"^18.2.6"
,
"@types/react-dom"
:
"^18.2.6"
,
"@types/uuid"
:
"^9.0.2"
,
"@typescript-eslint/eslint-plugin"
:
"^5.60.0"
,
"@typescript-eslint/eslint-plugin"
:
"^5.60.0"
,
"@typescript-eslint/parser"
:
"^5.60.0"
,
"@typescript-eslint/parser"
:
"^5.60.0"
,
"@vercel/webpack-asset-relocator-loader"
:
"^1.7.3"
,
"@vercel/webpack-asset-relocator-loader"
:
"^1.7.3"
,
...
@@ -62,9 +64,11 @@
...
@@ -62,9 +64,11 @@
},
},
"dependencies"
:
{
"dependencies"
:
{
"@electron/remote"
:
"^2.0.10"
,
"@electron/remote"
:
"^2.0.10"
,
"@
types/
node"
:
"^
20.3.1
"
,
"@
segment/analytics-
node"
:
"^
1.0.0
"
,
"electron-squirrel-startup"
:
"^1.0.0"
,
"electron-squirrel-startup"
:
"^1.0.0"
,
"electron-store"
:
"^8.1.0"
,
"react"
:
"^18.2.0"
,
"react"
:
"^18.2.0"
,
"react-dom"
:
"^18.2.0"
"react-dom"
:
"^18.2.0"
,
"uuid"
:
"^9.0.0"
}
}
}
}
app/src/index.ts
View file @
b9a186c8
...
@@ -3,6 +3,8 @@ import { app, autoUpdater, dialog, Tray, Menu, nativeTheme } from 'electron'
...
@@ -3,6 +3,8 @@ import { app, autoUpdater, dialog, Tray, Menu, nativeTheme } from 'electron'
import
*
as
path
from
'
path
'
import
*
as
path
from
'
path
'
import
*
as
fs
from
'
fs
'
import
*
as
fs
from
'
fs
'
import
{
analytics
,
id
}
from
'
./telemetry
'
require
(
'
@electron/remote/main
'
).
initialize
()
require
(
'
@electron/remote/main
'
).
initialize
()
let
tray
:
Tray
|
null
=
null
let
tray
:
Tray
|
null
=
null
...
@@ -172,9 +174,20 @@ autoUpdater.setFeedURL({
...
@@ -172,9 +174,20 @@ autoUpdater.setFeedURL({
url
:
`https://ollama.ai/api/update?os=
${
process
.
platform
}
&arch=
${
process
.
arch
}
&version=
${
app
.
getVersion
()}
`
,
url
:
`https://ollama.ai/api/update?os=
${
process
.
platform
}
&arch=
${
process
.
arch
}
&version=
${
app
.
getVersion
()}
`
,
})
})
async
function
heartbeat
()
{
analytics
.
track
({
anonymousId
:
id
(),
event
:
'
heartbeat
'
,
})
}
heartbeat
()
if
(
app
.
isPackaged
)
{
if
(
app
.
isPackaged
)
{
heartbeat
()
autoUpdater
.
checkForUpdates
()
autoUpdater
.
checkForUpdates
()
setInterval
(()
=>
{
setInterval
(()
=>
{
heartbeat
()
autoUpdater
.
checkForUpdates
()
autoUpdater
.
checkForUpdates
()
},
60000
)
},
60000
)
}
}
...
...
app/src/telemetry.ts
0 → 100644
View file @
b9a186c8
import
{
Analytics
}
from
'
@segment/analytics-node
'
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
function
id
():
string
{
const
id
=
store
.
get
(
'
id
'
)
if
(
id
)
{
return
id
}
const
uuid
=
uuidv4
()
store
.
set
(
'
id
'
,
uuid
)
return
uuid
}
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