aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.js189
-rw-r--r--src/server.py208
2 files changed, 324 insertions, 73 deletions
diff --git a/src/main.js b/src/main.js
index daa7a28..229907d 100644
--- a/src/main.js
+++ b/src/main.js
@@ -2,19 +2,25 @@ const FORM_STATE_KEY = "kj-clipboard-form-state-v1";
const HIGHLIGHTJS_LANGUAGES = [
"1c",
+ "SAS",
"abnf",
"accesslog",
"actionscript",
"ada",
+ "adoc",
"angelscript",
"apache",
+ "apacheconf",
"applescript",
"arcade",
"arduino",
+ "arm",
"armasm",
- "xml",
+ "as",
+ "asc",
"asciidoc",
"aspectj",
+ "atom",
"autohotkey",
"autoit",
"avrasm",
@@ -22,178 +28,295 @@ const HIGHLIGHTJS_LANGUAGES = [
"axapta",
"bash",
"basic",
+ "bat",
+ "bf",
+ "bind",
"bnf",
"brainfuck",
"c",
+ "c++",
"cal",
+ "capnp",
"capnproto",
- "ceylon",
- "clean",
+ "cc",
+ "clj",
"clojure",
- "clojure-repl",
+ "cls",
"cmake",
+ "cmake.in",
+ "cmd",
+ "coffee",
"coffeescript",
+ "console",
"coq",
"cos",
"cpp",
+ "cr",
+ "craftcms",
+ "crm",
"crmsh",
"crystal",
+ "cs",
"csharp",
+ "cson",
"csp",
"css",
+ "cts",
+ "cxx",
"d",
- "markdown",
"dart",
- "delphi",
+ "dfm",
"diff",
"django",
"dns",
+ "docker",
"dockerfile",
"dos",
+ "dpr",
"dsconfig",
+ "dst",
"dts",
"dust",
"ebnf",
"elixir",
"elm",
- "ruby",
- "erb",
- "erlang-repl",
+ "erl",
"erlang",
"excel",
+ "f90",
+ "f95",
"fix",
- "flix",
"fortran",
+ "fs",
"fsharp",
+ "fsi",
+ "fsscript",
+ "fsx",
"gams",
"gauss",
+ "gawk",
"gcode",
+ "gemspec",
"gherkin",
"glsl",
- "gml",
+ "gms",
"go",
+ "golang",
"golo",
+ "gololang",
"gradle",
+ "graph",
"graphql",
"groovy",
+ "gss",
+ "gyp",
+ "h",
+ "h++",
"haml",
"handlebars",
"haskell",
"haxe",
- "hsp",
- "http",
+ "hbs",
+ "hh",
+ "hpp",
+ "hs",
"html",
+ "html.handlebars",
+ "html.hbs",
+ "http",
+ "https",
+ "hx",
+ "hxx",
"hy",
+ "hylang",
+ "i7",
+ "iced",
"inform7",
"ini",
+ "ino",
+ "instances",
+ "irb",
"irpf90",
- "isbl",
"java",
"javascript",
- "jboss-cli",
+ "jinja",
+ "jl",
+ "js",
"json",
+ "jsp",
+ "jsx",
"julia",
"julia-repl",
+ "k",
+ "kdb",
"kotlin",
+ "kt",
"lasso",
- "latex",
+ "lassoscript",
"ldif",
"leaf",
"less",
"lisp",
"livecodeserver",
"livescript",
- "llvm",
- "lsl",
"lua",
+ "mak",
+ "make",
"makefile",
+ "markdown",
"mathematica",
"matlab",
+ "mawk",
"maxima",
+ "md",
"mel",
"mercury",
+ "mips",
"mipsasm",
"mizar",
- "perl",
+ "mk",
+ "mkd",
+ "mkdown",
+ "mm",
+ "mma",
"mojolicious",
"monkey",
+ "moon",
"moonscript",
+ "mts",
"n1ql",
- "nestedtext",
+ "nawk",
+ "nc",
"nginx",
+ "nginxconf",
"nim",
+ "nimrod",
"nix",
- "node-repl",
"nsis",
+ "obj-c",
+ "obj-c++",
+ "objc",
+ "objective-c++",
"objectivec",
"ocaml",
"openscad",
+ "osascript",
"oxygene",
+ "p21",
"parser3",
+ "pas",
+ "pascal",
+ "patch",
+ "pcmk",
+ "perl",
"pf",
+ "pf.conf",
"pgsql",
"php",
- "php-template",
+ "pl",
"plaintext",
+ "plist",
+ "pm",
+ "podspec",
"pony",
+ "postgres",
+ "postgresql",
"powershell",
+ "pp",
"processing",
"profile",
"prolog",
"properties",
+ "proto",
"protobuf",
+ "ps",
+ "ps1",
"puppet",
- "purebasic",
+ "py",
+ "pycon",
"python",
"python-repl",
- "q",
"qml",
"r",
+ "rb",
+ "re",
"reasonml",
"rib",
- "roboconf",
- "routeros",
+ "rs",
"rsl",
+ "rss",
+ "ruby",
"ruleslanguage",
"rust",
"sas",
+ "scad",
"scala",
"scheme",
+ "sci",
"scilab",
"scss",
+ "sh",
"shell",
"smali",
"smalltalk",
"sml",
- "sqf",
"sql",
+ "st",
"stan",
+ "stanfuncs",
"stata",
- "step21",
+ "step",
+ "stp",
+ "styl",
"stylus",
"subunit",
+ "svg",
"swift",
- "taggerscript",
- "yaml",
+ "tao",
"tap",
"tcl",
+ "tex",
+ "text",
+ "thor",
"thrift",
+ "tk",
+ "toml",
"tp",
+ "ts",
+ "tsx",
"twig",
+ "txt",
"typescript",
+ "v",
"vala",
+ "vb",
"vbnet",
+ "vbs",
"vbscript",
- "vbscript-html",
"verilog",
"vhdl",
"vim",
- "wasm",
- "wren",
+ "wl",
+ "x++",
"x86asm",
+ "xhtml",
+ "xjb",
"xl",
+ "xls",
+ "xlsx",
+ "xml",
+ "xpath",
+ "xq",
+ "xqm",
"xquery",
+ "xsd",
+ "xsl",
+ "yaml",
+ "yml",
+ "zep",
"zephir",
+ "zone",
+ "zsh",
];
function syncLanguageOptions() {
diff --git a/src/server.py b/src/server.py
index 93b30b8..9581b95 100644
--- a/src/server.py
+++ b/src/server.py
@@ -69,19 +69,25 @@ HSTS_MAX_AGE = 31536000
ALLOWED_LANGUAGES = {
"1c",
+ "SAS",
"abnf",
"accesslog",
"actionscript",
"ada",
+ "adoc",
"angelscript",
"apache",
+ "apacheconf",
"applescript",
"arcade",
"arduino",
+ "arm",
"armasm",
- "xml",
+ "as",
+ "asc",
"asciidoc",
"aspectj",
+ "atom",
"autohotkey",
"autoit",
"avrasm",
@@ -89,179 +95,295 @@ ALLOWED_LANGUAGES = {
"axapta",
"bash",
"basic",
+ "bat",
+ "bf",
+ "bind",
"bnf",
"brainfuck",
"c",
+ "c++",
"cal",
+ "capnp",
"capnproto",
- "ceylon",
- "clean",
+ "cc",
+ "clj",
"clojure",
- "clojure-repl",
+ "cls",
"cmake",
+ "cmake.in",
+ "cmd",
+ "coffee",
"coffeescript",
+ "console",
"coq",
"cos",
"cpp",
+ "cr",
+ "craftcms",
+ "crm",
"crmsh",
"crystal",
+ "cs",
"csharp",
+ "cson",
"csp",
"css",
+ "cts",
+ "cxx",
"d",
- "markdown",
"dart",
- "delphi",
+ "dfm",
"diff",
"django",
"dns",
+ "docker",
"dockerfile",
"dos",
+ "dpr",
"dsconfig",
+ "dst",
"dts",
"dust",
"ebnf",
"elixir",
"elm",
- "ruby",
- "erb",
- "erlang-repl",
+ "erl",
"erlang",
"excel",
+ "f90",
+ "f95",
"fix",
- "flix",
- "fsharp",
"fortran",
- "gcode",
+ "fs",
+ "fsharp",
+ "fsi",
+ "fsscript",
+ "fsx",
"gams",
"gauss",
+ "gawk",
+ "gcode",
+ "gemspec",
"gherkin",
"glsl",
- "gml",
+ "gms",
"go",
+ "golang",
"golo",
+ "gololang",
"gradle",
+ "graph",
"graphql",
"groovy",
+ "gss",
+ "gyp",
+ "h",
+ "h++",
"haml",
"handlebars",
"haskell",
"haxe",
- "hsp",
- "http",
+ "hbs",
+ "hh",
+ "hpp",
+ "hs",
"html",
+ "html.handlebars",
+ "html.hbs",
+ "http",
+ "https",
+ "hx",
+ "hxx",
"hy",
+ "hylang",
+ "i7",
+ "iced",
"inform7",
"ini",
+ "ino",
+ "instances",
+ "irb",
"irpf90",
- "isbl",
"java",
"javascript",
- "jboss-cli",
+ "jinja",
+ "jl",
+ "js",
"json",
+ "jsp",
+ "jsx",
"julia",
"julia-repl",
+ "k",
+ "kdb",
"kotlin",
+ "kt",
"lasso",
- "latex",
+ "lassoscript",
"ldif",
"leaf",
"less",
"lisp",
"livecodeserver",
"livescript",
- "llvm",
- "lsl",
"lua",
+ "mak",
+ "make",
"makefile",
+ "markdown",
"mathematica",
"matlab",
+ "mawk",
"maxima",
+ "md",
"mel",
"mercury",
+ "mips",
"mipsasm",
"mizar",
- "perl",
+ "mk",
+ "mkd",
+ "mkdown",
+ "mm",
+ "mma",
"mojolicious",
"monkey",
+ "moon",
"moonscript",
+ "mts",
"n1ql",
- "nestedtext",
+ "nawk",
+ "nc",
"nginx",
+ "nginxconf",
"nim",
+ "nimrod",
"nix",
- "node-repl",
"nsis",
+ "obj-c",
+ "obj-c++",
+ "objc",
+ "objective-c++",
"objectivec",
"ocaml",
"openscad",
+ "osascript",
"oxygene",
+ "p21",
"parser3",
+ "pas",
+ "pascal",
+ "patch",
+ "pcmk",
+ "perl",
"pf",
+ "pf.conf",
"pgsql",
"php",
- "php-template",
+ "pl",
"plaintext",
+ "plist",
+ "pm",
+ "podspec",
"pony",
+ "postgres",
+ "postgresql",
"powershell",
+ "pp",
"processing",
+ "profile",
"prolog",
"properties",
+ "proto",
"protobuf",
+ "ps",
+ "ps1",
"puppet",
- "purebasic",
+ "py",
+ "pycon",
"python",
- "profile",
"python-repl",
- "q",
"qml",
"r",
+ "rb",
+ "re",
"reasonml",
"rib",
- "roboconf",
- "routeros",
+ "rs",
"rsl",
+ "rss",
+ "ruby",
"ruleslanguage",
"rust",
"sas",
+ "scad",
"scala",
"scheme",
+ "sci",
"scilab",
"scss",
+ "sh",
"shell",
"smali",
"smalltalk",
"sml",
- "sqf",
"sql",
+ "st",
"stan",
+ "stanfuncs",
"stata",
- "step21",
+ "step",
+ "stp",
+ "styl",
"stylus",
"subunit",
+ "svg",
"swift",
- "taggerscript",
- "yaml",
+ "tao",
"tap",
"tcl",
+ "tex",
+ "text",
+ "thor",
"thrift",
+ "tk",
+ "toml",
"tp",
+ "ts",
+ "tsx",
"twig",
+ "txt",
"typescript",
+ "v",
"vala",
+ "vb",
"vbnet",
+ "vbs",
"vbscript",
- "vbscript-html",
"verilog",
"vhdl",
"vim",
- "wasm",
- "wren",
+ "wl",
+ "x++",
"x86asm",
+ "xhtml",
+ "xjb",
"xl",
+ "xls",
+ "xlsx",
+ "xml",
+ "xpath",
+ "xq",
+ "xqm",
"xquery",
+ "xsd",
+ "xsl",
+ "yaml",
+ "yml",
+ "zep",
"zephir",
-
+ "zone",
+ "zsh",
}
@@ -517,7 +639,9 @@ def get_paste(paste_id):
conn = open_db()
try:
conn.row_factory = sqlite3.Row
- row = conn.execute("SELECT * FROM pastes WHERE id = ?", (paste_id,)).fetchone()
+ row = conn.execute(
+ "SELECT * FROM pastes WHERE id = ?", (paste_id,)
+ ).fetchone()
if row:
return sanitize_paste_record(dict(row))
return None
@@ -672,7 +796,9 @@ def paste_page(paste, csp_nonce):
else:
escaped = html_escape(content)
if is_code:
- lang_class = f'class="language-{html_escape_attr(language)}"' if language else ""
+ lang_class = (
+ f'class="language-{html_escape_attr(language)}"' if language else ""
+ )
content_block = (
f'<pre><code id="paste-code" {lang_class}>{escaped}</code></pre>'
)
@@ -1097,7 +1223,9 @@ class ClipboardHandler(http.server.BaseHTTPRequestHandler):
return
data = js_path.read_bytes()
self.send_response(200)
- self.send_header("Content-Type", "application/javascript; charset=utf-8")
+ self.send_header(
+ "Content-Type", "application/javascript; charset=utf-8"
+ )
self.send_header("Content-Length", str(len(data)))
self.add_security_headers()
self.end_headers()