synsci 2.0.2-test.65.1 → 2.0.2-test.67.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/synsci.mjs +16 -3
  2. package/package.json +1 -1
package/bin/synsci.mjs CHANGED
@@ -199,9 +199,22 @@ function hasDeprecatedCli() {
199
199
  function isConnected() {
200
200
  const explicit = process.env.OPENSCIENCE_DATA_DIR?.trim()
201
201
  const xdgData = process.env.XDG_DATA_HOME || join(homedir(), ".local", "share")
202
- const data = explicit ? resolve(explicit) : join(xdgData, "openscience")
203
- const sessionPath = join(data, "openscience-session.json")
204
- if (!existsSync(sessionPath)) return false
202
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join(homedir(), ".config")
203
+ const pointerPath = join(xdgConfig, "openscience", "data-location")
204
+ const pointer = (() => {
205
+ try {
206
+ return readFileSync(pointerPath, "utf-8").trim()
207
+ } catch {
208
+ return ""
209
+ }
210
+ })()
211
+ const roots = explicit
212
+ ? [resolve(explicit)]
213
+ : pointer
214
+ ? [resolve(pointer)]
215
+ : [join(homedir(), ".openscience"), join(xdgData, "openscience")]
216
+ const sessionPath = roots.map((root) => join(root, "openscience-session.json")).find(existsSync)
217
+ if (!sessionPath) return false
205
218
  try {
206
219
  const data = JSON.parse(readFileSync(sessionPath, "utf-8"))
207
220
  if (!data.access_token || !data.expires_at) return false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synsci",
3
- "version": "2.0.2-test.65.1",
3
+ "version": "2.0.2-test.67.1",
4
4
  "description": "Install wizard for OpenScience, the open-source AI research workspace (optionally with Atlas)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",