Skip to content

Commit

Permalink
added spark to device list for downloads json
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Nov 22, 2024
1 parent c449e2b commit 52947d8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions routes/downloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ var router = express.Router();
const Download = require('../models/Download'); // Assuming a similar model for downloads
const { ensureAuthenticated } = require('../middleware/checkAuth');

const devices = ['gloves', 'orbit', 'handle', 'duo', 'chromadeck', 'spark', 'desktop'];
const categories = ['firmware', 'editor', 'emulator'];

async function getCategorizedDownloads() {
const allDownloads = await Download.find().sort({ category: 1, name: 1 }).exec();
let categorizedDownloads = allDownloads.reduce((acc, download) => {
Expand All @@ -29,8 +32,6 @@ async function getCategorizedDownloads() {

router.get('/', async function(req, res, next) {
try {
const devices = ['gloves', 'orbit', 'handle', 'chromadeck', 'duo', 'desktop']; // Example devices
const categories = ['firmware', 'editor', 'emulator']; // Example categories
let latestDownloads = {};

for (const device of devices) {
Expand Down Expand Up @@ -87,8 +88,6 @@ router.post('/new', async function(req, res, next) {

router.get('/json', async function(req, res, next) {
try {
const devices = ['gloves', 'orbit', 'handle', 'chromadeck', 'duo', 'desktop'];
const categories = ['firmware', 'editor', 'emulator'];
let latestDownloads = {};

for (const device of devices) {
Expand All @@ -115,8 +114,6 @@ router.get('/json', async function(req, res, next) {
router.get('/json/:device', async function (req, res, next) {
try {
const device = req.params.device;
const devices = ['gloves', 'orbit', 'handle', 'chromadeck', 'duo', 'desktop'];
const categories = ['firmware', 'editor', 'emulator'];

if (!devices.includes(device)) {
return res.status(404).json({ error: 'Device not found' });
Expand Down

0 comments on commit 52947d8

Please sign in to comment.