Skip to content

Commit 331f97b

Browse files
committed
feat: Trophy integration for NGA
chore: Replace placeholder rating and star assets with newly created ones
1 parent 5af135f commit 331f97b

File tree

7 files changed

+43
-0
lines changed

7 files changed

+43
-0
lines changed

extensions/core-nga/src/extension.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@ export async function activate(context: flashpoint.ExtensionContext): Promise<vo
44
flashpoint.dataExtensions.registerDataExtension({
55
id: 'nga',
66
searchables: [
7+
{
8+
key: 'trophy_count',
9+
searchKey: 'trophies',
10+
valueType: flashpoint.ExtSearchableType.Number,
11+
},
12+
{
13+
key: 'trophy_frontpaged',
14+
searchKey: 'frontpage',
15+
valueType: flashpoint.ExtSearchableType.String,
16+
},
17+
{
18+
key: 'trophy_daily',
19+
searchKey: 'daily',
20+
valueType: flashpoint.ExtSearchableType.String,
21+
},
22+
{
23+
key: 'trophy_monthly',
24+
searchKey: 'monthly',
25+
valueType: flashpoint.ExtSearchableType.String,
26+
},
27+
{
28+
key: 'trophy_review',
29+
searchKey: 'review',
30+
valueType: flashpoint.ExtSearchableType.String,
31+
},
732
{
833
key: 'rating',
934
searchKey: 'rating',
-425 Bytes
Loading
-628 Bytes
Loading
-726 Bytes
Loading
-464 Bytes
Loading
-316 Bytes
Binary file not shown.

src/back/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,18 +1168,32 @@ function onFileServerRequestExtData(pathname: string, url: URL, req: http.Incomi
11681168
const splitPath = pathname.split('/');
11691169
const extId = splitPath.length > 0 ? splitPath[0] : '';
11701170
const relativePath = splitPath.length > 1 ? splitPath.slice(1).join('/') : '';
1171+
console.log('ext id: ' + extId);
1172+
console.log('rel path: ' + relativePath);
11711173
state.extensionsService.getExtension(extId)
11721174
.then(ext => {
11731175
if (ext) {
11741176
// Only serve from <extPath>/static/
11751177
const staticPath = path.join(ext.extensionPath, 'static');
11761178
const filePath = path.join(staticPath, relativePath);
1179+
console.log(filePath);
11771180
if (filePath.startsWith(staticPath)) {
11781181
serveFile(req, res, filePath);
11791182
} else {
1183+
res.writeHead(403);
1184+
res.end();
11801185
log.warn('Launcher', `Illegal file request: "${filePath}"`);
11811186
}
1187+
} else {
1188+
log.warn('Launcher', `No extension found with id: "${extId}"`);
1189+
res.writeHead(404);
1190+
res.end();
11821191
}
1192+
})
1193+
.catch(() => {
1194+
log.warn('Launcher', `Error finding extension with id: "${extId}"`);
1195+
res.writeHead(404);
1196+
res.end();
11831197
});
11841198
}
11851199

@@ -1191,6 +1205,8 @@ function onFileServerRequestExtIcons(pathname: string, url: URL, req: http.Incom
11911205
if (filePath.startsWith(ext.extensionPath)) {
11921206
serveFile(req, res, filePath);
11931207
} else {
1208+
res.writeHead(403);
1209+
res.end();
11941210
log.warn('Launcher', `Illegal file request: "${filePath}"`);
11951211
}
11961212
}
@@ -1210,6 +1226,8 @@ function onFileServerRequestThemes(pathname: string, url: URL, req: http.Incomin
12101226
if (relative && !relative.startsWith('..') && !path.isAbsolute(relative)) {
12111227
serveFile(req, res, filePath);
12121228
} else {
1229+
res.writeHead(403);
1230+
res.end();
12131231
log.warn('Launcher', `Illegal file request: "${filePath}"`);
12141232
}
12151233
}

0 commit comments

Comments
 (0)