iobroker.staticsfilefolder 0.0.22 → 0.0.23

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.
package/README.md CHANGED
@@ -64,6 +64,9 @@ Once configured and the instance is running (green status):
64
64
  Placeholder for the next version (at the beginning of the line):
65
65
  ### **WORK IN PROGRESS**
66
66
  -->
67
+ ### 0.0.23
68
+ * Added live rendering / auto-refresh in file explorer on file additions/deletions.
69
+
67
70
  ### 0.0.22
68
71
  * Fixed PDF print layout to prevent vertical page overflow, and fixed zoom/scale rendering issues in PDF viewer.
69
72
 
package/io-package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "staticsfilefolder",
4
- "version": "0.0.22",
4
+ "version": "0.0.23",
5
5
  "news": {
6
- "0.0.22": {
7
- "en": "Fixed PDF print layout to prevent vertical page overflow, and fixed zoom/scale rendering issues in PDF viewer.",
8
- "de": "PDF-Drucklayout korrigiert, um vertikalen Seitenüberlauf zu verhindern, und Zoom-Rendering-Probleme im PDF-Viewer behoben.",
9
- "ru": "Исправлен макет печати PDF для предотвращения вертикального переполнения страниц, и исправлены проблемы с масштабированием в просмотрщике PDF.",
10
- "pt": "Corrigido o layout de impressão PDF para evitar o transbordamento vertical de páginas e corrigidos os problemas de renderização de zoom no visualizador de PDF.",
11
- "nl": "PDF-afdrukopmaak gecorrigeerd om verticale pagina-overloop te voorkomen, en zoom-rendervraagstukken in PDF-viewer opgelost.",
12
- "fr": "Correction de la mise en page d'impression PDF pour éviter le débordement vertical des pages, et correction des problèmes de rendu de zoom dans la visionneuse PDF.",
13
- "it": "Corretto il layout di stampa PDF per prevenire l'overflow verticale della pagina e risolti i problemi di rendering dello zoom nel visualizzatore PDF.",
14
- "es": "Se corrigió el diseño de impresión PDF para evitar el desbordamiento vertical de la página y se corrigieron los problemas de renderizado de zoom en el visor de PDF.",
15
- "pl": "Naprawiono układ wydruku PDF, aby zapobiec pionowemu przepełnieniu stron, oraz naprawiono problemy z renderowaniem powiększenia w przeglądarce PDF.",
16
- "uk": "Виправлено макет друку PDF для запобігання вертикальному переповненню сторінок, та виправлено проблеми з масштабуванням у переглядачі PDF.",
17
- "zh-cn": "修复了PDF打印布局以防止垂直页面溢出,并修复了PDF查看器中的缩放渲染问题。"
6
+ "0.0.23": {
7
+ "en": "Added live rendering / auto-refresh in file explorer on file additions/deletions.",
8
+ "de": "Live-Rendering / automatische Aktualisierung im Datei-Explorer bei Hinzufügung/Löschung von Dateien hinzugefügt.",
9
+ "ru": "Добавлено живое отображение / автообновление в проводнике файлов при добавлении/удалении файлов.",
10
+ "pt": "Adicionada renderização ao vivo / atualização automática no explorador de arquivos ao adicionar/excluir arquivos.",
11
+ "nl": "Live rendering / auto-refresh toegevoegd in de bestandsbrowser bij toevoeging/verwijdering van bestanden.",
12
+ "fr": "Ajout du rendu en direct / de l'actualisation automatique dans l'explorateur de fichiers lors de l'ajout/suppression de fichiers.",
13
+ "it": "Aggiunto rendering live / aggiornamento automatico in Esplora file all'aggiunta/eliminazione di file.",
14
+ "es": "Se agregó renderizado en vivo / actualización automática en el explorador de archivos al agregar o eliminar archivos.",
15
+ "pl": "Dodano renderowanie na żywo / automatyczne odświeżanie w eksploratorze plików przy dodawaniu/usuwaniu plików.",
16
+ "uk": "Додано живе відображення / автооновлення в провіднику файлів при додаванні/вилученні файлів.",
17
+ "zh-cn": "在文件资源管理器中添加了在添加/删除文件时的实时渲染/自动刷新。"
18
18
  },
19
19
  "0.0.15": {
20
20
  "en": "Reverted minimum Node.js engine requirement to 20 to support GitHub Actions runners.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.staticsfilefolder",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "Static Files Folder",
5
5
  "author": {
6
6
  "name": "gokturk413",
package/www/app.js CHANGED
@@ -7,6 +7,7 @@ let currentPath = '';
7
7
  let historyStack = [];
8
8
  let forwardStack = [];
9
9
  let currentItems = [];
10
+ let pollInterval = null;
10
11
 
11
12
  // DOM Elements
12
13
  const breadcrumbEl = document.getElementById('breadcrumb');
@@ -227,6 +228,7 @@ document.addEventListener('DOMContentLoaded', () => {
227
228
  initTheme();
228
229
  initLang();
229
230
  loadPath('');
231
+ startPolling();
230
232
 
231
233
  // Event Listeners
232
234
  btnBack.addEventListener('click', goBack);
@@ -281,6 +283,39 @@ async function loadPath(path) {
281
283
  }
282
284
  }
283
285
 
286
+ function startPolling() {
287
+ if (pollInterval) clearInterval(pollInterval);
288
+ pollInterval = setInterval(async () => {
289
+ if (document.hidden) return;
290
+ try {
291
+ const response = await fetch(`${API_URL}?path=${encodeURIComponent(currentPath)}`);
292
+ const data = await response.json();
293
+ if (data.success) {
294
+ const itemsChanged = JSON.stringify(data.items) !== JSON.stringify(currentItems);
295
+ if (itemsChanged) {
296
+ currentItems = data.items;
297
+ renderItems();
298
+
299
+ if (currentOpenItem) {
300
+ const fileStillExists = data.items.some(item => !item.isDirectory && item.name === currentOpenItem.name);
301
+ if (!fileStillExists) {
302
+ viewerModal.style.display = 'none';
303
+ viewerBody.innerHTML = '';
304
+ currentOpenItem = null;
305
+ currentPdfDoc = null;
306
+ currentPdfZoom = 1.5;
307
+ modalPdfZoom.value = '1.5';
308
+ modalPdfZoom.style.display = 'none';
309
+ }
310
+ }
311
+ }
312
+ }
313
+ } catch (e) {
314
+ console.warn('Polling error:', e);
315
+ }
316
+ }, 3000);
317
+ }
318
+
284
319
  function navigateTo(path) {
285
320
  if (path !== currentPath) {
286
321
  historyStack.push(currentPath);