aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backup/.github/dependabot.yml7
-rw-r--r--backup/.gitignore2
-rw-r--r--backup/index.js34
-rw-r--r--backup/package-lock.json49
-rw-r--r--backup/package.json24
-rw-r--r--contrib/scripts/backup.js35
6 files changed, 35 insertions, 116 deletions
diff --git a/backup/.github/dependabot.yml b/backup/.github/dependabot.yml
deleted file mode 100644
index 4872c5af..00000000
--- a/backup/.github/dependabot.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-version: 2
-updates:
-- package-ecosystem: npm
- directory: "/"
- schedule:
- interval: daily
- open-pull-requests-limit: 10
diff --git a/backup/.gitignore b/backup/.gitignore
deleted file mode 100644
index f47a86b1..00000000
--- a/backup/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules/**
-dist/** \ No newline at end of file
diff --git a/backup/index.js b/backup/index.js
deleted file mode 100644
index fccc4439..00000000
--- a/backup/index.js
+++ /dev/null
@@ -1,34 +0,0 @@
-var argv = require('minimist')(process.argv.slice(2));
-
-if (typeof argv.u !== "string") {
- console.log("username must be specified (-u ugnich)");
- process.exit(1);
-}
-
-var messages = [];
-
-function getBlogData(blogUrl, callback) {
- fetch(blogUrl)
- .then(function(res) {
- return res.json()
- })
- .then(function(msgs) {
- msgs.forEach(function(message) {
- messages.push(message);
- });
- if (msgs.length == 20) {
- blog.searchParams.set("before_mid", msgs.slice(-1).pop().mid);
- setTimeout(getBlogData, 1000, blog, callback);
- } else {
- callback();
- }
- });
-};
-
-var blog = new URL("https://api.juick.com/messages");
-blog.searchParams.append("uname", argv.u);
-
-getBlogData(blog, function() {
- console.log(JSON.stringify(messages));
-});
-
diff --git a/backup/package-lock.json b/backup/package-lock.json
deleted file mode 100644
index b298f6e9..00000000
--- a/backup/package-lock.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "name": "juick-backup",
- "version": "1.0.0",
- "lockfileVersion": 2,
- "requires": true,
- "packages": {
- "": {
- "name": "juick-backup",
- "version": "1.0.0",
- "license": "MIT",
- "dependencies": {
- "minimist": "^1.2.8"
- },
- "devDependencies": {
- "@types/node": "^20.3.0"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@types/node": {
- "version": "20.3.0",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.0.tgz",
- "integrity": "sha512-cumHmIAf6On83X7yP+LrsEyUOf/YlociZelmpRYaGFydoaPdxdt80MAbu6vWerQT2COCp2nPvHdsbD7tHn/YlQ==",
- "dev": true
- },
- "node_modules/minimist": {
- "version": "1.2.8",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
- "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- }
- },
- "dependencies": {
- "@types/node": {
- "version": "20.3.0",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.0.tgz",
- "integrity": "sha512-cumHmIAf6On83X7yP+LrsEyUOf/YlociZelmpRYaGFydoaPdxdt80MAbu6vWerQT2COCp2nPvHdsbD7tHn/YlQ==",
- "dev": true
- },
- "minimist": {
- "version": "1.2.8",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
- "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
- }
- }
-}
diff --git a/backup/package.json b/backup/package.json
deleted file mode 100644
index 61893856..00000000
--- a/backup/package.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name": "juick-backup",
- "version": "1.0.0",
- "description": "Juick export utility",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/juick/backup.git"
- },
- "private": true,
- "license": "MIT",
- "dependencies": {
- "minimist": "^1.2.8"
- },
- "devDependencies": {
- "@types/node": "^20.3.0"
- },
- "engines": {
- "node": ">= 18"
- }
-}
diff --git a/contrib/scripts/backup.js b/contrib/scripts/backup.js
new file mode 100644
index 00000000..8c87b2dd
--- /dev/null
+++ b/contrib/scripts/backup.js
@@ -0,0 +1,35 @@
+var argv = require('minimist')(process.argv.slice(2))
+
+if (typeof argv.u !== 'string') {
+ console.log('username must be specified (-u ugnich)')
+ process.exit(1)
+}
+
+var messages = []
+
+function getBlogData(blogUrl, callback) {
+ fetch(blogUrl)
+ .then(function(res) {
+ return res.json()
+ })
+ .then(function(msgs) {
+ msgs.forEach(function(message) {
+ messages.push(message)
+ })
+ if (msgs.length == 20) {
+ blog.searchParams.set('before_mid', msgs.slice(-1).pop().mid)
+ setTimeout(getBlogData, 1000, blog, callback)
+ } else {
+ callback()
+ }
+ })
+ .catch(console.error)
+}
+
+var blog = new URL('https://api.juick.com/messages')
+blog.searchParams.append('uname', argv.u)
+
+getBlogData(blog, function() {
+ console.log(JSON.stringify(messages))
+})
+