mid coding commit
This commit is contained in:
38
neode-ui/scripts/create-placeholder-icons.sh
Executable file
38
neode-ui/scripts/create-placeholder-icons.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Create simple placeholder icons using ImageMagick or fallback to SVG
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
ICON_DIR="public/assets/img/app-icons"
|
||||
|
||||
# Create endurain placeholder
|
||||
if command -v convert &> /dev/null; then
|
||||
convert -size 512x512 xc:none -fill "rgba(100,150,255,200)" -draw "circle 256,256 256,100" -pointsize 200 -fill white -gravity center -annotate +0+0 "E" "$ICON_DIR/endurain.png" 2>/dev/null && echo "✅ Created endurain.png"
|
||||
elif command -v magick &> /dev/null; then
|
||||
magick -size 512x512 xc:none -fill "rgba(100,150,255,200)" -draw "circle 256,256 256,100" -pointsize 200 -fill white -gravity center -annotate +0+0 "E" "$ICON_DIR/endurain.png" 2>/dev/null && echo "✅ Created endurain.png"
|
||||
else
|
||||
# Fallback: Create simple SVG
|
||||
cat > "$ICON_DIR/endurain.svg" << 'SVGEOF'
|
||||
<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="256" cy="256" r="156" fill="rgba(100,150,255,200)"/>
|
||||
<text x="256" y="256" font-size="200" fill="white" text-anchor="middle" dominant-baseline="central" font-weight="bold">E</text>
|
||||
</svg>
|
||||
SVGEOF
|
||||
echo "✅ Created endurain.svg"
|
||||
fi
|
||||
|
||||
# Create morphos-server placeholder
|
||||
if command -v convert &> /dev/null; then
|
||||
convert -size 512x512 xc:none -fill "rgba(150,100,255,200)" -draw "rectangle 100,100 412,412" -pointsize 200 -fill white -gravity center -annotate +0+0 "M" "$ICON_DIR/morphos-server.png" 2>/dev/null && echo "✅ Created morphos-server.png"
|
||||
elif command -v magick &> /dev/null; then
|
||||
magick -size 512x512 xc:none -fill "rgba(150,100,255,200)" -draw "rectangle 100,100 412,412" -pointsize 200 -fill white -gravity center -annotate +0+0 "M" "$ICON_DIR/morphos-server.png" 2>/dev/null && echo "✅ Created morphos-server.png"
|
||||
else
|
||||
# Fallback: Create simple SVG
|
||||
cat > "$ICON_DIR/morphos-server.svg" << 'SVGEOF'
|
||||
<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="100" y="100" width="312" height="312" rx="40" fill="rgba(150,100,255,200)"/>
|
||||
<text x="256" y="256" font-size="200" fill="white" text-anchor="middle" dominant-baseline="central" font-weight="bold">M</text>
|
||||
</svg>
|
||||
SVGEOF
|
||||
echo "✅ Created morphos-server.svg"
|
||||
fi
|
||||
|
||||
150
neode-ui/scripts/download-app-icons.js
Executable file
150
neode-ui/scripts/download-app-icons.js
Executable file
@@ -0,0 +1,150 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Script to download app icons from GitHub repositories
|
||||
* Downloads icons for all dummy apps from Start9Labs/{app-id}-startos repos
|
||||
*/
|
||||
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import https from 'https'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
||||
const appIds = [
|
||||
'bitcoin',
|
||||
'btcpay-server',
|
||||
'homeassistant',
|
||||
'grafana',
|
||||
'endurain',
|
||||
'fedimint',
|
||||
'morphos-server',
|
||||
'lightning-stack',
|
||||
'mempool',
|
||||
'ollama',
|
||||
'searxng',
|
||||
'onlyoffice',
|
||||
'penpot'
|
||||
]
|
||||
|
||||
// Map app IDs to their Start9 repo names (some might differ)
|
||||
const repoMap = {
|
||||
'bitcoin': 'bitcoind-startos',
|
||||
'btcpay-server': 'btcpayserver-startos',
|
||||
'homeassistant': 'home-assistant-startos',
|
||||
'grafana': 'grafana-startos',
|
||||
'lightning-stack': 'lnd-startos',
|
||||
'mempool': 'mempool-startos',
|
||||
'searxng': 'searxng-startos',
|
||||
'onlyoffice': 'onlyoffice-startos',
|
||||
'penpot': 'penpot-startos',
|
||||
}
|
||||
|
||||
const iconDir = path.join(__dirname, '../public/assets/img/app-icons')
|
||||
|
||||
// Ensure directory exists
|
||||
if (!fs.existsSync(iconDir)) {
|
||||
fs.mkdirSync(iconDir, { recursive: true })
|
||||
}
|
||||
|
||||
function downloadFile(url, filepath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const file = fs.createWriteStream(filepath)
|
||||
|
||||
https.get(url, (response) => {
|
||||
if (response.statusCode === 200) {
|
||||
response.pipe(file)
|
||||
file.on('finish', () => {
|
||||
file.close()
|
||||
console.log(`✅ Downloaded: ${path.basename(filepath)}`)
|
||||
resolve()
|
||||
})
|
||||
} else if (response.statusCode === 404) {
|
||||
file.close()
|
||||
fs.unlinkSync(filepath) // Delete empty file
|
||||
console.log(`⚠️ Not found: ${url}`)
|
||||
reject(new Error(`404: ${url}`))
|
||||
} else {
|
||||
file.close()
|
||||
fs.unlinkSync(filepath)
|
||||
reject(new Error(`HTTP ${response.statusCode}: ${url}`))
|
||||
}
|
||||
}).on('error', (err) => {
|
||||
file.close()
|
||||
if (fs.existsSync(filepath)) {
|
||||
fs.unlinkSync(filepath)
|
||||
}
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function downloadIcon(appId) {
|
||||
const repoName = repoMap[appId] || `${appId}-startos`
|
||||
|
||||
// Try multiple icon paths
|
||||
const iconPaths = [
|
||||
`icon.png`,
|
||||
`icon.svg`,
|
||||
`assets/icon.png`,
|
||||
`assets/icon.svg`,
|
||||
]
|
||||
|
||||
for (const iconPath of iconPaths) {
|
||||
const url = `https://raw.githubusercontent.com/Start9Labs/${repoName}/main/${iconPath}`
|
||||
const extension = iconPath.endsWith('.svg') ? 'svg' : 'png'
|
||||
const filepath = path.join(iconDir, `${appId}.${extension}`)
|
||||
|
||||
// Skip if file already exists
|
||||
if (fs.existsSync(filepath)) {
|
||||
console.log(`⏭️ Skipping ${appId} (already exists)`)
|
||||
return true
|
||||
}
|
||||
|
||||
try {
|
||||
await downloadFile(url, filepath)
|
||||
return true
|
||||
} catch (err) {
|
||||
// Try next path
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`❌ Failed to download icon for ${appId}`)
|
||||
return false
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log('Downloading app icons from GitHub...\n')
|
||||
|
||||
const results = {
|
||||
success: [],
|
||||
failed: []
|
||||
}
|
||||
|
||||
for (const appId of appIds) {
|
||||
try {
|
||||
const success = await downloadIcon(appId)
|
||||
if (success) {
|
||||
results.success.push(appId)
|
||||
} else {
|
||||
results.failed.push(appId)
|
||||
}
|
||||
// Small delay to avoid rate limiting
|
||||
await new Promise(resolve => setTimeout(resolve, 500))
|
||||
} catch (err) {
|
||||
console.error(`Error downloading ${appId}:`, err.message)
|
||||
results.failed.push(appId)
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\n✅ Successfully downloaded ${results.success.length} icons`)
|
||||
if (results.failed.length > 0) {
|
||||
console.log(`❌ Failed to download ${results.failed.length} icons:`, results.failed.join(', '))
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error)
|
||||
|
||||
Reference in New Issue
Block a user