diff --git a/Build.js b/Build.js index e4b9ba7..630e218 100644 --- a/Build.js +++ b/Build.js @@ -1,5 +1,6 @@ const fs = require('fs') -const Log = require('./Log').Log +const path = require('path') +const { Log, LogColors } = require('./Log') const JSProcessorOptions = { compact: true, @@ -83,10 +84,10 @@ const PackStylesheets = async () => { Stylesheet = new CSSProcessor(CSSProcessorOptions).minify(Stylesheet).styles; fs.mkdir('./build', (err) => {}) - let p = __dirname + '/build/production.css' - fs.writeFileSync(p, Stylesheet) + let OutputFile = path.join(__dirname, '/build/production.css') + fs.writeFileSync(OutputFile, Stylesheet) - Log('[BUILD] - Finished file: ' + p) + Log(`[BUILD] - Finished file: ${OutputFile}`, LogColors.Success) } const PackScripts = async () => { @@ -105,10 +106,10 @@ const PackScripts = async () => { Script = JSProcessor.obfuscate(Script, JSProcessorOptions).getObfuscatedCode() fs.mkdir('./build', (err) => {}) - let p = __dirname + '/build/production.js' - fs.writeFileSync(p, Script, { recursive: true }) + let OutputFile = path.join(__dirname, '/build/production.js') + fs.writeFileSync(OutputFile, Script, { recursive: true }) - Log('[BUILD] - Finished file: ' + p) + Log(`[BUILD] - Finished file: ${OutputFile}`, LogColors.Success) } PackStylesheets() diff --git a/Log.js b/Log.js index 8e27af2..a0fb68b 100644 --- a/Log.js +++ b/Log.js @@ -1,25 +1,65 @@ -const process = require('process') -const P = (Input) => { - return Input.toString().length < 2 ? '0' + Input : Input + +const ColorsForeground = Object.freeze({ + Black: 30, + Red: 31, + Green: 32, + Yellow: 33, + Blue: 34, + Magenta: 35, + Cyan: 36, + White: 37, + Gray: 90 +}); +const ColorsBackground = Object.freeze({ + Black: 40, + Red: 41, + Green: 42, + Yellow: 43, + Blue: 44, + Magenta: 45, + Cyan: 46, + White: 47, + Gray: 100 +}); + +const LogColors = Object.freeze({ + Default: { + fg: null, + bg: null + }, + Warning: { + fg: ColorsForeground.Black, + bg: ColorsBackground.Yellow + }, + Error: { + fg: ColorsForeground.White, + bg: ColorsBackground.Red + }, + Success: { + fg: ColorsForeground.Green, + bg: null + } +}); + +const LogPrivate = (String, Colors = LogColors.Default) => { + const ControlCode = (Code) => { + return `\x1b[${Code}m` + } + console.log(`${Colors.fg ? ControlCode(Colors.fg) : ""}${Colors.bg ? ControlCode(Colors.bg) : ""}${Colors != LogColors.Default ? ControlCode(1) : ""}${String.toString()}${ControlCode(0)}`) } -const Q = (Input) => { - for (let x = 0; x < 4; x++) { - if (Input.toString().length < 4) { - Input = '0' + Input + +const Log = (String, Colors = LogColors.Default) => { + const GenerateTimestamp = () => { + const P = (Input, Length = 2) => { + let Output = Input.toString(); + while (Output.length < Length) + Output = "0" + Output + return Output; } + let N = new Date(Date.now()); + return `${P(N.getMonth() + 1)}/${P(N.getDate())}/${P(N.getFullYear(), 4)} ${P(N.getHours() > 12 ? N.getHours() - 12 : N.getHours())}:${P(N.getMinutes())}:${P(N.getSeconds())}.${P(N.getMilliseconds(), 4)} ${N.getHours() >= 12 ? "PM" : "AM"}` } - return Input -} -const MakeFormat = () => { - let D = new Date(Date.now()) - let FormattingTag = P(D.getDay()) + '/' + P(D.getMonth()) + '/' + D.getFullYear() - FormattingTag += - ' | ' + P(D.getHours()) + ':' + P(D.getMinutes()) + ':' + P(D.getSeconds()) + '.' + Q(D.getMilliseconds()) - return '[' + FormattingTag + ']' -} -const Log = (String) => { - // eslint-disable-next-line no-console - console.log(MakeFormat() + ' - ' + String.toString()) + LogPrivate(`[${GenerateTimestamp()}] ${String}`, Colors) } -module.exports = { Log } +module.exports = { ColorsForeground, ColorsBackground, LogColors, Log }; \ No newline at end of file diff --git a/Server.js b/Server.js index 781db9b..c04fd29 100644 --- a/Server.js +++ b/Server.js @@ -3,14 +3,17 @@ const { App } = require('./App') const { Log } = require('./Log') const Server = http.createServer(App) -Server.listen(process.env.PORT) +if (process.argv[2]) + Server.listen(process.argv[2]) +else + Server.listen(process.env.PORT) Server.on('listening', () => { const Address = Server.address() const Binding = typeof Address === 'string' ? `pipe ${Address}` : `port ${Address.port}` if (Address.port < 10000) { Log(`Listening on ${Binding}`) - Log(`Local address (if available): http://127.0.0.1:${Address.port}`) + Log(`Local address: http://127.0.0.1:${Address.port}`) } }) diff --git a/assets/images/sf20401.jpg b/assets/images/sf20401.jpg new file mode 100644 index 0000000..e5abe3d Binary files /dev/null and b/assets/images/sf20401.jpg differ diff --git a/assets/images/sf20401.png b/assets/images/sf20401.png deleted file mode 100644 index 3cb431d..0000000 Binary files a/assets/images/sf20401.png and /dev/null differ diff --git a/assets/images/sf20402.jpg b/assets/images/sf20402.jpg new file mode 100644 index 0000000..bb27221 Binary files /dev/null and b/assets/images/sf20402.jpg differ diff --git a/assets/images/sf20403.jpg b/assets/images/sf20403.jpg new file mode 100644 index 0000000..f35011e Binary files /dev/null and b/assets/images/sf20403.jpg differ diff --git a/assets/images/sf20404.jpg b/assets/images/sf20404.jpg new file mode 100644 index 0000000..7914ea1 Binary files /dev/null and b/assets/images/sf20404.jpg differ diff --git a/components/Body.js b/components/Body.js index 127355d..7ddc6e6 100644 --- a/components/Body.js +++ b/components/Body.js @@ -1,6 +1,6 @@ const Body = async (Request, Inner) => { return ` - + ${Inner} diff --git a/css/PostContent.css b/css/PostContent.css index 83f44b6..759398f 100644 --- a/css/PostContent.css +++ b/css/PostContent.css @@ -1,9 +1,8 @@ .article-content p img { max-width: 100%; - max-height: 300px; + max-height: 500px; margin: 0px auto; display: block; - border-radius: 15px; } .image-caption { text-align: center; diff --git a/posts/sf2040.md b/posts/sf2040.md index c230ab6..1858261 100644 --- a/posts/sf2040.md +++ b/posts/sf2040.md @@ -12,52 +12,51 @@ > This page is a modified version of the README from the [GitHub repository](https://github.com/strayfade/sf2040), and may become outdated. For the most recent version of this page, read the [GitHub README](https://github.com/strayfade/sf2040) instead. -### About + +### About The sf2040 is a mechanical 76-key keyboard based on the [RP2040](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf) microcontroller from Raspberry Pi. > This project has been certified by the OSHWA as open source hardware. > -> `[OSHW] US002610 | Certified open source hardware | oshwa.org/cert` - - +> ```html +> [OSHW] US002610 | Certified open source hardware | oshwa.org/cert +> ``` ### Features -- USB Type-C Port -- Fully open-source/open-hardware design and firmware files -- **No LED backlight** -- **No Bluetooth/wireless connectivity** +- USB Type-C Port +- Fully open-source/open-hardware design and firmware files +- **No LED backlight** +- **No Bluetooth/wireless connectivity** ### Assembly/Mechanical Information **Required** parts: -- PCB ([Download Gerber](https://github.com/strayfade/sf2040/blob/main/pcb/Gerber/Gerber.zip)) -- 3D-printed case ([Download .STEP](https://github.com/strayfade/sf2040/blob/main/case/Case.step)) -- Keyboard plate ([Download .STEP](https://github.com/strayfade/sf2040/blob/main/plate/Plate.step)) -- _Your choice of 76 full-size MX-style keyswitches_ -- MX-style Hot Swap Switch Mounts ([Amazon](https://www.amazon.com/gp/product/B0B4W9YMGM)) -- Screw-in PCB Mount Stabilizers ([Amazon](https://www.amazon.com/gp/product/B0CN38CXQ3)) +- PCB +- 3D-printed case +- Keyswitch plate +- _Your choice of 76 full-size MX-style keyswitches_ +- MX-style Hot Swap Switch Mounts ([Amazon](https://www.amazon.com/gp/product/B0B4W9YMGM)) +- Screw-in PCB Mount Stabilizers ([Amazon](https://www.amazon.com/gp/product/B0CN38CXQ3)) **Optional, but recommended** parts: -- 0.5mm Foam Switch Dampeners ([Amazon](https://www.amazon.com/gp/product/B0B942VCMV)) -- Krytox 205 Grade 0 Lubricant -- Switch disassembly tools -- Case filler (I used off-brand polyester fiber) +- 0.5mm Foam Switch Dampeners ([Amazon](https://www.amazon.com/gp/product/B0B942VCMV)) +- Krytox 205 Grade 0 Lubricant +- Switch disassembly tools +- Case filler (I used polyester fiber) ### Firmware -This keyboard runs standard [QMK firmware](https://docs.qmk.fm/#/), configuration for which is included in the repository. - -> The firmware can be downloaded pre-configured for this keyboard [here](https://github.com/strayfade/sf2040/raw/main/firmware/builds/sf2040.uf2). - -The contents of the `firmware` folder in the repository should be copied into QMK's working keyboard directory (usually `qmk_firmware/keyboards`) before building. +This keyboard runs standard [QMK firmware](https://docs.qmk.fm/#/), configuration for which is included in this repository. Build with support for VIA enabled: - qmk compile -kb sf2040 -km via +```sh +qmk compile -kb sf2040 -km via +``` The RP2040's bootloader can be accessed by holding the **ESC** key while plugging in the keyboard. Then, simply drag-and-drop the output `.uf2` firmware into the bootloader folder. @@ -67,4 +66,13 @@ This keyboard has been merged into the [QMK repository](https://github.com/qmk/q ### License -The sf2040 keyboard design and firmware is released under the GPL3 license. Contributions and pull requests to the repository are always welcome! +The sf2040 keyboard design and firmware is released under the GPL3 license. Contributions and pull requests to this repository are always welcome! + + +

Gallery

+ +
+ + + +
\ No newline at end of file