osu-play 1.0.1 → 1.0.2
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.
- package/bin/osu-play.js +1 -1
- package/dist/cli/main.cjs +400 -0
- package/dist/cli/main.cjs.map +1 -0
- package/dist/cli/main.d.cts +3 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +365 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/mod.cjs +367 -0
- package/dist/mod.cjs.map +1 -0
- package/dist/mod.d.cts +121 -0
- package/dist/mod.d.ts +121 -0
- package/dist/mod.js +335 -0
- package/dist/mod.js.map +1 -0
- package/package.json +16 -4
- package/tsconfig.json +7 -3
- package/src/main.ts +0 -72
- package/src/realm/mod.ts +0 -54
- package/src/realm/schema/beatmap.ts +0 -85
- package/src/realm/schema/beatmapMetadata.ts +0 -33
- package/src/realm/schema/beatmapSet.ts +0 -36
- package/src/realm/schema/mod.ts +0 -7
- package/src/realm/schema/realmFile.ts +0 -15
- package/src/realm/schema/realmNamedFileUsage.ts +0 -19
- package/src/realm/schema/realmUser.ts +0 -21
- package/src/utils/mod.ts +0 -81
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import Realm from "realm";
|
|
2
|
-
import type { ObjectSchema } from "realm";
|
|
3
|
-
import { Beatmap } from "./beatmap.js";
|
|
4
|
-
import { RealmNamedFileUsage } from "./realmNamedFileUsage.js";
|
|
5
|
-
|
|
6
|
-
export class BeatmapSet extends Realm.Object<BeatmapSet> {
|
|
7
|
-
ID!: string;
|
|
8
|
-
OnlineID!: number;
|
|
9
|
-
DateAdded!: Date;
|
|
10
|
-
DateSubmitted?: Date;
|
|
11
|
-
DateRanked?: Date;
|
|
12
|
-
Beatmaps!: Array<Beatmap>;
|
|
13
|
-
Files!: Array<RealmNamedFileUsage>;
|
|
14
|
-
Status!: number;
|
|
15
|
-
DeletePending!: boolean;
|
|
16
|
-
Hash?: string;
|
|
17
|
-
Protected!: boolean;
|
|
18
|
-
|
|
19
|
-
static schema: ObjectSchema = {
|
|
20
|
-
name: "BeatmapSet",
|
|
21
|
-
primaryKey: "ID",
|
|
22
|
-
properties: {
|
|
23
|
-
ID: { type: "uuid", default: "" },
|
|
24
|
-
OnlineID: { type: "int", default: -1 },
|
|
25
|
-
DateAdded: { type: "date" },
|
|
26
|
-
DateSubmitted: { type: "date", optional: true },
|
|
27
|
-
DateRanked: { type: "date", optional: true },
|
|
28
|
-
Beatmaps: { type: "list", objectType: "Beatmap", default: [] },
|
|
29
|
-
Files: { type: "list", objectType: "RealmNamedFileUsage", default: [] },
|
|
30
|
-
Status: { type: "int", default: -3 },
|
|
31
|
-
DeletePending: { type: "bool", default: false },
|
|
32
|
-
Hash: { type: "string", default: "", optional: true },
|
|
33
|
-
Protected: { type: "bool", default: false },
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
package/src/realm/schema/mod.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { Beatmap } from "./beatmap.js";
|
|
2
|
-
export { BeatmapMetadata } from "./beatmapMetadata.js";
|
|
3
|
-
export { BeatmapSet } from "./beatmapSet.js";
|
|
4
|
-
export { RealmFile } from "./realmFile.js";
|
|
5
|
-
export { RealmUser } from "./realmUser.js";
|
|
6
|
-
export { RealmNamedFileUsage } from "./realmNamedFileUsage.js";
|
|
7
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Realm from "realm";
|
|
2
|
-
import type { ObjectSchema } from "realm";
|
|
3
|
-
|
|
4
|
-
export class RealmFile extends Realm.Object<RealmFile> {
|
|
5
|
-
Hash?: string;
|
|
6
|
-
|
|
7
|
-
static schema: ObjectSchema = {
|
|
8
|
-
name: "File",
|
|
9
|
-
primaryKey: "Hash",
|
|
10
|
-
properties: {
|
|
11
|
-
Hash: { type: "string", default: "", optional: true },
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Realm from "realm";
|
|
2
|
-
import type { ObjectSchema } from "realm";
|
|
3
|
-
import { RealmFile } from "./realmFile.js";
|
|
4
|
-
|
|
5
|
-
export class RealmNamedFileUsage extends Realm.Object<RealmNamedFileUsage> {
|
|
6
|
-
File!: RealmFile;
|
|
7
|
-
Filename?: string;
|
|
8
|
-
|
|
9
|
-
static embedded = true;
|
|
10
|
-
|
|
11
|
-
static schema: ObjectSchema = {
|
|
12
|
-
name: "RealmNamedFileUsage",
|
|
13
|
-
embedded: true,
|
|
14
|
-
properties: {
|
|
15
|
-
File: "File",
|
|
16
|
-
Filename: { type: "string", optional: true },
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import Realm from "realm";
|
|
2
|
-
import type { ObjectSchema } from "realm";
|
|
3
|
-
|
|
4
|
-
export class RealmUser extends Realm.Object<RealmUser> {
|
|
5
|
-
OnlineID!: number;
|
|
6
|
-
Username?: string;
|
|
7
|
-
CountryCode?: string;
|
|
8
|
-
|
|
9
|
-
static embedded = true;
|
|
10
|
-
|
|
11
|
-
static schema: ObjectSchema = {
|
|
12
|
-
name: "RealmUser",
|
|
13
|
-
embedded: true,
|
|
14
|
-
properties: {
|
|
15
|
-
OnlineID: { type: "int", default: 1 },
|
|
16
|
-
Username: { type: "string", default: "", optional: true },
|
|
17
|
-
CountryCode: { type: "string", optional: true },
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
package/src/utils/mod.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
3
|
-
|
|
4
|
-
export function getDataDir(): string | null {
|
|
5
|
-
switch (process.platform) {
|
|
6
|
-
case "linux":
|
|
7
|
-
case "openbsd":
|
|
8
|
-
case "freebsd": {
|
|
9
|
-
const xdg = process.env["XDG_DATA_HOME"];
|
|
10
|
-
if (xdg) return xdg;
|
|
11
|
-
const home = process.env["HOME"];
|
|
12
|
-
if (home) return path.join(home, ".local", "share");
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
case "darwin": {
|
|
17
|
-
const home = process.env["HOME"];
|
|
18
|
-
if (home) return path.join(home, "Library", "Application Support");
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
case "win32":
|
|
23
|
-
return process.env["LOCALAPPDATA"] ?? null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function getConfigDir(): string | null {
|
|
30
|
-
switch (process.platform) {
|
|
31
|
-
case "openbsd":
|
|
32
|
-
case "freebsd":
|
|
33
|
-
case "linux": {
|
|
34
|
-
const xdg = process.env["XDG_CONFIG_HOME"];
|
|
35
|
-
if (xdg) return xdg;
|
|
36
|
-
const home = process.env["HOME"];
|
|
37
|
-
if (home) return path.join(home, ".config");
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
case "darwin": {
|
|
42
|
-
const home = process.env["HOME"];
|
|
43
|
-
if (home) return path.join(home, "Library", "Preferences");
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
case "win32":
|
|
48
|
-
return process.env["APPDATA"] ?? null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Get Realm for the app, import to the config if it doesn't exist
|
|
56
|
-
*/
|
|
57
|
-
export function getRealmDBPath(
|
|
58
|
-
appConfigDir: string,
|
|
59
|
-
osuDataDir?: string,
|
|
60
|
-
reload: boolean = false,
|
|
61
|
-
) {
|
|
62
|
-
const localDBPath = path.join(appConfigDir, "client.realm");
|
|
63
|
-
if (!reload && existsSync(localDBPath)) return localDBPath;
|
|
64
|
-
|
|
65
|
-
const osuDBPath = path.join(
|
|
66
|
-
osuDataDir || getDataDir()! || ".",
|
|
67
|
-
"osu",
|
|
68
|
-
"client.realm",
|
|
69
|
-
);
|
|
70
|
-
if (existsSync(osuDBPath)) {
|
|
71
|
-
console.log(
|
|
72
|
-
`[getRealmDBPath]: ${osuDBPath} is being imported from osu!lazer to ${localDBPath}`,
|
|
73
|
-
);
|
|
74
|
-
mkdirSync(appConfigDir);
|
|
75
|
-
copyFileSync(osuDBPath, localDBPath);
|
|
76
|
-
return localDBPath;
|
|
77
|
-
} else {
|
|
78
|
-
console.log(`[getRealmDBPath]: ${osuDBPath} not found`);
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
}
|