You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2026-04-26 20:43:22 +02:00
30 lines
807 B
JavaScript
Vendored
30 lines
807 B
JavaScript
Vendored
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
module.exports = function apiIconsPlugin() {
|
|
return {
|
|
name: 'api-icons-plugin',
|
|
async contentLoaded({ actions }) {
|
|
const { setGlobalData } = actions;
|
|
|
|
const iconsDir = path.join(__dirname, '../static/img/APIs');
|
|
|
|
try {
|
|
const files = fs.readdirSync(iconsDir);
|
|
const iconList = files
|
|
.filter(file =>
|
|
file.endsWith('.png') &&
|
|
file !== 'default.png' &&
|
|
fs.statSync(path.join(iconsDir, file)).isFile()
|
|
)
|
|
.map(file => `/img/APIs/${file}`);
|
|
|
|
setGlobalData({ iconList });
|
|
} catch (error) {
|
|
console.error('Error reading API icons:', error);
|
|
setGlobalData({ iconList: [] });
|
|
}
|
|
},
|
|
};
|
|
};
|