Skip to content

Commit e67663a

Browse files
committed
Merge branch 'main' into develop
2 parents c936ed5 + 170825a commit e67663a

File tree

27 files changed

+626
-489
lines changed

27 files changed

+626
-489
lines changed

build.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs';
22
import { resolve } from 'path';
33

44
import { getLatestVersionSoundList } from './shared/features/sounds';
5-
import { SEARCH_INCLUDE_PATTERNS } from './shared/features/sounds/filterIncludePatterns';
65

76
function writeJSONFile(
87
dir: string,
@@ -17,7 +16,6 @@ function writeJSONFile(
1716
const dataDir = resolve(__dirname, 'server', 'public', 'data');
1817

1918
const soundListPath = 'soundList.json';
20-
const filteredSoundListPath = 'filteredSoundList.json';
2119

2220
// Try to create the output directory if it doesn't exist
2321
try {
@@ -29,9 +27,7 @@ try {
2927
}
3028

3129
// If the files already exist, exit early
32-
const files = [soundListPath, filteredSoundListPath].map((fileName) =>
33-
resolve(dataDir, fileName),
34-
);
30+
const files = [soundListPath].map((fileName) => resolve(dataDir, fileName));
3531

3632
if (files.every((file) => existsSync(file))) {
3733
console.log('Sound data files already exist; skipping generation.');
@@ -44,16 +40,5 @@ console.log('Generating sound data files...');
4440
// Filter the list to only include sounds that match the chosen patterns
4541
// (defined in the shared/ module)
4642
getLatestVersionSoundList().then((soundList) => {
47-
const filteredSoundList: string[] = Object.keys(soundList)
48-
.filter((sound) =>
49-
SEARCH_INCLUDE_PATTERNS.some((pattern) =>
50-
new RegExp(pattern).test(sound),
51-
),
52-
)
53-
.sort((a, b) =>
54-
a.localeCompare(b, undefined, { sensitivity: 'base', numeric: true }),
55-
);
56-
5743
writeJSONFile(dataDir, soundListPath, soundList);
58-
writeJSONFile(dataDir, filteredSoundListPath, filteredSoundList);
5944
});

pnpm-lock.yaml

Lines changed: 9 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/.env.development.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ S3_SECRET=
3131
S3_REGION=
3232

3333
WHITELISTED_USERS=
34+
35+
DISCORD_WEBHOOK_URL=

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"dependencies": {
2323
"@aws-sdk/client-s3": "^3.525.0",
2424
"@aws-sdk/s3-request-presigner": "^3.525.0",
25-
"@encode42/nbs.js": "^5.0.0",
25+
"@encode42/nbs.js": "^5.0.2",
2626
"@nestjs/common": "^10.0.0",
2727
"@nestjs/config": "^3.0.0",
2828
"@nestjs/core": "^10.0.0",

server/src/file/file.service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ export class FileService {
102102
const command = new GetObjectCommand({
103103
Bucket: bucket,
104104
Key: key,
105-
ResponseContentDisposition: `attachment; filename="${filename
106-
.split('/')
107-
.pop()}"`,
105+
ResponseContentDisposition: `attachment; filename="${filename}"`,
108106
});
109107

110108
const signedUrl = await getSignedUrl(this.s3Client, command, {

server/src/song/entity/song.entity.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ export class Song {
8888

8989
@Prop({ type: SongStats, required: true })
9090
stats: SongStats;
91+
92+
// EXTERNAL ATTRIBUTES
93+
94+
@Prop({ type: String, required: false })
95+
webhookMessageId?: string | null;
9196
}
9297

9398
export const SongSchema = SchemaFactory.createForClass(Song);

server/src/song/song-upload/song-upload.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ export class SongUploadService {
5757
}
5858

5959
private async getValidSoundsSubset() {
60-
// Creates a set of valid sound paths from filteredSoundList.json,
61-
// a manually-crafted subset of sounds from Minecraft
60+
// Creates a set of valid sound paths from the full list of sounds in Minecraft
6261

6362
if (!this.soundsSubset) {
6463
try {
6564
const response = await fetch(
66-
process.env.SERVER_URL + '/api/v1/data/filteredSoundList.json',
65+
process.env.SERVER_URL + '/api/v1/data/soundList.json',
6766
);
6867

69-
const soundList = (await response.json()) as string[];
68+
const soundMapping = (await response.json()) as Record<string, string>;
69+
const soundList = Object.keys(soundMapping);
7070
this.soundsSubset = new Set(soundList);
7171
} catch (e) {
7272
throw new HttpException(

0 commit comments

Comments
 (0)