Phase 1: lock cron, reload chaud, argon2, providers, IMDb lookup, cache LRU, /health, /metrics, rate limit, UI dark, biome
This commit is contained in:
@@ -12,7 +12,8 @@ const YEAR_RE = /(19|20)\d{2}/g;
|
||||
// - the lowercase 'x' in NxN, and uppercase 'E' in standalone Exxx, are case-sensitive
|
||||
// Greedy left-to-right alternation means "S01E02" is consumed whole, so the
|
||||
// trailing "E02" alternative cannot match inside it.
|
||||
const EPISODE_RE = /[Ss][0-9]{1,2}.?[Ee][0-9]{1,3}|[Ss][0-9]{2}|[Pp]art\.?[0-9]{1,3}|[0-9]{1,2}x[0-9]{1,3}|E[0-9]{1,3}/g;
|
||||
const EPISODE_RE =
|
||||
/[Ss][0-9]{1,2}.?[Ee][0-9]{1,3}|[Ss][0-9]{2}|[Pp]art\.?[0-9]{1,3}|[0-9]{1,2}x[0-9]{1,3}|E[0-9]{1,3}/g;
|
||||
|
||||
// PHP uses byte offsets (substr). To stay byte-faithful, work on the UTF-8 bytes.
|
||||
const utf8 = (s) => Buffer.from(s, 'utf8');
|
||||
@@ -21,8 +22,9 @@ const sliceBytes = (s, end) => utf8(s).slice(0, end).toString('utf8');
|
||||
function findAll(re, str) {
|
||||
const out = [];
|
||||
re.lastIndex = 0;
|
||||
let m;
|
||||
while ((m = re.exec(str)) !== null) {
|
||||
for (;;) {
|
||||
const m = re.exec(str);
|
||||
if (m === null) break;
|
||||
out.push({ value: m[0], byteOffset: Buffer.byteLength(str.slice(0, m.index), 'utf8') });
|
||||
if (m.index === re.lastIndex) re.lastIndex++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user