rategame-shared 1.1.424 → 1.1.426
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.
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects "fancy font" / disguised characters produced by web generators
|
|
3
|
+
* like https://pixelied.com/font-generator/fancy-text or
|
|
4
|
+
* https://www.namecheap.com/visual/font-generator/italic/.
|
|
5
|
+
*
|
|
6
|
+
* Covers:
|
|
7
|
+
* - Mathematical Alphanumeric Symbols (U+1D400–U+1D7FF):
|
|
8
|
+
* bold, italic, script, fraktur, double-struck, sans-serif,
|
|
9
|
+
* sans-serif italic, monospace, etc.
|
|
10
|
+
* - Halfwidth/Fullwidth Latin letters and digits (Type)
|
|
11
|
+
* - Enclosed Alphanumerics (Ⓐ, ⓐ, 🅐, 🅰️)
|
|
12
|
+
* - "Upside-down" / "turned" letters used by flip-text generators
|
|
13
|
+
* (⊥, ǝ, ɹ, ʇ, ʞ, ʎ, ɥ, ɐ, ɔ, ∀, ᗺ, ⅄, ...). Requires ≥2 of these
|
|
14
|
+
* to avoid false positives from a stray IPA character.
|
|
15
|
+
*
|
|
16
|
+
* Shared by the API (server-side guard) and clients (pre-submit guard).
|
|
17
|
+
*/
|
|
18
|
+
export declare function containsFancyText(text: string | null | undefined): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Standard user-facing copy when a submission is rejected because it
|
|
21
|
+
* contains fancy/disguised text. Centralised so the same string is shown
|
|
22
|
+
* regardless of which form the user hit.
|
|
23
|
+
*/
|
|
24
|
+
export declare const FANCY_TEXT_ERROR_MESSAGE = "Your post contains styled or upside-down characters. Please rewrite it using standard letters.";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Detects "fancy font" / disguised characters produced by web generators
|
|
4
|
+
* like https://pixelied.com/font-generator/fancy-text or
|
|
5
|
+
* https://www.namecheap.com/visual/font-generator/italic/.
|
|
6
|
+
*
|
|
7
|
+
* Covers:
|
|
8
|
+
* - Mathematical Alphanumeric Symbols (U+1D400–U+1D7FF):
|
|
9
|
+
* bold, italic, script, fraktur, double-struck, sans-serif,
|
|
10
|
+
* sans-serif italic, monospace, etc.
|
|
11
|
+
* - Halfwidth/Fullwidth Latin letters and digits (Type)
|
|
12
|
+
* - Enclosed Alphanumerics (Ⓐ, ⓐ, 🅐, 🅰️)
|
|
13
|
+
* - "Upside-down" / "turned" letters used by flip-text generators
|
|
14
|
+
* (⊥, ǝ, ɹ, ʇ, ʞ, ʎ, ɥ, ɐ, ɔ, ∀, ᗺ, ⅄, ...). Requires ≥2 of these
|
|
15
|
+
* to avoid false positives from a stray IPA character.
|
|
16
|
+
*
|
|
17
|
+
* Shared by the API (server-side guard) and clients (pre-submit guard).
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.FANCY_TEXT_ERROR_MESSAGE = exports.containsFancyText = void 0;
|
|
21
|
+
const TURNED_LETTERS = [
|
|
22
|
+
"\u0250",
|
|
23
|
+
"\u0254",
|
|
24
|
+
"\u025F",
|
|
25
|
+
"\u0183",
|
|
26
|
+
"\u0265",
|
|
27
|
+
"\u0131",
|
|
28
|
+
"\u027E",
|
|
29
|
+
"\u029E",
|
|
30
|
+
"\u026F",
|
|
31
|
+
"\u0279",
|
|
32
|
+
"\u0287",
|
|
33
|
+
"\u028C",
|
|
34
|
+
"\u028D",
|
|
35
|
+
"\u028E",
|
|
36
|
+
"\u01DD",
|
|
37
|
+
"\u22A5",
|
|
38
|
+
"\u2200",
|
|
39
|
+
"\u2144",
|
|
40
|
+
"\u15BA",
|
|
41
|
+
"\u1D1A",
|
|
42
|
+
"\u15E1",
|
|
43
|
+
"\u2143",
|
|
44
|
+
"\u2142",
|
|
45
|
+
"\u0186",
|
|
46
|
+
"\u018E",
|
|
47
|
+
"\u2141",
|
|
48
|
+
"\u019F",
|
|
49
|
+
"\u01EB",
|
|
50
|
+
"\u0282", // ʂ
|
|
51
|
+
];
|
|
52
|
+
const TURNED_LETTERS_SET = new Set(TURNED_LETTERS);
|
|
53
|
+
function containsMathAlphanumeric(text) {
|
|
54
|
+
for (const ch of text) {
|
|
55
|
+
const cp = ch.codePointAt(0);
|
|
56
|
+
if (cp >= 0x1d400 && cp <= 0x1d7ff)
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
function containsFullwidthAlphanumeric(text) {
|
|
62
|
+
for (const ch of text) {
|
|
63
|
+
const cp = ch.codePointAt(0);
|
|
64
|
+
if ((cp >= 0xff10 && cp <= 0xff19) ||
|
|
65
|
+
(cp >= 0xff21 && cp <= 0xff3a) ||
|
|
66
|
+
(cp >= 0xff41 && cp <= 0xff5a)) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
function containsEnclosedAlphanumeric(text) {
|
|
73
|
+
for (const ch of text) {
|
|
74
|
+
const cp = ch.codePointAt(0);
|
|
75
|
+
if (cp >= 0x2460 && cp <= 0x24ff)
|
|
76
|
+
return true;
|
|
77
|
+
if (cp >= 0x1f100 && cp <= 0x1f1ff)
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
function containsTurnedLetters(text) {
|
|
83
|
+
let count = 0;
|
|
84
|
+
for (const ch of text) {
|
|
85
|
+
if (TURNED_LETTERS_SET.has(ch)) {
|
|
86
|
+
count++;
|
|
87
|
+
if (count >= 2)
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
function containsFancyText(text) {
|
|
94
|
+
if (!text)
|
|
95
|
+
return false;
|
|
96
|
+
return (containsMathAlphanumeric(text) ||
|
|
97
|
+
containsFullwidthAlphanumeric(text) ||
|
|
98
|
+
containsEnclosedAlphanumeric(text) ||
|
|
99
|
+
containsTurnedLetters(text));
|
|
100
|
+
}
|
|
101
|
+
exports.containsFancyText = containsFancyText;
|
|
102
|
+
/**
|
|
103
|
+
* Standard user-facing copy when a submission is rejected because it
|
|
104
|
+
* contains fancy/disguised text. Centralised so the same string is shown
|
|
105
|
+
* regardless of which form the user hit.
|
|
106
|
+
*/
|
|
107
|
+
exports.FANCY_TEXT_ERROR_MESSAGE = "Your post contains styled or upside-down characters. Please rewrite it using standard letters.";
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export * from "./models/userEvent";
|
|
|
39
39
|
export * from "./models/content";
|
|
40
40
|
export * from "./models/advertisement";
|
|
41
41
|
export * from "./helpers/index";
|
|
42
|
+
export * from "./helpers/containsFancyText";
|
|
42
43
|
export * from "./models/player";
|
|
43
44
|
export * from "./models/voting";
|
|
44
45
|
export * from "./models/stadium";
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __exportStar(require("./models/userEvent"), exports);
|
|
|
55
55
|
__exportStar(require("./models/content"), exports);
|
|
56
56
|
__exportStar(require("./models/advertisement"), exports);
|
|
57
57
|
__exportStar(require("./helpers/index"), exports);
|
|
58
|
+
__exportStar(require("./helpers/containsFancyText"), exports);
|
|
58
59
|
__exportStar(require("./models/player"), exports);
|
|
59
60
|
__exportStar(require("./models/voting"), exports);
|
|
60
61
|
__exportStar(require("./models/stadium"), exports);
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const fifaStandingsTeamSchema: z.ZodObject<{
|
|
3
|
-
teamId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4
3
|
apiTeamId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
5
4
|
name: z.ZodString;
|
|
6
5
|
shortName: z.ZodOptional<z.ZodString>;
|
|
7
|
-
image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
-
teamCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
-
countryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
6
|
order: z.ZodNumber;
|
|
11
7
|
games: z.ZodNumber;
|
|
12
8
|
wins: z.ZodNumber;
|
|
@@ -27,11 +23,7 @@ export declare const fifaStandingsTeamSchema: z.ZodObject<{
|
|
|
27
23
|
goalsAgainst: number;
|
|
28
24
|
goalsDifferential: number;
|
|
29
25
|
points: number;
|
|
30
|
-
image?: string | null | undefined;
|
|
31
26
|
apiTeamId?: number | null | undefined;
|
|
32
|
-
teamCode?: string | null | undefined;
|
|
33
|
-
teamId?: string | null | undefined;
|
|
34
|
-
countryId?: string | null | undefined;
|
|
35
27
|
shortName?: string | undefined;
|
|
36
28
|
}, {
|
|
37
29
|
name: string;
|
|
@@ -44,24 +36,16 @@ export declare const fifaStandingsTeamSchema: z.ZodObject<{
|
|
|
44
36
|
goalsAgainst: number;
|
|
45
37
|
goalsDifferential: number;
|
|
46
38
|
points: number;
|
|
47
|
-
image?: string | null | undefined;
|
|
48
39
|
apiTeamId?: number | null | undefined;
|
|
49
|
-
teamCode?: string | null | undefined;
|
|
50
|
-
teamId?: string | null | undefined;
|
|
51
|
-
countryId?: string | null | undefined;
|
|
52
40
|
shortName?: string | undefined;
|
|
53
41
|
}>;
|
|
54
42
|
export declare const fifaStandingsGroupSchema: z.ZodObject<{
|
|
55
43
|
groupKey: z.ZodString;
|
|
56
44
|
groupName: z.ZodString;
|
|
57
45
|
teams: z.ZodArray<z.ZodObject<{
|
|
58
|
-
teamId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
46
|
apiTeamId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
60
47
|
name: z.ZodString;
|
|
61
48
|
shortName: z.ZodOptional<z.ZodString>;
|
|
62
|
-
image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
-
teamCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
|
-
countryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
49
|
order: z.ZodNumber;
|
|
66
50
|
games: z.ZodNumber;
|
|
67
51
|
wins: z.ZodNumber;
|
|
@@ -82,11 +66,7 @@ export declare const fifaStandingsGroupSchema: z.ZodObject<{
|
|
|
82
66
|
goalsAgainst: number;
|
|
83
67
|
goalsDifferential: number;
|
|
84
68
|
points: number;
|
|
85
|
-
image?: string | null | undefined;
|
|
86
69
|
apiTeamId?: number | null | undefined;
|
|
87
|
-
teamCode?: string | null | undefined;
|
|
88
|
-
teamId?: string | null | undefined;
|
|
89
|
-
countryId?: string | null | undefined;
|
|
90
70
|
shortName?: string | undefined;
|
|
91
71
|
}, {
|
|
92
72
|
name: string;
|
|
@@ -99,11 +79,7 @@ export declare const fifaStandingsGroupSchema: z.ZodObject<{
|
|
|
99
79
|
goalsAgainst: number;
|
|
100
80
|
goalsDifferential: number;
|
|
101
81
|
points: number;
|
|
102
|
-
image?: string | null | undefined;
|
|
103
82
|
apiTeamId?: number | null | undefined;
|
|
104
|
-
teamCode?: string | null | undefined;
|
|
105
|
-
teamId?: string | null | undefined;
|
|
106
|
-
countryId?: string | null | undefined;
|
|
107
83
|
shortName?: string | undefined;
|
|
108
84
|
}>, "many">;
|
|
109
85
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -118,11 +94,7 @@ export declare const fifaStandingsGroupSchema: z.ZodObject<{
|
|
|
118
94
|
goalsAgainst: number;
|
|
119
95
|
goalsDifferential: number;
|
|
120
96
|
points: number;
|
|
121
|
-
image?: string | null | undefined;
|
|
122
97
|
apiTeamId?: number | null | undefined;
|
|
123
|
-
teamCode?: string | null | undefined;
|
|
124
|
-
teamId?: string | null | undefined;
|
|
125
|
-
countryId?: string | null | undefined;
|
|
126
98
|
shortName?: string | undefined;
|
|
127
99
|
}[];
|
|
128
100
|
groupKey: string;
|
|
@@ -139,30 +111,20 @@ export declare const fifaStandingsGroupSchema: z.ZodObject<{
|
|
|
139
111
|
goalsAgainst: number;
|
|
140
112
|
goalsDifferential: number;
|
|
141
113
|
points: number;
|
|
142
|
-
image?: string | null | undefined;
|
|
143
114
|
apiTeamId?: number | null | undefined;
|
|
144
|
-
teamCode?: string | null | undefined;
|
|
145
|
-
teamId?: string | null | undefined;
|
|
146
|
-
countryId?: string | null | undefined;
|
|
147
115
|
shortName?: string | undefined;
|
|
148
116
|
}[];
|
|
149
117
|
groupKey: string;
|
|
150
118
|
groupName: string;
|
|
151
119
|
}>;
|
|
152
120
|
export declare const fifaStandingsResponseDtoSchema: z.ZodObject<{
|
|
153
|
-
league: z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>;
|
|
154
|
-
season: z.ZodNumber;
|
|
155
121
|
groups: z.ZodArray<z.ZodObject<{
|
|
156
122
|
groupKey: z.ZodString;
|
|
157
123
|
groupName: z.ZodString;
|
|
158
124
|
teams: z.ZodArray<z.ZodObject<{
|
|
159
|
-
teamId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
160
125
|
apiTeamId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
161
126
|
name: z.ZodString;
|
|
162
127
|
shortName: z.ZodOptional<z.ZodString>;
|
|
163
|
-
image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
164
|
-
teamCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
165
|
-
countryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
166
128
|
order: z.ZodNumber;
|
|
167
129
|
games: z.ZodNumber;
|
|
168
130
|
wins: z.ZodNumber;
|
|
@@ -183,11 +145,7 @@ export declare const fifaStandingsResponseDtoSchema: z.ZodObject<{
|
|
|
183
145
|
goalsAgainst: number;
|
|
184
146
|
goalsDifferential: number;
|
|
185
147
|
points: number;
|
|
186
|
-
image?: string | null | undefined;
|
|
187
148
|
apiTeamId?: number | null | undefined;
|
|
188
|
-
teamCode?: string | null | undefined;
|
|
189
|
-
teamId?: string | null | undefined;
|
|
190
|
-
countryId?: string | null | undefined;
|
|
191
149
|
shortName?: string | undefined;
|
|
192
150
|
}, {
|
|
193
151
|
name: string;
|
|
@@ -200,11 +158,7 @@ export declare const fifaStandingsResponseDtoSchema: z.ZodObject<{
|
|
|
200
158
|
goalsAgainst: number;
|
|
201
159
|
goalsDifferential: number;
|
|
202
160
|
points: number;
|
|
203
|
-
image?: string | null | undefined;
|
|
204
161
|
apiTeamId?: number | null | undefined;
|
|
205
|
-
teamCode?: string | null | undefined;
|
|
206
|
-
teamId?: string | null | undefined;
|
|
207
|
-
countryId?: string | null | undefined;
|
|
208
162
|
shortName?: string | undefined;
|
|
209
163
|
}>, "many">;
|
|
210
164
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -219,11 +173,7 @@ export declare const fifaStandingsResponseDtoSchema: z.ZodObject<{
|
|
|
219
173
|
goalsAgainst: number;
|
|
220
174
|
goalsDifferential: number;
|
|
221
175
|
points: number;
|
|
222
|
-
image?: string | null | undefined;
|
|
223
176
|
apiTeamId?: number | null | undefined;
|
|
224
|
-
teamCode?: string | null | undefined;
|
|
225
|
-
teamId?: string | null | undefined;
|
|
226
|
-
countryId?: string | null | undefined;
|
|
227
177
|
shortName?: string | undefined;
|
|
228
178
|
}[];
|
|
229
179
|
groupKey: string;
|
|
@@ -240,17 +190,12 @@ export declare const fifaStandingsResponseDtoSchema: z.ZodObject<{
|
|
|
240
190
|
goalsAgainst: number;
|
|
241
191
|
goalsDifferential: number;
|
|
242
192
|
points: number;
|
|
243
|
-
image?: string | null | undefined;
|
|
244
193
|
apiTeamId?: number | null | undefined;
|
|
245
|
-
teamCode?: string | null | undefined;
|
|
246
|
-
teamId?: string | null | undefined;
|
|
247
|
-
countryId?: string | null | undefined;
|
|
248
194
|
shortName?: string | undefined;
|
|
249
195
|
}[];
|
|
250
196
|
groupKey: string;
|
|
251
197
|
groupName: string;
|
|
252
198
|
}>, "many">;
|
|
253
|
-
updatedAt: z.ZodNumber;
|
|
254
199
|
}, "strip", z.ZodTypeAny, {
|
|
255
200
|
groups: {
|
|
256
201
|
teams: {
|
|
@@ -264,19 +209,12 @@ export declare const fifaStandingsResponseDtoSchema: z.ZodObject<{
|
|
|
264
209
|
goalsAgainst: number;
|
|
265
210
|
goalsDifferential: number;
|
|
266
211
|
points: number;
|
|
267
|
-
image?: string | null | undefined;
|
|
268
212
|
apiTeamId?: number | null | undefined;
|
|
269
|
-
teamCode?: string | null | undefined;
|
|
270
|
-
teamId?: string | null | undefined;
|
|
271
|
-
countryId?: string | null | undefined;
|
|
272
213
|
shortName?: string | undefined;
|
|
273
214
|
}[];
|
|
274
215
|
groupKey: string;
|
|
275
216
|
groupName: string;
|
|
276
217
|
}[];
|
|
277
|
-
league: string;
|
|
278
|
-
updatedAt: number;
|
|
279
|
-
season: number;
|
|
280
218
|
}, {
|
|
281
219
|
groups: {
|
|
282
220
|
teams: {
|
|
@@ -290,17 +228,10 @@ export declare const fifaStandingsResponseDtoSchema: z.ZodObject<{
|
|
|
290
228
|
goalsAgainst: number;
|
|
291
229
|
goalsDifferential: number;
|
|
292
230
|
points: number;
|
|
293
|
-
image?: string | null | undefined;
|
|
294
231
|
apiTeamId?: number | null | undefined;
|
|
295
|
-
teamCode?: string | null | undefined;
|
|
296
|
-
teamId?: string | null | undefined;
|
|
297
|
-
countryId?: string | null | undefined;
|
|
298
232
|
shortName?: string | undefined;
|
|
299
233
|
}[];
|
|
300
234
|
groupKey: string;
|
|
301
235
|
groupName: string;
|
|
302
236
|
}[];
|
|
303
|
-
league: string;
|
|
304
|
-
updatedAt: number;
|
|
305
|
-
season: number;
|
|
306
237
|
}>;
|
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fifaStandingsResponseDtoSchema = exports.fifaStandingsGroupSchema = exports.fifaStandingsTeamSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const sharedTypes_1 = require("./sharedTypes");
|
|
6
5
|
// One team's row inside a group standings table
|
|
7
6
|
exports.fifaStandingsTeamSchema = zod_1.z.object({
|
|
8
|
-
teamId: zod_1.z.string().nullable().optional(),
|
|
9
7
|
apiTeamId: zod_1.z.number().nullable().optional(),
|
|
10
8
|
name: zod_1.z.string(),
|
|
11
9
|
shortName: zod_1.z.string().optional(),
|
|
12
|
-
image: zod_1.z.string().nullable().optional(),
|
|
13
|
-
teamCode: zod_1.z.string().nullable().optional(),
|
|
14
|
-
countryId: zod_1.z.string().nullable().optional(),
|
|
15
10
|
order: zod_1.z.number(),
|
|
16
11
|
games: zod_1.z.number(),
|
|
17
12
|
wins: zod_1.z.number(),
|
|
@@ -28,8 +23,5 @@ exports.fifaStandingsGroupSchema = zod_1.z.object({
|
|
|
28
23
|
teams: zod_1.z.array(exports.fifaStandingsTeamSchema),
|
|
29
24
|
});
|
|
30
25
|
exports.fifaStandingsResponseDtoSchema = zod_1.z.object({
|
|
31
|
-
league: sharedTypes_1.leagueSlug,
|
|
32
|
-
season: zod_1.z.number(),
|
|
33
26
|
groups: zod_1.z.array(exports.fifaStandingsGroupSchema),
|
|
34
|
-
updatedAt: zod_1.z.number(),
|
|
35
27
|
});
|