Skip to content

Commit b0f94f2

Browse files
committed
Revert "Revert "Integrate Station Core (#621)""
This reverts commit 0b0403c.
1 parent 0b0403c commit b0f94f2

27 files changed

+2245
-7180
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,3 @@ dev-app-update.yml
3232
*.sln
3333
*.sw?
3434
.tool-versions
35-
36-
build/saturn

build/download-saturn-l2.js

Lines changed: 0 additions & 157 deletions
This file was deleted.

electron-builder.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ files:
1212
- node_modules/**/*
1313
- package.json
1414

15-
extraResources:
16-
- from: 'build/saturn/l2node-${platform}-${arch}'
17-
to: 'saturn-l2-node'
18-
filter: ['*']
19-
2015
asarUnpack: 'main/**/scripts/**/*'
2116

2217
beforePack: './build/before-pack.js'

main/activity-log.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

main/app-menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ function setupAppMenu (/** @type {import('./typings').Context} */ ctx) {
1111

1212
// File menu
1313
menu.items[1].submenu?.insert(0, new MenuItem({
14-
label: 'Save Saturn Module Log As…',
15-
click: () => { ctx.saveSaturnModuleLogAs() }
14+
label: 'Save Module Logs As…',
15+
click: () => { ctx.saveModuleLogsAs() }
1616
}))
1717

1818
Menu.setApplicationMenu(menu)

main/consts.js

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ const { app } = require('electron')
44
const os = require('os')
55
const packageJson = require('../package.json')
66
const path = require('path')
7+
const assert = require('assert')
78

89
const { getBuildVersion } = require('./build-version')
910

11+
const appIDs = {
12+
darwin: 'app.filstation.desktop',
13+
win32: 'Filecoin Station Desktop',
14+
linux: 'filecoin-station-desktop'
15+
}
16+
1017
module.exports = Object.freeze({
11-
CACHE_HOME: getCacheHome(),
18+
CACHE_ROOT: getCacheRoot(),
19+
STATE_ROOT: getStateRoot(),
20+
LEGACY_CACHE_HOME: getLegacyCacheHome(),
1221
IS_MAC: os.platform() === 'darwin',
1322
IS_WIN: os.platform() === 'win32',
1423
IS_APPIMAGE: typeof process.env.APPIMAGE !== 'undefined',
@@ -20,7 +29,64 @@ module.exports = Object.freeze({
2029

2130
// Replace with `app.get('localUserData')` after this PR is landed & released:
2231
// https://github.com/electron/electron/pull/34337
23-
function getCacheHome () {
32+
function getCacheRoot () {
33+
if (process.env.STATION_ROOT) {
34+
return path.join(process.env.STATION_ROOT, 'cache')
35+
}
36+
37+
const platform = os.platform()
38+
switch (platform) {
39+
case 'darwin':
40+
return path.join(app.getPath('home'), 'Library', 'Caches', appIDs.darwin)
41+
case 'win32':
42+
assert(
43+
process.env.TEMP,
44+
'Unsupported Windows environment: TEMP must be set.'
45+
)
46+
return path.join(process.env.TEMP, appIDs.win32)
47+
case 'linux':
48+
return path.join(
49+
process.env.XDG_CACHE_HOME || path.join(app.getPath('home'), '.cache'),
50+
appIDs.linux
51+
)
52+
default:
53+
throw new Error(`Unsupported platform: ${platform}`)
54+
}
55+
}
56+
57+
function getStateRoot () {
58+
if (process.env.STATION_ROOT) {
59+
return path.join(process.env.STATION_ROOT, 'state')
60+
}
61+
62+
const platform = os.platform()
63+
switch (platform) {
64+
case 'darwin':
65+
return path.join(
66+
app.getPath('home'),
67+
'Library',
68+
'Application Support',
69+
appIDs.darwin
70+
)
71+
case 'win32':
72+
assert(
73+
process.env.LOCALAPPDATA,
74+
'Unsupported Windows environment: LOCALAPPDATA must be set.'
75+
)
76+
return path.join(process.env.LOCALAPPDATA, appIDs.win32)
77+
case 'linux':
78+
return path.join(
79+
process.env.XDG_STATE_HOME ||
80+
path.join(app.getPath('home'), '.local', 'state'),
81+
appIDs.linux
82+
)
83+
default:
84+
throw new Error(`Unsupported platform: ${platform}`)
85+
}
86+
}
87+
88+
// Used for migrations
89+
function getLegacyCacheHome () {
2490
if (process.env.STATION_ROOT) {
2591
return path.join(process.env.STATION_ROOT, 'cache')
2692
}

0 commit comments

Comments
 (0)