mirror of
https://github.com/Aviortheking/codestats-skyline.git
synced 2025-07-06 06:29:18 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
e27d42d37d
|
|||
9e81ea201d
|
|||
d3963900e7
|
@ -30,6 +30,8 @@ RUN npm run build
|
||||
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
|
6
index.ts
6
index.ts
@ -21,6 +21,12 @@ app.get('/', async (req, res) => {
|
||||
// Generate the STL
|
||||
const bfr = await generateThingy(username, yearN)
|
||||
|
||||
if (!bfr) {
|
||||
res.status(500)
|
||||
.send('It seems the generator could not generate, Please open an issue on Github https://github.com/aviortheking/codestats-skyline/issues/new')
|
||||
return
|
||||
}
|
||||
|
||||
// force download the STL with a good name
|
||||
res
|
||||
.setHeader('Content-Disposition', `attachment; filename=${username}-${year ? year : 'full'}.stl`)
|
||||
|
8
main.ts
8
main.ts
@ -60,7 +60,7 @@ export const generateThingy = async (username: string, filterYear?: number): Pro
|
||||
if (month === '') {
|
||||
continue
|
||||
}
|
||||
correctedData[month] = Array(31).fill(0)
|
||||
correctedData[month] = Array(32).fill(0)
|
||||
}
|
||||
|
||||
// loop through each dates
|
||||
@ -102,7 +102,11 @@ export const generateThingy = async (username: string, filterYear?: number): Pro
|
||||
final += `max = ${max};\n`
|
||||
final += `min = ${min};\n`
|
||||
final += `text = "${username}";\n`
|
||||
final += `year = ${filterYear};\n`
|
||||
final += `year = "${filterYear}";\n`
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.log(final)
|
||||
}
|
||||
|
||||
// Fetch the CAD file
|
||||
let cadPath = './3d.scad'
|
||||
|
Reference in New Issue
Block a user