+36
-31
@@ -1,7 +1,7 @@
|
||||
import * as fs from "fs"
|
||||
import toml from "toml"
|
||||
import { schemeMeta } from "./colorSchemes"
|
||||
import { Meta } from "./themes/common/colorScheme"
|
||||
import { Meta, Verification } from "./themes/common/colorScheme"
|
||||
import https from "https"
|
||||
import crypto from "crypto"
|
||||
|
||||
@@ -36,40 +36,45 @@ function getLicenseText(
|
||||
callback: (meta: Meta, license_text: string) => void
|
||||
) {
|
||||
for (let meta of schemeMeta) {
|
||||
// The following copied from the example code on nodejs.org:
|
||||
// https://nodejs.org/api/http.html#httpgetoptions-callback
|
||||
https
|
||||
.get(meta.license.https_url, (res) => {
|
||||
const { statusCode } = res
|
||||
if (typeof meta.license.license_text == "string") {
|
||||
callback(meta, meta.license.license_text)
|
||||
} else {
|
||||
let license_text_obj: Verification = meta.license.license_text;
|
||||
// The following copied from the example code on nodejs.org:
|
||||
// https://nodejs.org/api/http.html#httpgetoptions-callback
|
||||
https
|
||||
.get(license_text_obj.https_url, (res) => {
|
||||
const { statusCode } = res
|
||||
|
||||
if (statusCode < 200 || statusCode >= 300) {
|
||||
throw new Error(
|
||||
`Failed to fetch license for: ${meta.name}, Status Code: ${statusCode}`
|
||||
)
|
||||
}
|
||||
|
||||
res.setEncoding("utf8")
|
||||
let rawData = ""
|
||||
res.on("data", (chunk) => {
|
||||
rawData += chunk
|
||||
})
|
||||
res.on("end", () => {
|
||||
const hash = crypto
|
||||
.createHash("sha256")
|
||||
.update(rawData)
|
||||
.digest("hex")
|
||||
if (meta.license.license_checksum == hash) {
|
||||
callback(meta, rawData)
|
||||
} else {
|
||||
throw Error(
|
||||
`Checksum for ${meta.name} did not match file downloaded from ${meta.license.https_url}`
|
||||
if (statusCode < 200 || statusCode >= 300) {
|
||||
throw new Error(
|
||||
`Failed to fetch license for: ${meta.name}, Status Code: ${statusCode}`
|
||||
)
|
||||
}
|
||||
|
||||
res.setEncoding("utf8")
|
||||
let rawData = ""
|
||||
res.on("data", (chunk) => {
|
||||
rawData += chunk
|
||||
})
|
||||
res.on("end", () => {
|
||||
const hash = crypto
|
||||
.createHash("sha256")
|
||||
.update(rawData)
|
||||
.digest("hex")
|
||||
if (license_text_obj.license_checksum == hash) {
|
||||
callback(meta, rawData)
|
||||
} else {
|
||||
throw Error(
|
||||
`Checksum for ${meta.name} did not match file downloaded from ${license_text_obj.https_url}`
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
.on("error", (e) => {
|
||||
throw e
|
||||
})
|
||||
.on("error", (e) => {
|
||||
throw e
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,12 @@ export const meta: Meta = {
|
||||
author: "EliverLara",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/EliverLara/Andromeda/master/LICENSE.md",
|
||||
license_checksum:
|
||||
"2f7886f1a05cefc2c26f5e49de1a39fa4466413c1ccb06fc80960e73f5ed4b89",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/EliverLara/Andromeda/master/LICENSE.md",
|
||||
license_checksum:
|
||||
"2f7886f1a05cefc2c26f5e49de1a39fa4466413c1ccb06fc80960e73f5ed4b89",
|
||||
}
|
||||
},
|
||||
url: "https://github.com/EliverLara/Andromeda",
|
||||
}
|
||||
|
||||
@@ -55,9 +55,11 @@ export const meta: Meta = {
|
||||
author: "atelierbram",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url: "https://atelierbram.mit-license.org/license.txt",
|
||||
license_checksum:
|
||||
"f95ce526ef4e7eecf7a832bba0e3451cc1000f9ce63eb01ed6f64f8109f5d0a5",
|
||||
license_text: {
|
||||
https_url: "https://atelierbram.mit-license.org/license.txt",
|
||||
license_checksum:
|
||||
"f95ce526ef4e7eecf7a832bba0e3451cc1000f9ce63eb01ed6f64f8109f5d0a5",
|
||||
}
|
||||
},
|
||||
url: "https://atelierbram.github.io/syntax-highlighting/atelier-schemes/cave/",
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ export const meta: Meta = {
|
||||
author: "atelierbram",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url: "https://atelierbram.mit-license.org/license.txt",
|
||||
license_checksum:
|
||||
"f95ce526ef4e7eecf7a832bba0e3451cc1000f9ce63eb01ed6f64f8109f5d0a5",
|
||||
license_text: {
|
||||
https_url: "https://atelierbram.mit-license.org/license.txt",
|
||||
license_checksum:
|
||||
"f95ce526ef4e7eecf7a832bba0e3451cc1000f9ce63eb01ed6f64f8109f5d0a5",
|
||||
}
|
||||
},
|
||||
url: "https://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool/",
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ export interface Meta {
|
||||
export interface License {
|
||||
SPDX: SPDXExpression
|
||||
/// A url where we can download the license's text
|
||||
license_text: Verification | string
|
||||
}
|
||||
|
||||
export interface Verification {
|
||||
https_url: string
|
||||
license_checksum: string
|
||||
}
|
||||
|
||||
@@ -248,8 +248,7 @@ export const meta: Meta = {
|
||||
name,
|
||||
license: {
|
||||
SPDX: "MIT", // "MIT/X11"
|
||||
https_url: "",
|
||||
license_checksum: "",
|
||||
license_text: "Copyright <YEAR> <COPYRIGHT HOLDER>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/ or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
|
||||
},
|
||||
author: "morhetz <morhetz@gmail.com>",
|
||||
url: "https://github.com/morhetz/gruvbox",
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import { darkHard as dark, meta } from "./gruvbox-common";
|
||||
import { darkHard as dark, meta as commonMeta } from "./gruvbox-common";
|
||||
|
||||
let meta = { ...commonMeta };
|
||||
meta.name = `${commonMeta.name} Dark Hard`
|
||||
|
||||
export { dark, meta }
|
||||
@@ -1,3 +1,7 @@
|
||||
import { darkSoft as dark, meta } from "./gruvbox-common";
|
||||
import { darkSoft as dark, meta as commonMeta } from "./gruvbox-common";
|
||||
|
||||
|
||||
let meta = { ...commonMeta };
|
||||
meta.name = `${commonMeta.name} Dark Soft`
|
||||
|
||||
export { dark, meta }
|
||||
@@ -1,3 +1,7 @@
|
||||
import { darkDefault as dark, meta } from "./gruvbox-common";
|
||||
import { darkDefault as dark, meta as commonMeta } from "./gruvbox-common";
|
||||
|
||||
|
||||
let meta = { ...commonMeta };
|
||||
meta.name = `${commonMeta.name} Dark`
|
||||
|
||||
export { dark, meta }
|
||||
@@ -1,3 +0,0 @@
|
||||
import { lightHard as light, meta } from "./gruvbox-common";
|
||||
|
||||
export { light, meta }
|
||||
@@ -0,0 +1,6 @@
|
||||
import { lightHard as light, meta as commonMeta } from "./gruvbox-common";
|
||||
|
||||
let meta = { ...commonMeta };
|
||||
meta.name = `${commonMeta.name} Dark Soft`
|
||||
|
||||
export { light, meta }
|
||||
@@ -1,3 +1,6 @@
|
||||
import { lightSoft as light, meta } from "./gruvbox-common";
|
||||
import { lightSoft as light, meta as commonMeta } from "./gruvbox-common";
|
||||
|
||||
let meta = { ...commonMeta };
|
||||
meta.name = `${commonMeta.name} Light Soft`
|
||||
|
||||
export { light, meta }
|
||||
@@ -1,3 +1,6 @@
|
||||
import { lightDefault as light, meta } from "./gruvbox-common";
|
||||
import { lightDefault as light, meta as commonMeta } from "./gruvbox-common";
|
||||
|
||||
let meta = { ...commonMeta };
|
||||
meta.name = `${commonMeta.name} Light`
|
||||
|
||||
export { light, meta }
|
||||
@@ -72,10 +72,12 @@ export const meta: Meta = {
|
||||
author: "simurai",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/atom/atom/master/packages/one-light-ui/LICENSE.md",
|
||||
license_checksum:
|
||||
"d5af8fc171f6f600c0ab4e7597dca398dda80dbe6821ce01cef78e859e7a00f8",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/atom/atom/master/packages/one-light-ui/LICENSE.md",
|
||||
license_checksum:
|
||||
"d5af8fc171f6f600c0ab4e7597dca398dda80dbe6821ce01cef78e859e7a00f8",
|
||||
}
|
||||
},
|
||||
url: "https://github.com/atom/atom/tree/master/packages/one-dark-ui",
|
||||
}
|
||||
|
||||
@@ -73,10 +73,12 @@ export const meta: Meta = {
|
||||
author: "simurai",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/atom/atom/master/packages/one-light-ui/LICENSE.md",
|
||||
license_checksum:
|
||||
"d5af8fc171f6f600c0ab4e7597dca398dda80dbe6821ce01cef78e859e7a00f8",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/atom/atom/master/packages/one-light-ui/LICENSE.md",
|
||||
license_checksum:
|
||||
"d5af8fc171f6f600c0ab4e7597dca398dda80dbe6821ce01cef78e859e7a00f8",
|
||||
}
|
||||
},
|
||||
url: "https://github.com/atom/atom/tree/master/packages/one-light-ui",
|
||||
}
|
||||
|
||||
@@ -34,10 +34,12 @@ export const meta: Meta = {
|
||||
author: "edunfelt",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
|
||||
license_checksum:
|
||||
"6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
|
||||
license_checksum:
|
||||
"6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
|
||||
}
|
||||
},
|
||||
url: "https://github.com/edunfelt/base16-rose-pine-scheme",
|
||||
}
|
||||
|
||||
@@ -34,10 +34,12 @@ export const meta: Meta = {
|
||||
author: "edunfelt",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
|
||||
license_checksum:
|
||||
"6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
|
||||
license_checksum:
|
||||
"6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
|
||||
}
|
||||
},
|
||||
url: "https://github.com/edunfelt/base16-rose-pine-scheme",
|
||||
}
|
||||
|
||||
@@ -32,10 +32,12 @@ export const meta: Meta = {
|
||||
author: "edunfelt",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
|
||||
license_checksum:
|
||||
"6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
|
||||
license_checksum:
|
||||
"6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
|
||||
}
|
||||
},
|
||||
url: "https://github.com/edunfelt/base16-rose-pine-scheme",
|
||||
}
|
||||
|
||||
@@ -32,10 +32,12 @@ export const meta: Meta = {
|
||||
author: "gessig",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/gessig/base16-sandcastle-scheme/master/LICENSE",
|
||||
license_checksum:
|
||||
"8399d44b4d935b60be9fee0a76d7cc9a817b4f3f11574c9d6d1e8fd57e72ffdc",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/gessig/base16-sandcastle-scheme/master/LICENSE",
|
||||
license_checksum:
|
||||
"8399d44b4d935b60be9fee0a76d7cc9a817b4f3f11574c9d6d1e8fd57e72ffdc",
|
||||
}
|
||||
},
|
||||
url: "https://github.com/gessig/base16-sandcastle-scheme",
|
||||
}
|
||||
|
||||
@@ -35,10 +35,12 @@ export const meta: Metadata = {
|
||||
author: "Ethan Schoonover",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/altercation/solarized/master/LICENSE",
|
||||
license_checksum:
|
||||
"494aefdabf86acce06bd63001ad8aedad4ee38da23509d3f917d95aa3368b9a6",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/altercation/solarized/master/LICENSE",
|
||||
license_checksum:
|
||||
"494aefdabf86acce06bd63001ad8aedad4ee38da23509d3f917d95aa3368b9a6",
|
||||
}
|
||||
},
|
||||
url: "https://github.com/altercation/solarized",
|
||||
}
|
||||
|
||||
@@ -34,9 +34,11 @@ export const meta: Meta = {
|
||||
url: "https://github.com/zoefiri/base16-sc",
|
||||
license: {
|
||||
SPDX: "MIT",
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/zoefiri/base16-sc/master/LICENSE",
|
||||
license_checksum:
|
||||
"fadcc834b7eaf2943800956600e8aeea4b495ecf6490f4c4b6c91556a90accaf",
|
||||
license_text: {
|
||||
https_url:
|
||||
"https://raw.githubusercontent.com/zoefiri/base16-sc/master/LICENSE",
|
||||
license_checksum:
|
||||
"fadcc834b7eaf2943800956600e8aeea4b495ecf6490f4c4b6c91556a90accaf",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user