()
| 461 | } |
| 462 | |
| 463 | async function loadExplore() { |
| 464 | if (this.collapsed) return; |
| 465 | |
| 466 | const status = await helpers.checkAPIStatus(); |
| 467 | if (!status) { |
| 468 | $explore.$ul.content = <span className="error">{strings.api_error}</span>; |
| 469 | return; |
| 470 | } |
| 471 | |
| 472 | try { |
| 473 | startLoading($explore); |
| 474 | currentPage = 1; |
| 475 | hasMore = true; |
| 476 | |
| 477 | const response = await fetch( |
| 478 | withSupportedEditor( |
| 479 | `${config.API_BASE}/plugins?page=${currentPage}&limit=${LIMIT}`, |
| 480 | ), |
| 481 | ); |
| 482 | const plugins = await response.json(); |
| 483 | |
| 484 | if (plugins.length < LIMIT) { |
| 485 | hasMore = false; |
| 486 | } |
| 487 | |
| 488 | installedPlugins = await listInstalledPlugins(); |
| 489 | $explore.$ul.content = plugins.map(ListItem); |
| 490 | currentPage++; |
| 491 | updateHeight($explore); |
| 492 | } catch (error) { |
| 493 | console.error("Failed to load plugins in sidebar explore:", error); |
| 494 | $explore.$ul.content = <span className="error">{strings.error}</span>; |
| 495 | } finally { |
| 496 | stopLoading($explore); |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | async function listInstalledPlugins() { |
| 501 | const plugins = await Promise.all( |
nothing calls this directly
no test coverage detected