-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from JSPaste/dev
Merge dev into stable
- Loading branch information
Showing
20 changed files
with
510 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,175 +1,138 @@ | ||
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore | ||
# JSP specific | ||
documents/ | ||
|
||
# Logs | ||
|
||
logs | ||
_.log | ||
npm-debug.log_ | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Caches | ||
# IntelliJ based IDEs | ||
.idea/ | ||
|
||
.cache | ||
# Finder (MacOS) folder config | ||
.DS_Store/ | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
|
||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
|
||
pids | ||
_.pid | ||
_.seed | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
|
||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
|
||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
|
||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
|
||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
|
||
bower_components | ||
|
||
# node-waf configuration | ||
|
||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
|
||
build/Release | ||
|
||
# Dependency directories | ||
|
||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
|
||
web_modules/ | ||
|
||
# TypeScript cache | ||
|
||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
|
||
.npm | ||
|
||
# Optional eslint cache | ||
|
||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
|
||
.stylelintcache | ||
|
||
# Microbundle cache | ||
|
||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
|
||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
|
||
*.tgz | ||
|
||
# Yarn Integrity file | ||
|
||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
|
||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
|
||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
|
||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
|
||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
|
||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
|
||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
|
||
# public | ||
|
||
# vuepress build output | ||
|
||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
|
||
.temp | ||
|
||
# Docusaurus cache and generated files | ||
|
||
.docusaurus | ||
|
||
# Serverless directories | ||
|
||
.serverless/ | ||
|
||
# FuseBox cache | ||
|
||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
|
||
.dynamodb/ | ||
|
||
# TernJS port file | ||
|
||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
|
||
.vscode-test | ||
|
||
# yarn v2 | ||
|
||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# IntelliJ based IDEs | ||
.idea | ||
|
||
# Finder (MacOS) folder config | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
node_modules/ | ||
pnpm-lock.yaml | ||
**/documents/ | ||
**/node_modules/ | ||
.prettierrc.json | ||
LICENSE | ||
tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
{ | ||
"tabWidth": 4, | ||
"useTabs": true, | ||
"semi": true, | ||
"singleQuote": true, | ||
"plugins": ["prettier-plugin-packagejson", "prettier-plugin-jsdoc"], | ||
|
||
"arrowParens": "always", | ||
"bracketSameLine": false, | ||
"bracketSpacing": true, | ||
"quoteProps": "consistent", | ||
"embeddedLanguageFormatting": "auto", | ||
"endOfLine": "lf", | ||
"htmlWhitespaceSensitivity": "css", | ||
"insertPragma": false, | ||
"arrowParens": "always" | ||
"jsxSingleQuote": true, | ||
"printWidth": 100, | ||
"proseWrap": "preserve", | ||
"quoteProps": "as-needed", | ||
"requirePragma": false, | ||
"semi": true, | ||
"singleAttributePerLine": false, | ||
"singleQuote": true, | ||
"tabWidth": 4, | ||
"trailingComma": "none", | ||
"useTabs": true, | ||
"vueIndentScriptAndStyle": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@echo off | ||
|
||
for /R %%i in (src\structures\*.proto) do ( | ||
echo Compiling '%%~ni' | ||
npx protoc --proto_path=".\src\structures" --ts_out=".\src\structures" "%%~ni.proto" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
for i in $(find src/structures -name '*.proto'); do | ||
echo "Compiling '${i%%.*}'" | ||
npx protoc --proto_path="./src/structures" --ts_out="./src/structures" "${i}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
{ | ||
"private": true, | ||
"name": "jspaste-backend", | ||
"license": "EUPL-1.2-or-later", | ||
"module": "src/index.ts", | ||
"type": "module", | ||
"scripts": { | ||
"start": "NODE_ENV=production bun src/index.ts", | ||
"dev": "NODE_ENV=development bun --hot src/index.ts", | ||
"lint": "bun prettier --write ." | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "latest", | ||
"prettier": "^3.1.1" | ||
}, | ||
"peerDependencies": { | ||
"typescript": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@elysiajs/cors": "^0.8.0", | ||
"@elysiajs/swagger": "^0.8.3", | ||
"elysia": "^0.8.8" | ||
}, | ||
"packageManager": "bun@1.0.21" | ||
} | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "jspaste-backend", | ||
"private": true, | ||
"license": "EUPL-1.2-or-later", | ||
"type": "module", | ||
"module": "src/index.ts", | ||
"scripts": { | ||
"dev": "NODE_ENV=development bun --hot ./src/index.ts", | ||
"fix": "bun run prettier", | ||
"prettier": "bunx prettier . --write", | ||
"start": "NODE_ENV=production bun ./src/index.ts" | ||
}, | ||
"dependencies": { | ||
"@elysiajs/cors": "^0.8.0", | ||
"@elysiajs/swagger": "^0.8.3", | ||
"@protobuf-ts/plugin": "^2.9.3", | ||
"@protobuf-ts/protoc": "^2.9.3", | ||
"@protobuf-ts/runtime": "^2.9.3", | ||
"elysia": "^0.8.9" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "latest", | ||
"prettier": "^3.1.1", | ||
"prettier-plugin-packagejson": "^2.4.9", | ||
"prettier-plugin-jsdoc": "^1.3.0", | ||
"typescript": "~5.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { BunFile } from 'bun'; | ||
import { DocumentDataStruct } from '../structures/documentStruct'; | ||
|
||
export class DocumentManager { | ||
static async read(file: BunFile): Promise<DocumentDataStruct> { | ||
return DocumentDataStruct.fromBinary( | ||
Bun.inflateSync(Buffer.from(await file.arrayBuffer())), | ||
); | ||
} | ||
|
||
static async write(filePath: string, document: DocumentDataStruct) { | ||
await Bun.write( | ||
filePath, | ||
Bun.deflateSync(DocumentDataStruct.toBinary(document)), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const basePath = process.env['DOCUMENTS_PATH'] ?? 'documents/'; | ||
export const maxDocLength = parseInt(process.env['MAX_FILE_LENGTH'] ?? '50000'); |
Oops, something went wrong.