From bd03d238dc40badbd3e120cc85e935da0c064934 Mon Sep 17 00:00:00 2001 From: "Ringo@Mac" Date: Mon, 27 May 2024 09:22:12 +0700 Subject: [PATCH 1/3] add note part --- .gitmodules | 3 +++ d | 1 + 2 files changed, 4 insertions(+) create mode 160000 d diff --git a/.gitmodules b/.gitmodules index f6945b3..9dc0702 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "themes/diary"] path = themes/diary url = https://github.com/AmazingRise/hugo-theme-diary.git +[submodule "d"] + path = d + url = https://github.com/topaz/paste diff --git a/d b/d new file mode 160000 index 0000000..13a4b02 --- /dev/null +++ b/d @@ -0,0 +1 @@ +Subproject commit 13a4b0264a10f5f06c38e8cad0ce517f26a1b4a9 From e8d05ecdd26e785b1f6da50218101ff70ba75c65 Mon Sep 17 00:00:00 2001 From: "Ringo@Mac" Date: Mon, 27 May 2024 09:27:20 +0700 Subject: [PATCH 2/3] add note part --- bin/README.md | 9 + bin/index.html | 169 +++ bin/lzma.js | 153 +++ bin/lzma_worker.js | 2668 ++++++++++++++++++++++++++++++++++++++++++++ d | 1 - 5 files changed, 2999 insertions(+), 1 deletion(-) create mode 100644 bin/README.md create mode 100644 bin/index.html create mode 100644 bin/lzma.js create mode 100644 bin/lzma_worker.js delete mode 160000 d diff --git a/bin/README.md b/bin/README.md new file mode 100644 index 0000000..b3c3ea6 --- /dev/null +++ b/bin/README.md @@ -0,0 +1,9 @@ +Try it here: https://topaz.github.io/paste/ + +This is a no-datastore, client-side paste service. It turns text into [LZMA](https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm)-compressed, [Base64](https://en.wikipedia.org/wiki/Base64)-encoded URLs. + +For example, here's [the service hosting (a version of) its own HTML](https://topaz.github.io/paste/#XQAAAQDhEAAAAAAAAAAeCEUG0O+oKBdZ2an16qclPsVsA9xArjEo+v7wdamB7jXOonLX2nOpKsJo/yjgbJd45JP8DILIc1UzUXoyL6Jv1CyuF3Hp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XqOv53cADxzIlzhZothKuq3rNkXdZmv9ElBAHWiejrQKYO+EClURFvU1rvZG14WYMuVvprFaLXbE+N4LqtATSOsDEPZS6wKF6ZSGMrmCiw+OrLqLQM/2wNn3sI/Mbod3aFYsiX3Z/KawZlryY29kTBm9uNlZOZtufjRsxyg5rKmdH/DT1j2F+9j8foV7Za7gtvxoiZ8SEoDDtGALI0VfneIIr+Pi+g8PcNgdaMa12ndxcOctNQZf5zsICsFAe7Cu3g2b8lC3pvSuhUaCufU1WoOjkc/K0w4pqSHYhPTqTJEjr5ho3TB0+7ncDMzgT+GywE/duOPnJFXtL/g9AaSzqIYjS4AjRFDvh27DBMfdHuetuGTT14JTflxjvKjsJ0h75RfKOyyUbS19kWk4vXjSIrzzFAhPPo9plB1w1F3Ep246A6F0PSeUiwSuciUDKHORgxwmcb5j7yW/deHxejEpnPih1uaInTCgSO5k1W33h40/8mdv34KONFpCU9RtevjYzO0uiZzvZRCBvm259VfZp8W38JkVyCZdT8RafbS5QBjlkV2sPMJ98+Bp+oPLqzV3/VrS+de/078QaSiqDoofdjImRCADzlsDCzB1k+8q9vEYFGMe5Pm7t3FGGXaf3kLxXYOYugfxeib7n/EGrUfVgbxlYOwuDUBmQ3tX4bbiwIgQoLdFlhkGrpaNUoFu/MZayk9xmfuIv7SLa2S5aQvxdn6TgK71LdF/E3iIP3+9w9QBdkhHoEKQx+TD15644Fk8cy71Pehxw6X2zI/c7WZnYZCQmHSc6MUkp08gZkpok4443+a3E4jSg3HfqUsPbf2znrF90vmcKQaPZmPNe/1pNpiOfJA0JH303rVw1LpDr47HIdumjGW0TmPRcgzBaPDh2hB5YMFVE3DXmzR3aVo4R1JfjJ3WMxJC7KDpbud6xIkMpg1sAk/REQRT3C4o1o+vkQR2NBnRJEOFwrAHBXoPz/uXDd9g==). + +Because the entire paste is inside the URL, there's no risk of losing your data because a 3rd-party service vanished or deleted old pastes. If you have the URL, you have the pasted data. + +Uses [LZMA-JS](https://github.com/LZMA-JS/LZMA-JS) (© 2016 Nathan Rugg ). diff --git a/bin/index.html b/bin/index.html new file mode 100644 index 0000000..68a4fce --- /dev/null +++ b/bin/index.html @@ -0,0 +1,169 @@ + + + + +paste + + + + + +
+ + + diff --git a/bin/lzma.js b/bin/lzma.js new file mode 100644 index 0000000..9a61bef --- /dev/null +++ b/bin/lzma.js @@ -0,0 +1,153 @@ +//! © 2015 Nathan Rugg | MIT +/// See LICENSE for more details. + +// jshint bitwise:true, curly:true, eqeqeq:true, forin:true, immed:true, latedef:true, newcap:true, noarg:true, noempty:true, nonew:true, onevar:true, plusplus:true, quotmark:double, undef:true, unused:strict, browser: true, node: true + +/// Does the environment support web workers? If not, let's load the worker manually (without polluting the global scope). +if (typeof Worker === "undefined" || (typeof location !== "undefined" && location.protocol === "file:")) { + /// Is this Node.js? + if (typeof global !== "undefined" && typeof require !== "undefined") { + this.LZMA = function (lzma_path) { + return require(lzma_path || "./lzma_worker.js").LZMA; + }; + /// Is this a browser? + } else if (typeof window !== "undefined" && window.document) { + (function () { + var that = this, + global_var, + req = function req(path) { + var script_tag = document.createElement("script"); + script_tag.type ="text/javascript"; + script_tag.src = path; + script_tag.onload = function () { + /// Make sure this LZMA variable doesn't get overwritten by the worker's. + that.LZMA = non_worker_lzma; + }; + document.getElementsByTagName("head")[0].appendChild(script_tag); + }; + + /// Determine the global variable (it's called "window" in browsers, "global" in Node.js). + if (typeof window !== "undefined") { + global_var = window; + } else if (global) { + global_var = global; + } + + function non_worker_lzma(path) { + var fake_lzma; + + req(path); + + fake_lzma = { + compress: function compress(mixed, mode, on_finish, on_progress) { + if (global_var.LZMA_WORKER) { + global_var.LZMA_WORKER.compress(mixed, mode, on_finish, on_progress); + } else { + /// Wait + setTimeout(function () + { + fake_lzma.compress(mixed, mode, on_finish, on_progress); + }, 50); + } + }, + decompress: function decompress(byte_arr, on_finish, on_progress) { + if (global_var.LZMA_WORKER) { + global_var.LZMA_WORKER.decompress(byte_arr, on_finish, on_progress); + } else { + /// Wait + setTimeout(function () + { + fake_lzma.decompress(byte_arr, on_finish, on_progress); + }, 50); + } + }, + worker: function worker () { + return null; + } + }; + + return fake_lzma; + } + + that.LZMA = non_worker_lzma; + }()); + } else { + /// It doesn't seem to be either Node.js or a browser. + console.error("Can't load the worker. Sorry."); + } +} else { + /// Let's use Web Workers. + ///NOTE: The "this" keyword is the global context ("window" variable) if loaded via a - - - -
- - - diff --git a/bin/lzma.js b/bin/lzma.js deleted file mode 100644 index 9a61bef..0000000 --- a/bin/lzma.js +++ /dev/null @@ -1,153 +0,0 @@ -//! © 2015 Nathan Rugg | MIT -/// See LICENSE for more details. - -// jshint bitwise:true, curly:true, eqeqeq:true, forin:true, immed:true, latedef:true, newcap:true, noarg:true, noempty:true, nonew:true, onevar:true, plusplus:true, quotmark:double, undef:true, unused:strict, browser: true, node: true - -/// Does the environment support web workers? If not, let's load the worker manually (without polluting the global scope). -if (typeof Worker === "undefined" || (typeof location !== "undefined" && location.protocol === "file:")) { - /// Is this Node.js? - if (typeof global !== "undefined" && typeof require !== "undefined") { - this.LZMA = function (lzma_path) { - return require(lzma_path || "./lzma_worker.js").LZMA; - }; - /// Is this a browser? - } else if (typeof window !== "undefined" && window.document) { - (function () { - var that = this, - global_var, - req = function req(path) { - var script_tag = document.createElement("script"); - script_tag.type ="text/javascript"; - script_tag.src = path; - script_tag.onload = function () { - /// Make sure this LZMA variable doesn't get overwritten by the worker's. - that.LZMA = non_worker_lzma; - }; - document.getElementsByTagName("head")[0].appendChild(script_tag); - }; - - /// Determine the global variable (it's called "window" in browsers, "global" in Node.js). - if (typeof window !== "undefined") { - global_var = window; - } else if (global) { - global_var = global; - } - - function non_worker_lzma(path) { - var fake_lzma; - - req(path); - - fake_lzma = { - compress: function compress(mixed, mode, on_finish, on_progress) { - if (global_var.LZMA_WORKER) { - global_var.LZMA_WORKER.compress(mixed, mode, on_finish, on_progress); - } else { - /// Wait - setTimeout(function () - { - fake_lzma.compress(mixed, mode, on_finish, on_progress); - }, 50); - } - }, - decompress: function decompress(byte_arr, on_finish, on_progress) { - if (global_var.LZMA_WORKER) { - global_var.LZMA_WORKER.decompress(byte_arr, on_finish, on_progress); - } else { - /// Wait - setTimeout(function () - { - fake_lzma.decompress(byte_arr, on_finish, on_progress); - }, 50); - } - }, - worker: function worker () { - return null; - } - }; - - return fake_lzma; - } - - that.LZMA = non_worker_lzma; - }()); - } else { - /// It doesn't seem to be either Node.js or a browser. - console.error("Can't load the worker. Sorry."); - } -} else { - /// Let's use Web Workers. - ///NOTE: The "this" keyword is the global context ("window" variable) if loaded via a