diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..8ab3485 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,3 @@ +{ + "esversion": 6 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..8315353 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}\\index.js" + } + ] +} \ No newline at end of file diff --git a/routes/articles.js b/routes/articles.js index 4cc734a..5ffbe72 100644 --- a/routes/articles.js +++ b/routes/articles.js @@ -24,7 +24,7 @@ ${contents} } function articles_item(request, response) { - var article = fs.readFileSync('./articles/' + request.params.item); + var article = fs.readFileSync('./articles/' + decodeURIComponent(request.params.item)); response.send(`20 text/gemini\r\n ${article} diff --git a/routes/index.js~ b/routes/index.js~ deleted file mode 100644 index cdd9d6f..0000000 --- a/routes/index.js~ +++ /dev/null @@ -1,29 +0,0 @@ -/* GET home page. */ -function index(request, response) { - var adminBlock = ""; - if(request.clientCert.fingerprint == '96:19:A6:91:57:AF:E2:D3:E0:80:FC:35:4E:BD:2A:46:C9:2D:CB:53') { - adminBlock = '## Administration\r\n=> /admin Administration'; - } -response.send(`20 text/gemini\r\n -\`\`\` Uplink:SI Logo -■ ■ ■ ■ _ _ ____ _ _ _ _ _ _ ____ _ ■ ■ ■ ■ - ■ ■ ■ | | |__/ | | |\\ | |_/ / [__ | ■ ■ ■ - ■ ■ \\__/ | |___ | | \\| | \\_ / ___] | ■ ■ - ■ ■ - -=Est. 2021=- -\`\`\` -Uplink is my conection to the Gemini Space. It is to become a great site. At this moment I will be publishing my own articles, my own content. -# Uplink:SI - -## About this server -Uplink.si started about ten years ago. A long time in Internet time. First it was running on free dynamic domains but at some point Uplink.si was registered. The server was always running HTTP and Gopher servers. I was always fascinated by old technologies, primarily because they were simple to understand fully. Back then I wrote a small gopher+ server and client. Now Gemini came along. Gemini is similar to Gopher in that fascinating simplicity. I was able to write a server in about 100 lines of JavaScript and it worked. - -This server is evolution of the one I wrote in that one weekend. It is a bit more advanced, it resembles Express framework for NodeJS. That architecture should make it a bit easier to expand. - -## Articles -=> /articles/ Articles -${adminBlock} -`); -} - -module.exports = index;