loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: use `sharp` to generate images (#7512)

- `tools/generate-images.js` is used to convert SVGs to resized optimized SVGs and resized optimized PNG. Although it would be best to drop generating images from SVG, the usage of these images do not accept a SVG.
- The script relied on two dependencies being installed on-the-fly, this is suboptimal as it means its integrity was not saved in package-lock.json and no specific version was specified which makes reproducible builds harder. `imagemin-zopfli` was not updated in 4 years and seems to use dependency that generate funny message about memory leaks and using no longer maintained dependencies.
- Use [`sharp`](https://sharp.pixelplumbing.com/) to do the image conversion, this installs two binaries on Linux (glibc/musl) and are responsible for 5% of the `node_modules` directory size. Add this to package.json as a dev dependencies to ensure the integrity can be verified and help reproducible builds.
- Drop the `gitea` conversion, I cannot find this being used within Forgejo (my best guess is that e20cd83bc5479bd76ff1a248f0e28ef0bea6742b dropped the usage of it).
- Resolves forgejo/forgejo#7232

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7512
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>

authored by

Gusted
Gusted
and committed by
0ko
b86aefc0 b55c7282

+500 -34
+1 -2
Makefile
··· 1017 1017 1018 1018 .PHONY: generate-images 1019 1019 generate-images: | node_modules 1020 - npm install --no-save fabric@6 imagemin-zopfli@7 1021 - node tools/generate-images.js $(TAGS) 1020 + node tools/generate-images.js 1022 1021 1023 1022 .PHONY: generate-manpage 1024 1023 generate-manpage:
+491
package-lock.json
··· 92 92 "license-checker-rseidelsohn": "4.4.2", 93 93 "markdownlint-cli": "0.44.0", 94 94 "postcss-html": "1.8.0", 95 + "sharp": "0.34.1", 95 96 "stylelint": "16.17.0", 96 97 "stylelint-declaration-block-no-ignored-properties": "2.8.0", 97 98 "stylelint-declaration-strict-value": "1.10.11", ··· 1338 1339 "url": "https://github.com/sponsors/sindresorhus" 1339 1340 } 1340 1341 }, 1342 + "node_modules/@img/sharp-darwin-arm64": { 1343 + "version": "0.34.1", 1344 + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.1.tgz", 1345 + "integrity": "sha512-pn44xgBtgpEbZsu+lWf2KNb6OAf70X68k+yk69Ic2Xz11zHR/w24/U49XT7AeRwJ0Px+mhALhU5LPci1Aymk7A==", 1346 + "cpu": [ 1347 + "arm64" 1348 + ], 1349 + "dev": true, 1350 + "license": "Apache-2.0", 1351 + "optional": true, 1352 + "os": [ 1353 + "darwin" 1354 + ], 1355 + "engines": { 1356 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1357 + }, 1358 + "funding": { 1359 + "url": "https://opencollective.com/libvips" 1360 + }, 1361 + "optionalDependencies": { 1362 + "@img/sharp-libvips-darwin-arm64": "1.1.0" 1363 + } 1364 + }, 1365 + "node_modules/@img/sharp-darwin-x64": { 1366 + "version": "0.34.1", 1367 + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.1.tgz", 1368 + "integrity": "sha512-VfuYgG2r8BpYiOUN+BfYeFo69nP/MIwAtSJ7/Zpxc5QF3KS22z8Pvg3FkrSFJBPNQ7mmcUcYQFBmEQp7eu1F8Q==", 1369 + "cpu": [ 1370 + "x64" 1371 + ], 1372 + "dev": true, 1373 + "license": "Apache-2.0", 1374 + "optional": true, 1375 + "os": [ 1376 + "darwin" 1377 + ], 1378 + "engines": { 1379 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1380 + }, 1381 + "funding": { 1382 + "url": "https://opencollective.com/libvips" 1383 + }, 1384 + "optionalDependencies": { 1385 + "@img/sharp-libvips-darwin-x64": "1.1.0" 1386 + } 1387 + }, 1388 + "node_modules/@img/sharp-libvips-darwin-arm64": { 1389 + "version": "1.1.0", 1390 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.1.0.tgz", 1391 + "integrity": "sha512-HZ/JUmPwrJSoM4DIQPv/BfNh9yrOA8tlBbqbLz4JZ5uew2+o22Ik+tHQJcih7QJuSa0zo5coHTfD5J8inqj9DA==", 1392 + "cpu": [ 1393 + "arm64" 1394 + ], 1395 + "dev": true, 1396 + "license": "LGPL-3.0-or-later", 1397 + "optional": true, 1398 + "os": [ 1399 + "darwin" 1400 + ], 1401 + "funding": { 1402 + "url": "https://opencollective.com/libvips" 1403 + } 1404 + }, 1405 + "node_modules/@img/sharp-libvips-darwin-x64": { 1406 + "version": "1.1.0", 1407 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.1.0.tgz", 1408 + "integrity": "sha512-Xzc2ToEmHN+hfvsl9wja0RlnXEgpKNmftriQp6XzY/RaSfwD9th+MSh0WQKzUreLKKINb3afirxW7A0fz2YWuQ==", 1409 + "cpu": [ 1410 + "x64" 1411 + ], 1412 + "dev": true, 1413 + "license": "LGPL-3.0-or-later", 1414 + "optional": true, 1415 + "os": [ 1416 + "darwin" 1417 + ], 1418 + "funding": { 1419 + "url": "https://opencollective.com/libvips" 1420 + } 1421 + }, 1422 + "node_modules/@img/sharp-libvips-linux-arm": { 1423 + "version": "1.1.0", 1424 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.1.0.tgz", 1425 + "integrity": "sha512-s8BAd0lwUIvYCJyRdFqvsj+BJIpDBSxs6ivrOPm/R7piTs5UIwY5OjXrP2bqXC9/moGsyRa37eYWYCOGVXxVrA==", 1426 + "cpu": [ 1427 + "arm" 1428 + ], 1429 + "dev": true, 1430 + "license": "LGPL-3.0-or-later", 1431 + "optional": true, 1432 + "os": [ 1433 + "linux" 1434 + ], 1435 + "funding": { 1436 + "url": "https://opencollective.com/libvips" 1437 + } 1438 + }, 1439 + "node_modules/@img/sharp-libvips-linux-arm64": { 1440 + "version": "1.1.0", 1441 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.1.0.tgz", 1442 + "integrity": "sha512-IVfGJa7gjChDET1dK9SekxFFdflarnUB8PwW8aGwEoF3oAsSDuNUTYS+SKDOyOJxQyDC1aPFMuRYLoDInyV9Ew==", 1443 + "cpu": [ 1444 + "arm64" 1445 + ], 1446 + "dev": true, 1447 + "license": "LGPL-3.0-or-later", 1448 + "optional": true, 1449 + "os": [ 1450 + "linux" 1451 + ], 1452 + "funding": { 1453 + "url": "https://opencollective.com/libvips" 1454 + } 1455 + }, 1456 + "node_modules/@img/sharp-libvips-linux-ppc64": { 1457 + "version": "1.1.0", 1458 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.1.0.tgz", 1459 + "integrity": "sha512-tiXxFZFbhnkWE2LA8oQj7KYR+bWBkiV2nilRldT7bqoEZ4HiDOcePr9wVDAZPi/Id5fT1oY9iGnDq20cwUz8lQ==", 1460 + "cpu": [ 1461 + "ppc64" 1462 + ], 1463 + "dev": true, 1464 + "license": "LGPL-3.0-or-later", 1465 + "optional": true, 1466 + "os": [ 1467 + "linux" 1468 + ], 1469 + "funding": { 1470 + "url": "https://opencollective.com/libvips" 1471 + } 1472 + }, 1473 + "node_modules/@img/sharp-libvips-linux-s390x": { 1474 + "version": "1.1.0", 1475 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.1.0.tgz", 1476 + "integrity": "sha512-xukSwvhguw7COyzvmjydRb3x/09+21HykyapcZchiCUkTThEQEOMtBj9UhkaBRLuBrgLFzQ2wbxdeCCJW/jgJA==", 1477 + "cpu": [ 1478 + "s390x" 1479 + ], 1480 + "dev": true, 1481 + "license": "LGPL-3.0-or-later", 1482 + "optional": true, 1483 + "os": [ 1484 + "linux" 1485 + ], 1486 + "funding": { 1487 + "url": "https://opencollective.com/libvips" 1488 + } 1489 + }, 1490 + "node_modules/@img/sharp-libvips-linux-x64": { 1491 + "version": "1.1.0", 1492 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.1.0.tgz", 1493 + "integrity": "sha512-yRj2+reB8iMg9W5sULM3S74jVS7zqSzHG3Ol/twnAAkAhnGQnpjj6e4ayUz7V+FpKypwgs82xbRdYtchTTUB+Q==", 1494 + "cpu": [ 1495 + "x64" 1496 + ], 1497 + "dev": true, 1498 + "license": "LGPL-3.0-or-later", 1499 + "optional": true, 1500 + "os": [ 1501 + "linux" 1502 + ], 1503 + "funding": { 1504 + "url": "https://opencollective.com/libvips" 1505 + } 1506 + }, 1507 + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { 1508 + "version": "1.1.0", 1509 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.1.0.tgz", 1510 + "integrity": "sha512-jYZdG+whg0MDK+q2COKbYidaqW/WTz0cc1E+tMAusiDygrM4ypmSCjOJPmFTvHHJ8j/6cAGyeDWZOsK06tP33w==", 1511 + "cpu": [ 1512 + "arm64" 1513 + ], 1514 + "dev": true, 1515 + "license": "LGPL-3.0-or-later", 1516 + "optional": true, 1517 + "os": [ 1518 + "linux" 1519 + ], 1520 + "funding": { 1521 + "url": "https://opencollective.com/libvips" 1522 + } 1523 + }, 1524 + "node_modules/@img/sharp-libvips-linuxmusl-x64": { 1525 + "version": "1.1.0", 1526 + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.1.0.tgz", 1527 + "integrity": "sha512-wK7SBdwrAiycjXdkPnGCPLjYb9lD4l6Ze2gSdAGVZrEL05AOUJESWU2lhlC+Ffn5/G+VKuSm6zzbQSzFX/P65A==", 1528 + "cpu": [ 1529 + "x64" 1530 + ], 1531 + "dev": true, 1532 + "license": "LGPL-3.0-or-later", 1533 + "optional": true, 1534 + "os": [ 1535 + "linux" 1536 + ], 1537 + "funding": { 1538 + "url": "https://opencollective.com/libvips" 1539 + } 1540 + }, 1541 + "node_modules/@img/sharp-linux-arm": { 1542 + "version": "0.34.1", 1543 + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.1.tgz", 1544 + "integrity": "sha512-anKiszvACti2sGy9CirTlNyk7BjjZPiML1jt2ZkTdcvpLU1YH6CXwRAZCA2UmRXnhiIftXQ7+Oh62Ji25W72jA==", 1545 + "cpu": [ 1546 + "arm" 1547 + ], 1548 + "dev": true, 1549 + "license": "Apache-2.0", 1550 + "optional": true, 1551 + "os": [ 1552 + "linux" 1553 + ], 1554 + "engines": { 1555 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1556 + }, 1557 + "funding": { 1558 + "url": "https://opencollective.com/libvips" 1559 + }, 1560 + "optionalDependencies": { 1561 + "@img/sharp-libvips-linux-arm": "1.1.0" 1562 + } 1563 + }, 1564 + "node_modules/@img/sharp-linux-arm64": { 1565 + "version": "0.34.1", 1566 + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.1.tgz", 1567 + "integrity": "sha512-kX2c+vbvaXC6vly1RDf/IWNXxrlxLNpBVWkdpRq5Ka7OOKj6nr66etKy2IENf6FtOgklkg9ZdGpEu9kwdlcwOQ==", 1568 + "cpu": [ 1569 + "arm64" 1570 + ], 1571 + "dev": true, 1572 + "license": "Apache-2.0", 1573 + "optional": true, 1574 + "os": [ 1575 + "linux" 1576 + ], 1577 + "engines": { 1578 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1579 + }, 1580 + "funding": { 1581 + "url": "https://opencollective.com/libvips" 1582 + }, 1583 + "optionalDependencies": { 1584 + "@img/sharp-libvips-linux-arm64": "1.1.0" 1585 + } 1586 + }, 1587 + "node_modules/@img/sharp-linux-s390x": { 1588 + "version": "0.34.1", 1589 + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.1.tgz", 1590 + "integrity": "sha512-7s0KX2tI9mZI2buRipKIw2X1ufdTeaRgwmRabt5bi9chYfhur+/C1OXg3TKg/eag1W+6CCWLVmSauV1owmRPxA==", 1591 + "cpu": [ 1592 + "s390x" 1593 + ], 1594 + "dev": true, 1595 + "license": "Apache-2.0", 1596 + "optional": true, 1597 + "os": [ 1598 + "linux" 1599 + ], 1600 + "engines": { 1601 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1602 + }, 1603 + "funding": { 1604 + "url": "https://opencollective.com/libvips" 1605 + }, 1606 + "optionalDependencies": { 1607 + "@img/sharp-libvips-linux-s390x": "1.1.0" 1608 + } 1609 + }, 1610 + "node_modules/@img/sharp-linux-x64": { 1611 + "version": "0.34.1", 1612 + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.1.tgz", 1613 + "integrity": "sha512-wExv7SH9nmoBW3Wr2gvQopX1k8q2g5V5Iag8Zk6AVENsjwd+3adjwxtp3Dcu2QhOXr8W9NusBU6XcQUohBZ5MA==", 1614 + "cpu": [ 1615 + "x64" 1616 + ], 1617 + "dev": true, 1618 + "license": "Apache-2.0", 1619 + "optional": true, 1620 + "os": [ 1621 + "linux" 1622 + ], 1623 + "engines": { 1624 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1625 + }, 1626 + "funding": { 1627 + "url": "https://opencollective.com/libvips" 1628 + }, 1629 + "optionalDependencies": { 1630 + "@img/sharp-libvips-linux-x64": "1.1.0" 1631 + } 1632 + }, 1633 + "node_modules/@img/sharp-linuxmusl-arm64": { 1634 + "version": "0.34.1", 1635 + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.1.tgz", 1636 + "integrity": "sha512-DfvyxzHxw4WGdPiTF0SOHnm11Xv4aQexvqhRDAoD00MzHekAj9a/jADXeXYCDFH/DzYruwHbXU7uz+H+nWmSOQ==", 1637 + "cpu": [ 1638 + "arm64" 1639 + ], 1640 + "dev": true, 1641 + "license": "Apache-2.0", 1642 + "optional": true, 1643 + "os": [ 1644 + "linux" 1645 + ], 1646 + "engines": { 1647 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1648 + }, 1649 + "funding": { 1650 + "url": "https://opencollective.com/libvips" 1651 + }, 1652 + "optionalDependencies": { 1653 + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0" 1654 + } 1655 + }, 1656 + "node_modules/@img/sharp-linuxmusl-x64": { 1657 + "version": "0.34.1", 1658 + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.1.tgz", 1659 + "integrity": "sha512-pax/kTR407vNb9qaSIiWVnQplPcGU8LRIJpDT5o8PdAx5aAA7AS3X9PS8Isw1/WfqgQorPotjrZL3Pqh6C5EBg==", 1660 + "cpu": [ 1661 + "x64" 1662 + ], 1663 + "dev": true, 1664 + "license": "Apache-2.0", 1665 + "optional": true, 1666 + "os": [ 1667 + "linux" 1668 + ], 1669 + "engines": { 1670 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1671 + }, 1672 + "funding": { 1673 + "url": "https://opencollective.com/libvips" 1674 + }, 1675 + "optionalDependencies": { 1676 + "@img/sharp-libvips-linuxmusl-x64": "1.1.0" 1677 + } 1678 + }, 1679 + "node_modules/@img/sharp-wasm32": { 1680 + "version": "0.34.1", 1681 + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.1.tgz", 1682 + "integrity": "sha512-YDybQnYrLQfEpzGOQe7OKcyLUCML4YOXl428gOOzBgN6Gw0rv8dpsJ7PqTHxBnXnwXr8S1mYFSLSa727tpz0xg==", 1683 + "cpu": [ 1684 + "wasm32" 1685 + ], 1686 + "dev": true, 1687 + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", 1688 + "optional": true, 1689 + "dependencies": { 1690 + "@emnapi/runtime": "^1.4.0" 1691 + }, 1692 + "engines": { 1693 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1694 + }, 1695 + "funding": { 1696 + "url": "https://opencollective.com/libvips" 1697 + } 1698 + }, 1699 + "node_modules/@img/sharp-win32-ia32": { 1700 + "version": "0.34.1", 1701 + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.1.tgz", 1702 + "integrity": "sha512-WKf/NAZITnonBf3U1LfdjoMgNO5JYRSlhovhRhMxXVdvWYveM4kM3L8m35onYIdh75cOMCo1BexgVQcCDzyoWw==", 1703 + "cpu": [ 1704 + "ia32" 1705 + ], 1706 + "dev": true, 1707 + "license": "Apache-2.0 AND LGPL-3.0-or-later", 1708 + "optional": true, 1709 + "os": [ 1710 + "win32" 1711 + ], 1712 + "engines": { 1713 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1714 + }, 1715 + "funding": { 1716 + "url": "https://opencollective.com/libvips" 1717 + } 1718 + }, 1719 + "node_modules/@img/sharp-win32-x64": { 1720 + "version": "0.34.1", 1721 + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.1.tgz", 1722 + "integrity": "sha512-hw1iIAHpNE8q3uMIRCgGOeDoz9KtFNarFLQclLxr/LK1VBkj8nby18RjFvr6aP7USRYAjTZW6yisnBWMX571Tw==", 1723 + "cpu": [ 1724 + "x64" 1725 + ], 1726 + "dev": true, 1727 + "license": "Apache-2.0 AND LGPL-3.0-or-later", 1728 + "optional": true, 1729 + "os": [ 1730 + "win32" 1731 + ], 1732 + "engines": { 1733 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 1734 + }, 1735 + "funding": { 1736 + "url": "https://opencollective.com/libvips" 1737 + } 1738 + }, 1341 1739 "node_modules/@isaacs/cliui": { 1342 1740 "version": "8.0.2", 1343 1741 "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", ··· 5016 5414 "typo-js": "*" 5017 5415 } 5018 5416 }, 5417 + "node_modules/color": { 5418 + "version": "4.2.3", 5419 + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", 5420 + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", 5421 + "dev": true, 5422 + "license": "MIT", 5423 + "dependencies": { 5424 + "color-convert": "^2.0.1", 5425 + "color-string": "^1.9.0" 5426 + }, 5427 + "engines": { 5428 + "node": ">=12.5.0" 5429 + } 5430 + }, 5019 5431 "node_modules/color-convert": { 5020 5432 "version": "2.0.1", 5021 5433 "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", ··· 5033 5445 "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 5034 5446 "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 5035 5447 "license": "MIT" 5448 + }, 5449 + "node_modules/color-string": { 5450 + "version": "1.9.1", 5451 + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", 5452 + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", 5453 + "dev": true, 5454 + "license": "MIT", 5455 + "dependencies": { 5456 + "color-name": "^1.0.0", 5457 + "simple-swizzle": "^0.2.2" 5458 + } 5036 5459 }, 5037 5460 "node_modules/colord": { 5038 5461 "version": "2.9.3", ··· 6016 6439 "license": "MIT", 6017 6440 "engines": { 6018 6441 "node": ">=6" 6442 + } 6443 + }, 6444 + "node_modules/detect-libc": { 6445 + "version": "2.0.3", 6446 + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", 6447 + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", 6448 + "dev": true, 6449 + "license": "Apache-2.0", 6450 + "engines": { 6451 + "node": ">=8" 6019 6452 } 6020 6453 }, 6021 6454 "node_modules/devlop": { ··· 12476 12909 "node": ">=8" 12477 12910 } 12478 12911 }, 12912 + "node_modules/sharp": { 12913 + "version": "0.34.1", 12914 + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.1.tgz", 12915 + "integrity": "sha512-1j0w61+eVxu7DawFJtnfYcvSv6qPFvfTaqzTQ2BLknVhHTwGS8sc63ZBF4rzkWMBVKybo4S5OBtDdZahh2A1xg==", 12916 + "dev": true, 12917 + "hasInstallScript": true, 12918 + "license": "Apache-2.0", 12919 + "dependencies": { 12920 + "color": "^4.2.3", 12921 + "detect-libc": "^2.0.3", 12922 + "semver": "^7.7.1" 12923 + }, 12924 + "engines": { 12925 + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" 12926 + }, 12927 + "funding": { 12928 + "url": "https://opencollective.com/libvips" 12929 + }, 12930 + "optionalDependencies": { 12931 + "@img/sharp-darwin-arm64": "0.34.1", 12932 + "@img/sharp-darwin-x64": "0.34.1", 12933 + "@img/sharp-libvips-darwin-arm64": "1.1.0", 12934 + "@img/sharp-libvips-darwin-x64": "1.1.0", 12935 + "@img/sharp-libvips-linux-arm": "1.1.0", 12936 + "@img/sharp-libvips-linux-arm64": "1.1.0", 12937 + "@img/sharp-libvips-linux-ppc64": "1.1.0", 12938 + "@img/sharp-libvips-linux-s390x": "1.1.0", 12939 + "@img/sharp-libvips-linux-x64": "1.1.0", 12940 + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0", 12941 + "@img/sharp-libvips-linuxmusl-x64": "1.1.0", 12942 + "@img/sharp-linux-arm": "0.34.1", 12943 + "@img/sharp-linux-arm64": "0.34.1", 12944 + "@img/sharp-linux-s390x": "0.34.1", 12945 + "@img/sharp-linux-x64": "0.34.1", 12946 + "@img/sharp-linuxmusl-arm64": "0.34.1", 12947 + "@img/sharp-linuxmusl-x64": "0.34.1", 12948 + "@img/sharp-wasm32": "0.34.1", 12949 + "@img/sharp-win32-ia32": "0.34.1", 12950 + "@img/sharp-win32-x64": "0.34.1" 12951 + } 12952 + }, 12479 12953 "node_modules/shebang-command": { 12480 12954 "version": "2.0.0", 12481 12955 "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", ··· 12604 13078 "engines": { 12605 13079 "node": ">=12" 12606 13080 } 13081 + }, 13082 + "node_modules/simple-swizzle": { 13083 + "version": "0.2.2", 13084 + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", 13085 + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", 13086 + "dev": true, 13087 + "license": "MIT", 13088 + "dependencies": { 13089 + "is-arrayish": "^0.3.1" 13090 + } 13091 + }, 13092 + "node_modules/simple-swizzle/node_modules/is-arrayish": { 13093 + "version": "0.3.2", 13094 + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", 13095 + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", 13096 + "dev": true, 13097 + "license": "MIT" 12607 13098 }, 12608 13099 "node_modules/slash": { 12609 13100 "version": "3.0.0",
+1
package.json
··· 91 91 "license-checker-rseidelsohn": "4.4.2", 92 92 "markdownlint-cli": "0.44.0", 93 93 "postcss-html": "1.8.0", 94 + "sharp": "0.34.1", 94 95 "stylelint": "16.17.0", 95 96 "stylelint-declaration-block-no-ignored-properties": "2.8.0", 96 97 "stylelint-declaration-strict-value": "1.10.11",
public/assets/img/apple-touch-icon.png

This is a binary file and will not be displayed.

public/assets/img/avatar_default.png

This is a binary file and will not be displayed.

public/assets/img/favicon.png

This is a binary file and will not be displayed.

-1
public/assets/img/gitea.svg
··· 1 - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 212 212" width="32" height="32"><style>circle,path{fill:none;stroke:#000;stroke-width:15}path{stroke-width:25}.orange{stroke:#f60}.red{stroke:#d40000}</style><g transform="translate(6 6)"><path d="M58 168V70a50 50 0 0 1 50-50h20" class="orange"/><path d="M58 168v-30a50 50 0 0 1 50-50h20" class="red"/><circle cx="142" cy="20" r="18" class="orange"/><circle cx="142" cy="88" r="18" class="red"/><circle cx="58" cy="180" r="18" class="red"/></g></svg>
public/assets/img/logo.png

This is a binary file and will not be displayed.

+1 -1
routers/install/routes_test.go
··· 28 28 assert.Equal(t, 404, w.Code) 29 29 30 30 w = httptest.NewRecorder() 31 - req = httptest.NewRequest("GET", "/assets/img/gitea.svg", nil) 31 + req = httptest.NewRequest("GET", "/assets/img/forgejo.svg", nil) 32 32 r.ServeHTTP(w, req) 33 33 assert.Equal(t, 200, w.Code) 34 34 }
+6 -30
tools/generate-images.js
··· 1 - #!/usr/bin/env node 2 - import imageminZopfli from 'imagemin-zopfli'; // eslint-disable-line import-x/no-unresolved 3 - import {loadSVGFromString, Canvas, Rect, util} from 'fabric/node'; // eslint-disable-line import-x/no-unresolved 4 1 import {optimize} from 'svgo'; 5 2 import {readFile, writeFile} from 'node:fs/promises'; 6 - import {argv, exit} from 'node:process'; 3 + import {exit} from 'node:process'; 4 + import SharpConstructor from 'sharp'; 5 + import {fileURLToPath} from 'node:url'; 7 6 8 7 function doExit(err) { 9 8 if (err) console.error(err); ··· 28 27 return; 29 28 } 30 29 31 - const {objects, options} = await loadSVGFromString(svg); 32 - const canvas = new Canvas(); 33 - canvas.setDimensions({width: size, height: size}); 34 - const ctx = canvas.getContext('2d'); 35 - ctx.scale(options.width ? (size / options.width) : 1, options.height ? (size / options.height) : 1); 36 - 30 + let sharp = (new SharpConstructor(Buffer.from(svg))).resize(size, size).png({compressionLevel: 9, palette: true, effort: 10, quality: 80}); 37 31 if (bg) { 38 - canvas.add(new Rect({ 39 - left: 0, 40 - top: 0, 41 - height: size * (1 / (size / options.height)), 42 - width: size * (1 / (size / options.width)), 43 - fill: 'white', 44 - })); 45 - } 46 - 47 - canvas.add(util.groupSVGElements(objects, options)); 48 - canvas.renderAll(); 49 - 50 - let png = Buffer.from([]); 51 - for await (const chunk of canvas.createPNGStream()) { 52 - png = Buffer.concat([png, chunk]); 32 + sharp = sharp.flatten({background: 'white'}); 53 33 } 54 - 55 - png = await imageminZopfli({more: true})(png); 56 - await writeFile(outputFile, png); 34 + sharp.toFile(fileURLToPath(outputFile), (err) => err !== null && console.error(err) && exit(1)); 57 35 } 58 36 59 37 async function main() { 60 - const gitea = argv.slice(2).includes('gitea'); 61 38 const logoSvg = await readFile(new URL('../assets/logo.svg', import.meta.url), 'utf8'); 62 39 const faviconSvg = await readFile(new URL('../assets/favicon.svg', import.meta.url), 'utf8'); 63 40 ··· 68 45 generate(faviconSvg, '../public/assets/img/favicon.png', {size: 180}), 69 46 generate(logoSvg, '../public/assets/img/avatar_default.png', {size: 200}), 70 47 generate(logoSvg, '../public/assets/img/apple-touch-icon.png', {size: 180, bg: true}), 71 - gitea && generate(logoSvg, '../public/assets/img/gitea.svg', {size: 32}), 72 48 ]); 73 49 } 74 50