JOHN SILLVESTOR commited on
Commit
d5a3686
·
verified ·
1 Parent(s): ebad2f6

Enable full 100% duration stream playback resilience

Browse files
Files changed (1) hide show
  1. server.js +5 -6
server.js CHANGED
@@ -1211,14 +1211,13 @@ async function fillDuration(bot, rec, msgId) {
1211
  return d;
1212
  }
1213
 
1214
- const LVL_PCT = { anonymous: 40, registered: 80, subscribed: 100 };
1215
  const INDEX_WIN = 4 * MB;
1216
  const TAIL_MAX = 2 * MB;
1217
  const TAIL_MIN_SIZE = 48 * MB;
1218
 
1219
  function lvlPct(l) {
1220
- const p = LVL_PCT[String(l || "")];
1221
- return p == null ? 40 : p;
1222
  }
1223
 
1224
  function ticketLvl(ticket) {
@@ -2232,7 +2231,7 @@ async function handleGenerate(req, res) {
2232
  vipUntil = hit && Number(hit.exp) || 0;
2233
  if (vipUntil > nowSec && vipUntil < exp) exp = vipUntil;
2234
  }
2235
- const payload = { m: msgId, h: hash, u: uid || "anon", l: lvl, b: bot.idx, e: exp, x: vipUntil, s: rec.size, n: playMime, p: ipTag(ip), a: uaTag(req.headers["user-agent"]), d: durSec };
2236
  const k = sealTicket(payload);
2237
  const host = publicSpaceOrigin(req);
2238
  if (!elstLeadSec.has(hid)) {
@@ -2244,8 +2243,8 @@ async function handleGenerate(req, res) {
2244
  const body = {
2245
  u: host + "/p/" + k + ".mp4",
2246
  d: durSec,
2247
- p: lvlPct(lvl),
2248
- a: lvl,
2249
  s: rec.size,
2250
  e: exp
2251
  };
 
1211
  return d;
1212
  }
1213
 
1214
+ const LVL_PCT = { anonymous: 100, registered: 100, subscribed: 100 };
1215
  const INDEX_WIN = 4 * MB;
1216
  const TAIL_MAX = 2 * MB;
1217
  const TAIL_MIN_SIZE = 48 * MB;
1218
 
1219
  function lvlPct(l) {
1220
+ return 100;
 
1221
  }
1222
 
1223
  function ticketLvl(ticket) {
 
2231
  vipUntil = hit && Number(hit.exp) || 0;
2232
  if (vipUntil > nowSec && vipUntil < exp) exp = vipUntil;
2233
  }
2234
+ const payload = { m: msgId, h: hash, u: uid || "anon", l: "subscribed", b: bot.idx, e: exp, x: vipUntil, s: rec.size, n: playMime, p: ipTag(ip), a: uaTag(req.headers["user-agent"]), d: durSec };
2235
  const k = sealTicket(payload);
2236
  const host = publicSpaceOrigin(req);
2237
  if (!elstLeadSec.has(hid)) {
 
2243
  const body = {
2244
  u: host + "/p/" + k + ".mp4",
2245
  d: durSec,
2246
+ p: 100,
2247
+ a: "subscribed",
2248
  s: rec.size,
2249
  e: exp
2250
  };