-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathapplication.ts
More file actions
38 lines (34 loc) · 1.03 KB
/
application.ts
File metadata and controls
38 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { defaultUserAgent } from "./lib/metadata";
export interface VRChatApplication {
/**
* The name of your application.
*/
name: string;
/**
* The version of your application.
*
* [Semantic versioning](https://semver.org/) is recommended, e.g. `1.0.0`, but commit hashes or other identifiers are also acceptable.
*/
version: string;
/**
* An email, or a URL to a support page.
*/
contact: string;
}
export function isApplication(application: VRChatApplication): boolean {
return (
!!application
&& !!application.name
&& !!application.version
&& !!application.contact
// Catch common mistakes, like forgetting to change the example.
&& !application.contact.includes("@example.com")
&& !application.contact.includes("\n")
);
}
export function getApplicationAgent({ name, version, contact }: VRChatApplication): string {
return `${name}/${version} (${contact})`;
}
export function getUserAgent(application: VRChatApplication): string {
return `${getApplicationAgent(application)}, ${defaultUserAgent}`;
}