dsh-ustc-quota 1.1.30 → 1.1.31

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.
Files changed (3) hide show
  1. package/client.js +12 -5
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -11,7 +11,7 @@ window.__ModuleLoader__.load({
11
11
  const UPDATE_ENDPOINT = 'plugins/dsh-ustc-quota/update';
12
12
  const UPDATE_APPLY_ENDPOINT = 'plugins/dsh-ustc-quota/update/apply';
13
13
  const WINDOW_IDS = ['3h', '12h', '24h'];
14
- const CLIENT_VERSION = '1.1.30';
14
+ const CLIENT_VERSION = '1.1.31';
15
15
  const UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1000;
16
16
  const CLIENT_VERSION_KEY = `${NS}:client-version`;
17
17
  const CLIENT_RELOAD_KEY = `${NS}:client-reload`;
@@ -1203,19 +1203,26 @@ window.__ModuleLoader__.load({
1203
1203
  if (columnWidth - (width + DOCK_GAP * 2) < DOCK_TRANSCRIPT_FLOOR) {
1204
1204
  width = Math.max(DOCK_FLOOR_WIDTH, columnWidth - DOCK_TRANSCRIPT_FLOOR - DOCK_GAP * 2);
1205
1205
  }
1206
- // A collapsed right sidebar keeps a narrow icon rail at the column's right edge;
1207
- // the dock must stop before it, or it covers those native buttons.
1206
+ // A collapsed right sidebar keeps a narrow icon rail at the column's right
1207
+ // edge. Only a small inset counts as that rail: a wide one means the sidebar is
1208
+ // open and the dock must not try to dodge a whole panel.
1208
1209
  let railInset = 0;
1209
1210
  for (const button of document.querySelectorAll('button[aria-label]')) {
1210
1211
  const label = button.getAttribute('aria-label') || '';
1211
1212
  if (!/右侧边栏/.test(label)) continue;
1212
1213
  const rect = button.getBoundingClientRect();
1213
1214
  if (rect.width <= 0 || rect.height <= 0) continue;
1215
+ if (rect.left < columnRect.left || rect.left > columnRect.right) continue;
1214
1216
  const inset = Math.round(columnRect.right - rect.left);
1215
- if (inset > 0 && inset < Math.round(columnRect.width * 0.3)) railInset = Math.max(railInset, inset);
1217
+ if (inset > 0 && inset <= 72) railInset = Math.max(railInset, inset);
1216
1218
  }
1217
1219
  width = Math.max(DOCK_FLOOR_WIDTH, width - railInset);
1218
- const reserve = width + railInset + DOCK_GAP * 2;
1220
+ let reserve = width + railInset + DOCK_GAP * 2;
1221
+ const reserveCap = Math.round(columnRect.width * 0.34);
1222
+ if (reserve > reserveCap) {
1223
+ reserve = Math.max(DOCK_FLOOR_WIDTH + DOCK_GAP * 2, reserveCap);
1224
+ width = Math.max(DOCK_FLOOR_WIDTH, reserve - railInset - DOCK_GAP * 2);
1225
+ }
1219
1226
 
1220
1227
  // Vertical bound: never cross or touch the separator under the tab strip.
1221
1228
  let contentTop = Math.round(columnRect.top) + DOCK_GAP;
package/index.js CHANGED
@@ -25,7 +25,7 @@ const ROUTE_PATH = '/plugins/dsh-ustc-quota/snapshot';
25
25
  const UPDATE_PATH = '/plugins/dsh-ustc-quota/update';
26
26
  const UPDATE_APPLY_PATH = '/plugins/dsh-ustc-quota/update/apply';
27
27
  const UPDATE_TOKEN_TTL_MS = 30 * 60 * 1000;
28
- const PLUGIN_VERSION = '1.1.30';
28
+ const PLUGIN_VERSION = '1.1.31';
29
29
  const KEY_INFO_PATH = 'key/info';
30
30
  const USER_INFO_PATH = 'user/info';
31
31
  const DISCOVERY_TTL_MS = 30000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ustc-quota",
3
- "version": "1.1.30",
3
+ "version": "1.1.31",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Live 3h/12h/24h USTC token quota card in the DSH sidebar (works with the USTC TokenWorks distribution).",