naklitechie commited on
Commit
7ff622d
路
verified 路
1 Parent(s): eecaa10

Sync from GitHub

Browse files
Files changed (2) hide show
  1. classic/index.html +3 -1
  2. index.html +1 -1
classic/index.html CHANGED
@@ -152,7 +152,9 @@ async function load() {
152
  try {
153
  if (engine) { const old = engine; engine = null; await old.dispose(); }
154
  engine = await m.Engine.load(null, {
155
- url: q.get('url') || undefined, root: ROOT, gpuBudgetBytes: budgetGB * 1e9, maxCtx,
 
 
156
  onProgress: (e) => {
157
  if (e.status === 'ingest-plan' && e.quota && e.quota - (e.usage || 0) < e.needed)
158
  status(`Needs ${GB(e.needed)} of storage; the browser grants ${GB(e.quota - (e.usage || 0))} so far and raises that as the download writes, while the disk has room.`);
 
152
  try {
153
  if (engine) { const old = engine; engine = null; await old.dispose(); }
154
  engine = await m.Engine.load(null, {
155
+ // a model URL from the address bar only on this machine: on a deployed copy a crafted link could store other
156
+ // weights under this model's name
157
+ url: (['localhost', '127.0.0.1'].includes(location.hostname) && q.get('url')) || undefined, root: ROOT, gpuBudgetBytes: budgetGB * 1e9, maxCtx,
158
  onProgress: (e) => {
159
  if (e.status === 'ingest-plan' && e.quota && e.quota - (e.usage || 0) < e.needed)
160
  status(`Needs ${GB(e.needed)} of storage; the browser grants ${GB(e.quota - (e.usage || 0))} so far and raises that as the download writes, while the disk has room.`);
index.html CHANGED
@@ -177,7 +177,7 @@ function renderModels() {
177
  const s = byName[m.name], el = document.createElement('div');
178
  el.className = 'mrow' + (loaded && loaded.name === m.name ? ' on' : '');
179
  const state = !s ? 'not stored' : s.partial ? `${GB(s.size)} of ${GB(m.size)} stored` : 'stored';
180
- const name = document.createElement('div'); name.innerHTML = `<b>${m.label}</b>`;
181
  const act = document.createElement('div'); act.className = 'act';
182
  const info = document.createElement('div'); info.className = 'info'; info.textContent = `${GB(m.size)} 路 ${state} 路 ${m.note}`;
183
  const btn = (label, fn, cls, key) => { const b = document.createElement('button'); b.textContent = label; if (cls) b.className = cls; if (key) b.dataset.act = key; b.onclick = fn; act.append(b); };
 
177
  const s = byName[m.name], el = document.createElement('div');
178
  el.className = 'mrow' + (loaded && loaded.name === m.name ? ' on' : '');
179
  const state = !s ? 'not stored' : s.partial ? `${GB(s.size)} of ${GB(m.size)} stored` : 'stored';
180
+ const name = document.createElement('div'); name.append(Object.assign(document.createElement('b'), { textContent: m.label })); // a stored file's own name: text, never markup
181
  const act = document.createElement('div'); act.className = 'act';
182
  const info = document.createElement('div'); info.className = 'info'; info.textContent = `${GB(m.size)} 路 ${state} 路 ${m.note}`;
183
  const btn = (label, fn, cls, key) => { const b = document.createElement('button'); b.textContent = label; if (cls) b.className = cls; if (key) b.dataset.act = key; b.onclick = fn; act.append(b); };