Refactor packages

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-02-23 23:52:29 +00:00
parent 3360e7f8c3
commit 0ae8128304
108 changed files with 11012 additions and 3025 deletions

View File

@@ -0,0 +1,38 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake --version=branch=main darktable-ghost-cms-publish --subpackage npmSrc
pkgs.stdenv.mkDerivation rec {
pname = "darktable-ghost-cms-publish";
version = "0-unstable-2025-02-23";
src = pkgs.fetchFromGitLab {
domain = "git.karaolidis.com";
owner = "karaolidis";
repo = pname;
rev = "26780273b2a093c6e6a3140d0220d252f0bc709e";
hash = "sha256-5aoGkqxMyvyK8EDsSE6kZa+dpExxVH2GRx2n87VusKE=";
};
npmSrc = pkgs.buildNpmPackage ({
inherit src pname version;
npmDepsHash = "sha256-K/x9ZEMNO8D+SkvVPfqVJtZaDXY5gDApRRocg/POY68=";
dontNpmBuild = true;
installPhase = ''
cp -r . $out
'';
});
# FIXME: https://github.com/NixOS/nixpkgs/issues/255890
wrapper = pkgs.writeShellApplication {
name = pname;
runtimeInputs = with pkgs; [ bun ];
text = ''
bun ${npmSrc}/src/index.ts "$@"
'';
};
installPhase = ''
mkdir -p $out/bin $out/lib/${pname}
cp publish.lua $out/lib/${pname}/
cp ${wrapper}/bin/${pname} $out/bin/
'';
}

View File

@@ -0,0 +1,17 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake --version=branch=master darktable-hald-clut
pkgs.stdenv.mkDerivation rec {
pname = "darktable-hald-clut";
version = "0-unstable-2019-03-21";
src = pkgs.fetchFromGitHub {
owner = "cedeber";
repo = "hald-clut";
rev = "3b3180f82d4dcea1e6e8c5648473539a910d7f49";
hash = "sha256-R8vyYmcsfk49QsSV3v0QblXcO6U0oIfDyxbHPLwSMdo=";
};
installPhase = ''
cp -r HaldCLUT/. $out
'';
}

View File

@@ -0,0 +1,17 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake --version=branch=master darktable-lua-scripts
pkgs.stdenv.mkDerivation rec {
pname = "darktable-lua-scripts";
version = "release-2.0.0-unstable-2025-02-16";
src = pkgs.fetchFromGitHub {
owner = "darktable-org";
repo = "lua-scripts";
rev = "926272b1cd338a22fbe421d41a966bd8a8ba4575";
hash = "sha256-lU1UkCEqaf2l76un3phOX5o2ypkff8v+i54krq9N1hk=";
};
installPhase = ''
cp -r $src $out
'';
}

31
packages/default.nix Normal file
View File

@@ -0,0 +1,31 @@
{ pkgs, ... }:
{
darktable-ghost-cms-publish = import ./darktable/ghost-cms-publish { inherit pkgs; };
darktable-hald-clut = import ./darktable/hald-clut { inherit pkgs; };
darktable-lua-scripts = import ./darktable/lua-scripts { inherit pkgs; };
obsidian-plugin-better-word-count = import ./obsidian/plugins/better-word-count { inherit pkgs; };
obsidian-plugin-custom-sort = import ./obsidian/plugins/custom-sort { inherit pkgs; };
obsidian-plugin-dataview = import ./obsidian/plugins/dataview { inherit pkgs; };
obsidian-plugin-excalidraw = import ./obsidian/plugins/excalidraw { inherit pkgs; };
obsidian-plugin-folder-note = import ./obsidian/plugins/folder-note { inherit pkgs; };
obsidian-plugin-kanban = import ./obsidian/plugins/kanban { inherit pkgs; };
obsidian-plugin-languagetool = import ./obsidian/plugins/languagetool { inherit pkgs; };
obsidian-plugin-linter = import ./obsidian/plugins/linter { inherit pkgs; };
obsidian-plugin-map-view = import ./obsidian/plugins/map-view { inherit pkgs; };
obsidian-plugin-minimal-settings = import ./obsidian/plugins/minimal-settings { inherit pkgs; };
obsidian-plugin-outliner = import ./obsidian/plugins/outliner { inherit pkgs; };
obsidian-plugin-read-it-later = import ./obsidian/plugins/read-it-later { inherit pkgs; };
obsidian-plugin-style-settings = import ./obsidian/plugins/style-settings { inherit pkgs; };
obsidian-plugin-tasks = import ./obsidian/plugins/tasks { inherit pkgs; };
obsidian-plugin-url-into-selection = import ./obsidian/plugins/url-into-selection { inherit pkgs; };
obsidian-theme-minimal = import ./obsidian/themes/minimal { inherit pkgs; };
# SAS
viya4-ark = import ./sas/viya4-ark { inherit pkgs; };
viya4-orders-cli = import ./sas/viya4-orders-cli { inherit pkgs; };
# SAS Private
sage = import ./sas/sage { inherit pkgs; };
}

View File

@@ -0,0 +1,26 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-better-word-count
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-better-word-count";
version = "0.10.1";
src = pkgs.fetchFromGitHub {
owner = "lukeleppan";
repo = "better-word-count";
rev = version;
hash = "sha256-qyuZIcZHsUfyUMboE8GP26dIeo37fzhYuGccfQYffL4=";
};
patches = [ ./package-lock.patch ];
makeCacheWritable = true;
npmDepsHash = "sha256-2ZIgaMn6esSmB0lg4x42ueg+AFO+UmYbI1NCsxZQr+8=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./dist/main.js $out/main.js
cp ./src/styles.css $out/styles.css
'';
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-custom-sort
pkgs.stdenv.mkDerivation rec {
pname = "obsidian-plugin-custom-sort";
version = "3.1.2";
src = pkgs.fetchFromGitHub {
owner = "SebastianMC";
repo = "obsidian-custom-sort";
rev = version;
hash = "sha256-a6t0+mzzXQsgUwZ3m3UvF3N83ajGmxalsnD8beAVAr0=";
};
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-J/+LJWaco2QRwZx8Ry3G5DiJB6J21iOn5GBeY5EY4+g=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./dist/main.js $out/main.js
'';
}

View File

@@ -0,0 +1,26 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-dataview
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-dataview";
version = "0.5.67";
src = pkgs.fetchFromGitHub {
owner = "blacksmithgu";
repo = "obsidian-dataview";
rev = version;
hash = "sha256-AbK1J1a8bqkPCe9dqADAfR/q/j/kRGa8qouj9GJQErc=";
};
patches = [ ./package-lock.patch ];
makeCacheWritable = true;
npmDepsHash = "sha256-FsPLpWcS27VWrDm5G1ZT6zvfOfYmKNLHzmjiXEmpGKE=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./build/main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,90 @@
diff --git a/package-lock.json b/package-lock.json
index 0c1b0bd..df26135 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,15 +1,15 @@
{
"name": "obsidian-dataview",
- "version": "0.5.66",
+ "version": "0.5.67",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "obsidian-dataview",
- "version": "0.5.66",
+ "version": "0.5.67",
"license": "MIT",
"dependencies": {
- "@codemirror/language": "https://github.com/lishid/cm-language",
+ "@codemirror/language": "https://github.com/karaolidis/cm-language#package-lock",
"@codemirror/state": "^6.0.1",
"@codemirror/view": "^6.0.1",
"emoji-regex": "^10.0.0",
@@ -687,29 +687,28 @@
"dev": true
},
"node_modules/@codemirror/language": {
- "version": "6.6.0",
- "resolved": "git+ssh://git@github.com/lishid/cm-language.git#1aadcc247f20ccfda76424a9f853dbb4ee203fdc",
- "license": "MIT",
+ "version": "6.10.1",
+ "resolved": "git+ssh://git@github.com/karaolidis/cm-language.git#d6238f0a9e17e20d604cee67a47d3a93b00dd41c",
"dependencies": {
"@codemirror/state": "^6.0.0",
- "@codemirror/view": "^6.0.0",
- "@lezer/common": "^1.0.0",
+ "@codemirror/view": "^6.23.0",
+ "@lezer/common": "^1.1.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.0.0",
"style-mod": "^4.0.0"
}
},
"node_modules/@codemirror/state": {
- "version": "6.2.1",
- "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.2.1.tgz",
- "integrity": "sha512-RupHSZ8+OjNT38zU9fKH2sv+Dnlr8Eb8sl4NOnnqz95mCFTZUaiRP8Xv5MeeaG0px2b8Bnfe7YGwCV3nsBhbuw=="
+ "version": "6.4.1",
+ "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.4.1.tgz",
+ "integrity": "sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A=="
},
"node_modules/@codemirror/view": {
- "version": "6.19.0",
- "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.19.0.tgz",
- "integrity": "sha512-XqNIfW/3GaaF+T7Q1jBcRLCPm1NbrR2DBxrXacSt1FG+rNsdsNn3/azAfgpUoJ7yy4xgd8xTPa3AlL+y0lMizQ==",
+ "version": "6.28.4",
+ "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.28.4.tgz",
+ "integrity": "sha512-QScv95fiviSQ/CaVGflxAvvvDy/9wi0RFyDl4LkHHWiMr/UPebyuTspmYSeN5Nx6eujcPYwsQzA6ZIZucKZVHQ==",
"dependencies": {
- "@codemirror/state": "^6.1.4",
+ "@codemirror/state": "^6.4.0",
"style-mod": "^4.1.0",
"w3c-keyname": "^2.2.4"
}
@@ -1133,9 +1132,9 @@
}
},
"node_modules/@lezer/common": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.0.4.tgz",
- "integrity": "sha512-lZHlk8p67x4aIDtJl6UQrXSOP6oi7dQR3W/geFVrENdA1JDaAJWldnVqVjPMJupbTKbzDfFcePfKttqVidS/dg=="
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.1.tgz",
+ "integrity": "sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ=="
},
"node_modules/@lezer/highlight": {
"version": "1.1.6",
diff --git a/package.json b/package.json
index db15b53..d3605a0 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"rollup-plugin-web-worker-loader": "^1.6.1"
},
"dependencies": {
- "@codemirror/language": "https://github.com/lishid/cm-language",
+ "@codemirror/language": "https://github.com/karaolidis/cm-language#package-lock",
"@codemirror/state": "^6.0.1",
"@codemirror/view": "^6.0.1",
"emoji-regex": "^10.0.0",

View File

@@ -0,0 +1,49 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-excalidraw --subpackage mathjaxToSVG
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.excalidraw";
version = "2.8.3";
pkg = pkgs.fetchFromGitHub {
owner = "zsviczian";
repo = "obsidian-excalidraw-plugin";
rev = version;
hash = "sha256-vfswTT+FzzcddUQSoy6xseE+PzsWtRx8RkYzqGn6wFQ=";
};
mathjaxToSVG = pkgs.buildNpmPackage {
pname = "obsidian.plugins.excalidraw.mathjaxToSVG";
version = "1.0.0";
src = "${pkg}/MathjaxToSVG";
npmDepsHash = "sha256-AosKWlX08dpXNQ2YlrfR6jEInmU02Ztf26nmV19Jxok=";
configurePhase = ''
mkdir dist
'';
installPhase = ''
mkdir -p $out
cp ./dist/index.js $out/index.js
'';
};
src = pkg;
patches = [ ./package-lock.patch ];
npmDepsHash = "sha256-6Y22TD6BMljRGrL/qT54F7bFXcQbY1bQ5GuKEqAXIwY=";
npmPackFlags = [ "--ignore-scripts" ];
configurePhase = ''
mkdir dist
mkdir -p ./MathjaxToSVG/dist
cp ${mathjaxToSVG}/index.js ./MathjaxToSVG/dist/index.js
'';
installPhase = ''
mkdir -p $out
cp ./dist/manifest.json $out/manifest.json
cp ./dist/main.js $out/main.js
cp ./dist/styles.css $out/styles.css
'';
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-folder-note
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-folder-note";
version = "0.7.3";
src = pkgs.fetchFromGitHub {
owner = "xpgo";
repo = "obsidian-folder-note-plugin";
rev = version;
hash = "sha256-MGWIMM2zKB6ydP7wV8yVAOS3Qr02xTBIWIEf/2enynU=";
};
patches = [ ./package-lock.patch ];
npmDepsHash = "sha256-4v6QwwooxsXy+mbiKriylpKa8NOK8pWZixezY+H6wxo=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,549 @@
diff --git a/.gitignore b/.gitignore
index c0aac20..9b2ad6e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,6 @@
# npm
node_modules
-package-lock.json
# build
main.js
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..ed8a9ed
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,518 @@
+{
+ "name": "folder-note-plugin",
+ "version": "0.9.7",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "folder-note-plugin",
+ "version": "0.9.7",
+ "license": "MIT",
+ "devDependencies": {
+ "@rollup/plugin-commonjs": "^15.1.0",
+ "@rollup/plugin-node-resolve": "^9.0.0",
+ "@rollup/plugin-typescript": "^6.0.0",
+ "@types/node": "^14.14.30",
+ "@types/yaml": "^1.9.7",
+ "obsidian": "^1.6.6",
+ "rollup": "^2.39.0",
+ "tslib": "^2.0.3",
+ "typescript": "^4.1.5",
+ "yaml": "^1.10.0"
+ }
+ },
+ "node_modules/@codemirror/state": {
+ "version": "6.4.1",
+ "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.4.1.tgz",
+ "integrity": "sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A==",
+ "dev": true,
+ "peer": true
+ },
+ "node_modules/@codemirror/view": {
+ "version": "6.28.6",
+ "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.28.6.tgz",
+ "integrity": "sha512-bhwB1AZ6zU4M3dNKm8Aa2BXwj5mWDqE9IWpqxYKJoLCnx+AcwcMuLO01tLWgc1mx4vT1IVYVqx86YoqUsATrqQ==",
+ "dev": true,
+ "peer": true,
+ "dependencies": {
+ "@codemirror/state": "^6.4.0",
+ "style-mod": "^4.1.0",
+ "w3c-keyname": "^2.2.4"
+ }
+ },
+ "node_modules/@rollup/plugin-commonjs": {
+ "version": "15.1.0",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-15.1.0.tgz",
+ "integrity": "sha512-xCQqz4z/o0h2syQ7d9LskIMvBSH4PX5PjYdpSSvgS+pQik3WahkQVNWg3D8XJeYjZoVWnIUQYDghuEMRGrmQYQ==",
+ "dev": true,
+ "dependencies": {
+ "@rollup/pluginutils": "^3.1.0",
+ "commondir": "^1.0.1",
+ "estree-walker": "^2.0.1",
+ "glob": "^7.1.6",
+ "is-reference": "^1.2.1",
+ "magic-string": "^0.25.7",
+ "resolve": "^1.17.0"
+ },
+ "engines": {
+ "node": ">= 8.0.0"
+ },
+ "peerDependencies": {
+ "rollup": "^2.22.0"
+ }
+ },
+ "node_modules/@rollup/plugin-node-resolve": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-9.0.0.tgz",
+ "integrity": "sha512-gPz+utFHLRrd41WMP13Jq5mqqzHL3OXrfj3/MkSyB6UBIcuNt9j60GCbarzMzdf1VHFpOxfQh/ez7wyadLMqkg==",
+ "dev": true,
+ "dependencies": {
+ "@rollup/pluginutils": "^3.1.0",
+ "@types/resolve": "1.17.1",
+ "builtin-modules": "^3.1.0",
+ "deepmerge": "^4.2.2",
+ "is-module": "^1.0.0",
+ "resolve": "^1.17.0"
+ },
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "peerDependencies": {
+ "rollup": "^1.20.0||^2.0.0"
+ }
+ },
+ "node_modules/@rollup/plugin-typescript": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-6.1.0.tgz",
+ "integrity": "sha512-hJxaiE6WyNOsK+fZpbFh9CUijZYqPQuAOWO5khaGTUkM8DYNNyA2TDlgamecE+qLOG1G1+CwbWMAx3rbqpp6xQ==",
+ "dev": true,
+ "dependencies": {
+ "@rollup/pluginutils": "^3.1.0",
+ "resolve": "^1.17.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "peerDependencies": {
+ "rollup": "^2.14.0",
+ "tslib": "*",
+ "typescript": ">=3.4.0"
+ }
+ },
+ "node_modules/@rollup/pluginutils": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
+ "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==",
+ "dev": true,
+ "dependencies": {
+ "@types/estree": "0.0.39",
+ "estree-walker": "^1.0.1",
+ "picomatch": "^2.2.2"
+ },
+ "engines": {
+ "node": ">= 8.0.0"
+ },
+ "peerDependencies": {
+ "rollup": "^1.20.0||^2.0.0"
+ }
+ },
+ "node_modules/@rollup/pluginutils/node_modules/estree-walker": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
+ "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==",
+ "dev": true
+ },
+ "node_modules/@types/codemirror": {
+ "version": "5.60.8",
+ "resolved": "https://registry.npmjs.org/@types/codemirror/-/codemirror-5.60.8.tgz",
+ "integrity": "sha512-VjFgDF/eB+Aklcy15TtOTLQeMjTo07k7KAjql8OK5Dirr7a6sJY4T1uVBDuTVG9VEmn1uUsohOpYnVfgC6/jyw==",
+ "dev": true,
+ "dependencies": {
+ "@types/tern": "*"
+ }
+ },
+ "node_modules/@types/estree": {
+ "version": "0.0.39",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
+ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
+ "dev": true
+ },
+ "node_modules/@types/node": {
+ "version": "14.18.63",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz",
+ "integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==",
+ "dev": true
+ },
+ "node_modules/@types/resolve": {
+ "version": "1.17.1",
+ "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz",
+ "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==",
+ "dev": true,
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/@types/tern": {
+ "version": "0.23.9",
+ "resolved": "https://registry.npmjs.org/@types/tern/-/tern-0.23.9.tgz",
+ "integrity": "sha512-ypzHFE/wBzh+BlH6rrBgS5I/Z7RD21pGhZ2rltb/+ZrVM1awdZwjx7hE5XfuYgHWk9uvV5HLZN3SloevCAp3Bw==",
+ "dev": true,
+ "dependencies": {
+ "@types/estree": "*"
+ }
+ },
+ "node_modules/@types/yaml": {
+ "version": "1.9.7",
+ "resolved": "https://registry.npmjs.org/@types/yaml/-/yaml-1.9.7.tgz",
+ "integrity": "sha512-8WMXRDD1D+wCohjfslHDgICd2JtMATZU8CkhH8LVJqcJs6dyYj5TGptzP8wApbmEullGBSsCEzzap73DQ1HJaA==",
+ "deprecated": "This is a stub types definition. yaml provides its own type definitions, so you do not need this installed.",
+ "dev": true,
+ "dependencies": {
+ "yaml": "*"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/builtin-modules": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz",
+ "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/commondir": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
+ "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==",
+ "dev": true
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true
+ },
+ "node_modules/deepmerge": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
+ "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/estree-walker": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
+ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
+ "dev": true
+ },
+ "node_modules/fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
+ "dev": true
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/glob": {
+ "version": "7.2.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
+ "deprecated": "Glob versions prior to v9 are no longer supported",
+ "dev": true,
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.1.1",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
+ "dev": true,
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
+ "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
+ "dev": true,
+ "dependencies": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "node_modules/is-core-module": {
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz",
+ "integrity": "sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==",
+ "dev": true,
+ "dependencies": {
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-module": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz",
+ "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==",
+ "dev": true
+ },
+ "node_modules/is-reference": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz",
+ "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==",
+ "dev": true,
+ "dependencies": {
+ "@types/estree": "*"
+ }
+ },
+ "node_modules/magic-string": {
+ "version": "0.25.9",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
+ "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==",
+ "dev": true,
+ "dependencies": {
+ "sourcemap-codec": "^1.4.8"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/moment": {
+ "version": "2.29.4",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
+ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/obsidian": {
+ "version": "1.6.6",
+ "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.6.6.tgz",
+ "integrity": "sha512-GZHzeOiwmw/wBjB5JwrsxAZBLqxGQmqtEKSvJJvT0LtTcqeOFnV8jv0ZK5kO7hBb44WxJc+LdS7mZgLXbb+qXQ==",
+ "dev": true,
+ "dependencies": {
+ "@types/codemirror": "5.60.8",
+ "moment": "2.29.4"
+ },
+ "peerDependencies": {
+ "@codemirror/state": "^6.0.0",
+ "@codemirror/view": "^6.0.0"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+ "dev": true,
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
+ "dev": true
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/resolve": {
+ "version": "1.22.8",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
+ "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
+ "dev": true,
+ "dependencies": {
+ "is-core-module": "^2.13.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/rollup": {
+ "version": "2.79.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz",
+ "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==",
+ "dev": true,
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/sourcemap-codec": {
+ "version": "1.4.8",
+ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
+ "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
+ "deprecated": "Please use @jridgewell/sourcemap-codec instead",
+ "dev": true
+ },
+ "node_modules/style-mod": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz",
+ "integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==",
+ "dev": true,
+ "peer": true
+ },
+ "node_modules/supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz",
+ "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==",
+ "dev": true
+ },
+ "node_modules/typescript": {
+ "version": "4.9.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
+ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
+ "dev": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=4.2.0"
+ }
+ },
+ "node_modules/w3c-keyname": {
+ "version": "2.2.8",
+ "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
+ "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
+ "dev": true,
+ "peer": true
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
+ "dev": true
+ },
+ "node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 6"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
index 469af6f..7d6e514 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
"@rollup/plugin-typescript": "^6.0.0",
"@types/node": "^14.14.30",
"@types/yaml": "^1.9.7",
- "obsidian": "https://github.com/obsidianmd/obsidian-api/tarball/master",
+ "obsidian": "^1.6.6",
"rollup": "^2.39.0",
"tslib": "^2.0.3",
"typescript": "^4.1.5",

View File

@@ -0,0 +1,32 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-kanban
pkgs.stdenv.mkDerivation rec {
pname = "obsidian-plugin-kanban";
version = "2.0.51";
src = pkgs.fetchFromGitHub {
owner = "mgmeyers";
repo = "obsidian-kanban";
rev = version;
hash = "sha256-NahypggwPrub2KxRBAn54ZpEInP1V+6l/xmUKUt6myA=";
};
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-eof2W9Ja4RlmjQ0SnaF/jadHX3GRkCRrMwZU2z0M/Jk=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,37 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-languagetool
pkgs.stdenv.mkDerivation rec {
pname = "obsidian-plugin-languagetool";
version = "0.3.7";
src = pkgs.fetchFromGitHub {
owner = "Clemens-E";
repo = "obsidian-languagetool-plugin";
rev = version;
hash = "sha256-OsdOOrXNoraKuFPqvgn6pj6ZagEbiFCJyQ529eyZXUU=";
};
patches = [
./settings-notification.patch
./variety-typo.patch
];
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-749RGQmg9Mte7TR6k3qP6xcb8+rj/C60LYLbF8j8gNc=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,12 @@
diff --git a/src/index.ts b/src/index.ts
index 00cccfe..43e6107 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -42,7 +42,6 @@ export default class LanguageToolPlugin extends Plugin {
try {
await this.saveSettings();
await this.loadSettings();
- new Notice('updated LanguageTool Settings, please confirm your server URL in the settings tab', 10000);
} catch (e) {
console.error(e);
}

View File

@@ -0,0 +1,149 @@
diff --git a/src/SettingsTab.ts b/src/SettingsTab.ts
index d0d65bb..2a211b0 100644
--- a/src/SettingsTab.ts
+++ b/src/SettingsTab.ts
@@ -33,10 +33,10 @@ export interface LanguageToolPluginSettings {
staticLanguage?: string;
motherTongue?: string;
- englishVeriety?: undefined | 'en-US' | 'en-GB' | 'en-CA' | 'en-AU' | 'en-ZA' | 'en-NZ';
- germanVeriety?: undefined | 'de-DE' | 'de-AT' | 'de-CH';
- portugueseVeriety?: undefined | 'pt-BR' | 'pt-PT' | 'pt-AO' | 'pt-MZ';
- catalanVeriety?: undefined | 'ca-ES' | 'ca-ES-valencia';
+ englishVariety?: undefined | 'en-US' | 'en-GB' | 'en-CA' | 'en-AU' | 'en-ZA' | 'en-NZ';
+ germanVariety?: undefined | 'de-DE' | 'de-AT' | 'de-CH';
+ portugueseVariety?: undefined | 'pt-BR' | 'pt-PT' | 'pt-AO' | 'pt-MZ';
+ catalanVariety?: undefined | 'ca-ES' | 'ca-ES-valencia';
pickyMode: boolean;
@@ -286,13 +286,13 @@ export class LanguageToolSettingsTab extends PluginSettingTab {
component.onChange(async value => {
this.plugin.settings.staticLanguage = value;
if (value !== 'auto') {
- this.plugin.settings.englishVeriety = undefined;
+ this.plugin.settings.englishVariety = undefined;
englishVarietyDropdown?.setValue('default');
- this.plugin.settings.germanVeriety = undefined;
+ this.plugin.settings.germanVariety = undefined;
germanVarietyDropdown?.setValue('default');
- this.plugin.settings.portugueseVeriety = undefined;
+ this.plugin.settings.portugueseVariety = undefined;
portugueseVarietyDropdown?.setValue('default');
- this.plugin.settings.catalanVeriety = undefined;
+ this.plugin.settings.catalanVariety = undefined;
catalanVarietyDropdown?.setValue('default');
}
await this.plugin.saveSettings();
@@ -338,14 +338,14 @@ export class LanguageToolSettingsTab extends PluginSettingTab {
'en-ZA': 'English (South Africa)',
'en-NZ': 'English (New Zealand)',
})
- .setValue(this.plugin.settings.englishVeriety ?? 'default')
+ .setValue(this.plugin.settings.englishVariety ?? 'default')
.onChange(async value => {
if (value === 'default') {
- this.plugin.settings.englishVeriety = undefined;
+ this.plugin.settings.englishVariety = undefined;
} else {
this.plugin.settings.staticLanguage = 'auto';
staticLanguageComponent?.setValue('auto');
- this.plugin.settings.englishVeriety = value as 'en-US' | 'en-GB' | 'en-CA' | 'en-AU' | 'en-ZA' | 'en-NZ';
+ this.plugin.settings.englishVariety = value as 'en-US' | 'en-GB' | 'en-CA' | 'en-AU' | 'en-ZA' | 'en-NZ';
}
await this.plugin.saveSettings();
});
@@ -360,14 +360,14 @@ export class LanguageToolSettingsTab extends PluginSettingTab {
'de-CH': 'German (Switzerland)',
'de-AT': 'German (Austria)',
})
- .setValue(this.plugin.settings.germanVeriety ?? 'default')
+ .setValue(this.plugin.settings.germanVariety ?? 'default')
.onChange(async value => {
if (value === 'default') {
- this.plugin.settings.germanVeriety = undefined;
+ this.plugin.settings.germanVariety = undefined;
} else {
this.plugin.settings.staticLanguage = 'auto';
staticLanguageComponent?.setValue('auto');
- this.plugin.settings.germanVeriety = value as 'de-DE' | 'de-CH' | 'de-AT';
+ this.plugin.settings.germanVariety = value as 'de-DE' | 'de-CH' | 'de-AT';
}
await this.plugin.saveSettings();
});
@@ -383,14 +383,14 @@ export class LanguageToolSettingsTab extends PluginSettingTab {
'pt-AO': 'Portuguese (Angola)',
'pt-MZ': 'Portuguese (Mozambique)',
})
- .setValue(this.plugin.settings.portugueseVeriety ?? 'default')
+ .setValue(this.plugin.settings.portugueseVariety ?? 'default')
.onChange(async value => {
if (value === 'default') {
- this.plugin.settings.portugueseVeriety = undefined;
+ this.plugin.settings.portugueseVariety = undefined;
} else {
this.plugin.settings.staticLanguage = 'auto';
staticLanguageComponent?.setValue('auto');
- this.plugin.settings.portugueseVeriety = value as 'pt-BR' | 'pt-PT' | 'pt-AO' | 'pt-MZ';
+ this.plugin.settings.portugueseVariety = value as 'pt-BR' | 'pt-PT' | 'pt-AO' | 'pt-MZ';
}
await this.plugin.saveSettings();
});
@@ -404,14 +404,14 @@ export class LanguageToolSettingsTab extends PluginSettingTab {
'ca-ES': 'Catalan',
'ca-ES-valencia': 'Catalan (Valencian)',
})
- .setValue(this.plugin.settings.catalanVeriety ?? 'default')
+ .setValue(this.plugin.settings.catalanVariety ?? 'default')
.onChange(async value => {
if (value === 'default') {
- this.plugin.settings.catalanVeriety = undefined;
+ this.plugin.settings.catalanVariety = undefined;
} else {
this.plugin.settings.staticLanguage = 'auto';
staticLanguageComponent?.setValue('auto');
- this.plugin.settings.catalanVeriety = value as 'ca-ES' | 'ca-ES-valencia';
+ this.plugin.settings.catalanVariety = value as 'ca-ES' | 'ca-ES-valencia';
}
await this.plugin.saveSettings();
});
diff --git a/src/api.ts b/src/api.ts
index 109984c..4cd1700 100644
--- a/src/api.ts
+++ b/src/api.ts
@@ -58,27 +58,27 @@ export async function getDetectionResult(
params.disabledRules = settings.ruleOtherDisabledRules;
}
- if (settings.englishVeriety) {
+ if (settings.englishVariety) {
params.preferredVariants = `${params.preferredVariants ? `${params.preferredVariants},` : ''}${
- settings.englishVeriety
+ settings.englishVariety
}`;
}
- if (settings.germanVeriety) {
+ if (settings.germanVariety) {
params.preferredVariants = `${params.preferredVariants ? `${params.preferredVariants},` : ''}${
- settings.germanVeriety
+ settings.germanVariety
}`;
}
- if (settings.portugueseVeriety) {
+ if (settings.portugueseVariety) {
params.preferredVariants = `${params.preferredVariants ? `${params.preferredVariants},` : ''}${
- settings.portugueseVeriety
+ settings.portugueseVariety
}`;
}
- if (settings.catalanVeriety) {
+ if (settings.catalanVariety) {
params.preferredVariants = `${params.preferredVariants ? `${params.preferredVariants},` : ''}${
- settings.catalanVeriety
+ settings.catalanVariety
}`;
}

View File

@@ -0,0 +1,23 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-linter
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-linter";
version = "1.28.0";
src = pkgs.fetchFromGitHub {
owner = "platers";
repo = "obsidian-linter";
rev = version;
hash = "sha256-pMcVowcV0k/OcG6cITRxt3HOA5QJDaery6upLPWSxpM=";
};
npmDepsHash = "sha256-XgOgAJoRXhQIQNnubU0uL7e7SGJvRhWvPktMNZN5F5U=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./src/styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,28 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-map-view
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-map-view";
version = "5.5.0";
src = pkgs.fetchFromGitHub {
owner = "esm7";
repo = "obsidian-map-view";
rev = version;
hash = "sha256-HiH6KPLnCNyidp6TI7HJK4aj5SL0B0xO6HOWUgjVdd4=";
};
patches = [
./package-lock.patch
./file-api-key.patch
];
npmDepsHash = "sha256-fNvDoMGIlmJ0zum3Qm/eLx5a/UV8rC2JmRYbXUAXgGg=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./dist/manifest.json $out/manifest.json
cp ./dist/main.js $out/main.js
cp ./dist/styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,230 @@
diff --git a/src/geosearch.ts b/src/geosearch.ts
index f1b89b9..68fd4c1 100644
--- a/src/geosearch.ts
+++ b/src/geosearch.ts
@@ -2,7 +2,7 @@ import { request, App } from 'obsidian';
import * as geosearch from 'leaflet-geosearch';
import * as leaflet from 'leaflet';
import queryString from 'query-string';
-
+import { readFileSync } from 'fs';
import { type PluginSettings } from 'src/settings';
import { UrlConvertor } from 'src/urlConvertor';
import { FileMarker } from 'src/markers';
@@ -31,12 +31,16 @@ export class GeoSearcher {
constructor(app: App, settings: PluginSettings) {
this.settings = settings;
this.urlConvertor = new UrlConvertor(app, settings);
+
+ const apiKey =
+ settings.geocodingApiMethod === 'key'
+ ? settings.geocodingApiKey
+ : readFileSync(settings.geocodingApiPath, 'utf-8').trim();
+
if (settings.searchProvider == 'osm')
this.searchProvider = new geosearch.OpenStreetMapProvider();
else if (settings.searchProvider == 'google') {
- this.searchProvider = new geosearch.GoogleProvider({
- apiKey: settings.geocodingApiKey,
- });
+ this.searchProvider = new geosearch.GoogleProvider({ apiKey });
}
}
@@ -119,10 +123,15 @@ export async function googlePlacesSearch(
): Promise<GeoSearchResult[]> {
if (settings.searchProvider != 'google' || !settings.useGooglePlaces)
return [];
- const googleApiKey = settings.geocodingApiKey;
+
+ const apiKey =
+ settings.geocodingApiMethod === 'key'
+ ? settings.geocodingApiKey
+ : readFileSync(settings.geocodingApiPath, 'utf-8').trim();
+
const params = {
query: query,
- key: googleApiKey,
+ key: apiKey,
};
if (centerOfSearch)
(params as any)['location'] =
diff --git a/src/settings.ts b/src/settings.ts
index 44a0464..1cd6015 100644
--- a/src/settings.ts
+++ b/src/settings.ts
@@ -48,7 +48,9 @@ export type PluginSettings = {
maxClusterRadiusPixels: number;
searchProvider: 'osm' | 'google';
searchDelayMs: number;
- geocodingApiKey: string;
+ geocodingApiMethod?: 'key' | 'path';
+ geocodingApiKey?: string;
+ geocodingApiPath?: string;
useGooglePlaces: boolean;
saveHistory: boolean;
queryForFollowActiveNote: string;
@@ -228,6 +230,7 @@ export const DEFAULT_SETTINGS: PluginSettings = {
maxClusterRadiusPixels: 20,
searchProvider: 'osm',
searchDelayMs: 250,
+ geocodingApiMethod: 'key',
geocodingApiKey: '',
useGooglePlaces: false,
mapSources: [
diff --git a/src/settingsTab.ts b/src/settingsTab.ts
index 7a5994c..ea586fd 100644
--- a/src/settingsTab.ts
+++ b/src/settingsTab.ts
@@ -54,7 +54,10 @@ export class SettingsTab extends PluginSettingTab {
});
});
+ let apiMethodControl: Setting = null;
let apiKeyControl: Setting = null;
+ let apiPathControl: Setting = null;
+
new Setting(containerEl)
.setName('Geocoding search provider')
.setDesc(
@@ -72,8 +75,19 @@ export class SettingsTab extends PluginSettingTab {
this.plugin.settings.searchProvider = value;
await this.plugin.saveSettings();
this.refreshPluginOnHide = true;
- apiKeyControl.settingEl.style.display =
+
+ apiMethodControl.settingEl.style.display =
value === 'google' ? '' : 'none';
+ apiKeyControl.settingEl.style.display =
+ value === 'google' &&
+ this.plugin.settings.geocodingApiMethod === 'key'
+ ? ''
+ : 'none';
+ apiPathControl.settingEl.style.display =
+ value === 'google' &&
+ this.plugin.settings.geocodingApiMethod === 'path'
+ ? ''
+ : 'none';
googlePlacesControl.settingEl.style.display =
this.plugin.settings.searchProvider === 'google'
? ''
@@ -81,8 +95,37 @@ export class SettingsTab extends PluginSettingTab {
});
});
+ apiMethodControl = new Setting(containerEl)
+ .setName('Geocoding API Method')
+ .setDesc(
+ 'Choose whether to provide the API key directly or via a file path.'
+ )
+ .addDropdown((component) => {
+ component
+ .addOption('key', 'API Key')
+ .addOption('path', 'API Key Path')
+ .setValue(this.plugin.settings.geocodingApiMethod || 'key')
+ .onChange(async (value: 'key' | 'path') => {
+ this.plugin.settings.geocodingApiMethod = value;
+ await this.plugin.saveSettings();
+ apiKeyControl.settingEl.style.display =
+ value === 'key' &&
+ this.plugin.settings.searchProvider === 'google'
+ ? ''
+ : 'none';
+ apiPathControl.settingEl.style.display =
+ value === 'path' &&
+ this.plugin.settings.searchProvider === 'google'
+ ? ''
+ : 'none';
+ });
+ });
+
+ apiMethodControl.settingEl.style.display =
+ this.plugin.settings.searchProvider === 'google' ? '' : 'none';
+
apiKeyControl = new Setting(containerEl)
- .setName('Gecoding API key')
+ .setName('Geocoding API key')
.setDesc(
'If using Google as the geocoding search provider, paste the API key here. See the plugin documentation for more details. Changes are applied after restart.',
)
@@ -101,6 +144,40 @@ export class SettingsTab extends PluginSettingTab {
? ''
: 'red';
});
+
+ apiKeyControl.settingEl.style.display =
+ this.plugin.settings.searchProvider === 'google' &&
+ this.plugin.settings.geocodingApiMethod === 'key'
+ ? ''
+ : 'none';
+
+ apiPathControl = new Setting(containerEl)
+ .setName('Geocoding API key path')
+ .setDesc(
+ 'If using Google as the geocoding search provider and using a path to the API key, enter the file path here. See the plugin documentation for more details. Changes are applied after restart.'
+ )
+ .addText((component) => {
+ component
+ .setValue(this.plugin.settings.geocodingApiPath)
+ .onChange(async (value) => {
+ this.plugin.settings.geocodingApiPath = value;
+ await this.plugin.saveSettings();
+ component.inputEl.style.borderColor = value
+ ? ''
+ : 'red';
+ });
+ component.inputEl.style.borderColor = this.plugin.settings
+ .geocodingApiPath
+ ? ''
+ : 'red';
+ });
+
+ apiPathControl.settingEl.style.display =
+ this.plugin.settings.searchProvider === 'google' &&
+ this.plugin.settings.geocodingApiMethod === 'path'
+ ? ''
+ : 'none';
+
let googlePlacesControl = new Setting(containerEl)
.setName('Use Google Places for searches')
.setDesc(
@@ -118,9 +195,6 @@ export class SettingsTab extends PluginSettingTab {
});
});
- // Display the API key control only if the search provider requires it
- apiKeyControl.settingEl.style.display =
- this.plugin.settings.searchProvider === 'google' ? '' : 'none';
googlePlacesControl.settingEl.style.display =
this.plugin.settings.searchProvider === 'google' ? '' : 'none';
new Setting(containerEl)
diff --git a/src/urlConvertor.ts b/src/urlConvertor.ts
index 365f49b..2fdf0b8 100644
--- a/src/urlConvertor.ts
+++ b/src/urlConvertor.ts
@@ -1,6 +1,6 @@
import { App, Editor, TFile, request } from 'obsidian';
import queryString from 'query-string';
-
+import { readFileSync } from 'fs';
import * as leaflet from 'leaflet';
import { type PluginSettings, type UrlParsingRule } from 'src/settings';
import * as utils from 'src/utils';
@@ -136,10 +136,15 @@ export class UrlConvertor {
const placeName = placeNameMatch[1];
if (this.settings.debug)
console.log('Google link: found place name = ', placeName);
- const googleApiKey = settings.geocodingApiKey;
+
+ const apiKey =
+ settings.geocodingApiMethod === 'key'
+ ? settings.geocodingApiKey
+ : readFileSync(settings.geocodingApiPath, 'utf-8').trim();
+
const params = {
query: placeName,
- key: googleApiKey,
+ key: apiKey,
};
const googleUrl =
'https://maps.googleapis.com/maps/api/place/textsearch/json?' +

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-minimal-settings
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-minimal-settings";
version = "8.1.1";
src = pkgs.fetchFromGitHub {
owner = "kepano";
repo = "obsidian-minimal-settings";
rev = version;
hash = "sha256-JcWqSVgSRJAm0QiLnGuPpv0S9SVZw7UdtuKnvUAKiwQ=";
};
patches = [ ./package-lock.patch ];
npmDepsHash = "sha256-E8CPsBmuV51GC3N5qxz8haa249vMfm3TZyZVsyPwfkg=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,28 @@
diff --git a/package-lock.json b/package-lock.json
index 1ff5c84..a903c9a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,7 +11,7 @@
"devDependencies": {
"@types/node": "^16.11.6",
"esbuild": "0.13.12",
- "obsidian": "latest",
+ "obsidian": "^1.6.6",
"tslib": "2.3.1",
"typescript": "^5.5.3"
}
@@ -325,10 +325,11 @@
}
},
"node_modules/obsidian": {
- "version": "1.5.7-1",
- "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.5.7-1.tgz",
- "integrity": "sha512-T5ZRuQ1FnfXqEoakTTHVDYvzUEEoT8zSPnQCW31PVgYwG4D4tZCQfKHN2hTz1ifnCe8upvwa6mBTAP2WUA5Vng==",
+ "version": "1.7.2",
+ "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.7.2.tgz",
+ "integrity": "sha512-k9hN9brdknJC+afKr5FQzDRuEFGDKbDjfCazJwpgibwCAoZNYHYV8p/s3mM8I6AsnKrPKNXf8xGuMZ4enWelZQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"@types/codemirror": "5.60.8",
"moment": "2.29.4"

View File

@@ -0,0 +1,23 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-outliner
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-outliner";
version = "4.8.1";
src = pkgs.fetchFromGitHub {
owner = "vslinko";
repo = "obsidian-outliner";
rev = version;
hash = "sha256-LfkK1c3khA75UZQMJStvV2bccHTz4eMqtEIC8jPFKBM=";
};
npmDepsHash = "sha256-EVSunBtuOo93Zhq95u80j/MArRZaAyKdcwUz61qHXiQ=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,22 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-read-it-later
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-read-it-later";
version = "0.11.4";
src = pkgs.fetchFromGitHub {
owner = "DominikPieper";
repo = "obsidian-ReadItLater";
rev = version;
hash = "sha256-Favp5YhRTYhMGsLuPWiFwmU3zA3vwZkkdXABBVy7NNs=";
};
npmDepsHash = "sha256-PUQc3qM/pjJkkO3zpCmga8eO8XaNxyeZAw+0GNPg5Ro=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
'';
}

View File

@@ -0,0 +1,38 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-style-settings --src-attr unpatchedSrc
pkgs.stdenv.mkDerivation rec {
pname = "obsidian-plugin-style-settings";
version = "1.0.9";
unpatchedSrc = pkgs.fetchFromGitHub {
owner = "mgmeyers";
repo = "obsidian-style-settings";
rev = version;
hash = "sha256-eNbZQ/u3mufwVX+NRJpMSk5uGVkWfW0koXKq7wg9d+I=";
};
# Wrap in applyPatches so that offlineCache below is built correctly
src = pkgs.applyPatches {
src = unpatchedSrc;
patches = [ ./package-lock.patch ];
};
offlineCache = pkgs.fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-tqX09XWI3ZL9bXVdjgsAEuvfCAjnyWj5uSWGFbNApds=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,67 @@
diff --git a/package.json b/package.json
index 2984db3..87e96bd 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"typescript": "4.7.4"
},
"dependencies": {
- "@simonwep/pickr": "https://github.com/nothingislost/pickr/archive/a17739f7aa1871b44da778cbb79ae76dae77d839.tar.gz",
+ "@simonwep/pickr": "^1.9.1",
"@types/chroma-js": "^2.1.3",
"@types/js-yaml": "^4.0.3",
"chroma-js": "^2.1.2",
diff --git a/yarn.lock b/yarn.lock
index 6ef7388..9d006fd 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -336,13 +336,13 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
-"@simonwep/pickr@https://github.com/nothingislost/pickr/archive/a17739f7aa1871b44da778cbb79ae76dae77d839.tar.gz":
- version "1.8.4"
- resolved "https://github.com/nothingislost/pickr/archive/a17739f7aa1871b44da778cbb79ae76dae77d839.tar.gz"
- integrity sha512-VOphUjenpUXHMrYo+uNREruBB/xhMsvqqnJMUShctn1pQXWMDp41a9NJ6XyhISwlyRNoubkuXEn/7/3MuvAhyg==
+"@simonwep/pickr@^1.9.1":
+ version "1.9.1"
+ resolved "https://registry.yarnpkg.com/@simonwep/pickr/-/pickr-1.9.1.tgz#10d86dab514b8888b2d6b90299a477f254067c43"
+ integrity sha512-fR3qmfAcPf/HSFS7GEnTmZLM3+xERv1+jyMBbzT63ilRRM8veYjI7ELvkHHKk0/du3lHp7uh/FqatjM3646X1g==
dependencies:
- core-js "^3.15.1"
- nanopop "^2.1.0"
+ core-js "3.37.0"
+ nanopop "2.4.2"
"@trivago/prettier-plugin-sort-imports@4.2.0":
version "4.2.0"
@@ -607,10 +607,10 @@ concat-map@0.0.1:
resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
integrity "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
-core-js@^3.15.1:
- version "3.18.2"
- resolved "https://registry.npmjs.org/core-js/-/core-js-3.18.2.tgz"
- integrity sha512-zNhPOUoSgoizoSQFdX1MeZO16ORRb9FFQLts8gSYbZU5FcgXhp24iMWMxnOQo5uIaIG7/6FA/IqJPwev1o9ZXQ==
+core-js@3.37.0:
+ version "3.37.0"
+ resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.37.0.tgz#d8dde58e91d156b2547c19d8a4efd5c7f6c426bb"
+ integrity sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==
cross-env@^6.0.3:
version "6.0.3"
@@ -1128,10 +1128,10 @@ ms@2.1.2:
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
-nanopop@^2.1.0:
- version "2.1.0"
- resolved "https://registry.npmjs.org/nanopop/-/nanopop-2.1.0.tgz"
- integrity sha512-jGTwpFRexSH+fxappnGQtN9dspgE2ipa1aOjtR24igG0pv6JCxImIAmrLRHX+zUF5+1wtsFVbKyfP51kIGAVNw==
+nanopop@2.4.2:
+ version "2.4.2"
+ resolved "https://registry.yarnpkg.com/nanopop/-/nanopop-2.4.2.tgz#b55482135be7e64f2d0f5aa8ef51a58104ac7b13"
+ integrity sha512-NzOgmMQ+elxxHeIha+OG/Pv3Oc3p4RU2aBhwWwAqDpXrdTbtRylbRLQztLy8dMMwfl6pclznBdfUhccEn9ZIzw==
natural-compare@^1.4.0:
version "1.4.0"

View File

@@ -0,0 +1,32 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-tasks
pkgs.stdenv.mkDerivation rec {
pname = "obsidian-plugin-tasks";
version = "7.17.0";
src = pkgs.fetchFromGitHub {
owner = "obsidian-tasks-group";
repo = "obsidian-tasks";
rev = version;
hash = "sha256-BF9ye4ocE6vZh+ChkmuLkQpNWtH425EX0EHQs+wbTZc=";
};
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-Tf1K048Ox+hImIfrdBWQHsiDe+3FGUQLFBcf/Bbbo1U=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -0,0 +1,24 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-plugin-url-into-selection
pkgs.buildNpmPackage rec {
pname = "obsidian-plugin-url-into-selection";
version = "1.7.0";
src = pkgs.fetchFromGitHub {
owner = "denolehov";
repo = "obsidian-url-into-selection";
rev = version;
hash = "sha256-xmKJOuXirg/LFVK/0925fazW+cm+XUlLpAUgpAS6bZI=";
};
patches = [ ./package-lock.patch ];
npmDepsHash = "sha256-tThyrhezHZ29JUzx5sy2SfoZIGYP0DOQBctxYB5O1P4=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
'';
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake obsidian-theme-minimal
pkgs.buildNpmPackage rec {
pname = "obsidian-theme-minimal";
version = "7.7.19";
src = pkgs.fetchFromGitHub {
owner = "kepano";
repo = "obsidian-minimal";
rev = version;
hash = "sha256-1NUnOmQVbikUNcQcPSi0JYxMR6z7s1gZ1iFmR5SOkbM=";
};
npmDepsHash = "sha256-R+XeEkDP0MxNQsFCWmHXKtLBcmiOTv9Nw7t2e27kvQg=";
npmPackFlags = [ "--ignore-scripts" ];
nativeBuildInputs = with pkgs; [ sass ];
buildPhase = ''
npx grunt cssmin
'';
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./theme.css $out/theme.css
'';
}

View File

@@ -0,0 +1,23 @@
{ pkgs, ... }:
# AUTO-UPDATE: echo "Warning: Package from private git repository cannot be automatically updated." >&2
pkgs.buildGoModule rec {
pname = "sage";
version = "1.55.0";
src = fetchGit {
url = "git@github.com:sas-institute-rnd-internal/pipeline-sage.git";
ref = "main";
rev = "41a07811d8c8002d452dc677151b87dbbeae2b81";
};
vendorHash = "sha256-ye76doo/3bkHxY8l7060ElQlRwY0/C3h7ICJTMmXg5k=";
preBuild = ''
export GOPROXY="goproxy.unx.sas.com"
export GONOSUMDB="*.sas.com,sassoftware.io"
rm -rf cmd/bootstrap python sage
'';
doCheck = false;
}

View File

@@ -0,0 +1,27 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake viya4-ark
pkgs.python3Packages.buildPythonPackage rec {
pname = "viya4-ark";
version = "2.0.2";
src = pkgs.fetchFromGitHub {
owner = "sassoftware";
repo = "viya4-ark";
rev = version;
hash = "sha256-P2DixhY3xbNeiYiMX+7C2YTCpvcMlUpRJ2VfzhGvsPs=";
};
patches = [
./fix-setup.patch
./remove-kubeconfig-check.patch
];
propagatedBuildInputs = with pkgs.python3Packages; [
jinja2
pint
requests
pyyaml
ldap3
semantic-version
];
}

View File

@@ -0,0 +1,364 @@
diff --git a/.gitignore b/.gitignore
index 07ae204..28e5e8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@
*.pyo
*.sa
*.so
+*.eggs
+*.__pycache__/
# Logs and databases #
######################
@@ -43,4 +45,4 @@ Thumbs.db
/bin/
build
docker
-/**/.pytest_cache/
\ No newline at end of file
+/**/.pytest_cache/
diff --git a/deployment_report/templates/__init__.py b/deployment_report/templates/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/ldap_validator/library/__init__.py b/ldap_validator/library/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/ldap_validator/library/utils/__init__.py b/ldap_validator/library/utils/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pre_install_report/templates/__init__.py b/pre_install_report/templates/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/setup.cfg b/setup.cfg
index 1c80cb2..4ffdef1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,7 +2,11 @@
name = viya4-ark
author = SAS Institute Inc.
summary = The SAS Viya Administration Resource Kit (SAS Viya ARK) provides tools and utilities to help SAS customers prepare for and gather information about a SAS Viya platform deployment.
-description-file = README.md
-description-content-type = text/markdown
-home-page = https://github.com/sassoftware/viya4-ark
+description_file = README.md
+description_content_type = text/markdown
+home_page = https://github.com/sassoftware/viya4-ark
license = Apache-2.0
+
+[options.entry_points]
+console_scripts =
+ viya4-ark = viya4_ark:main
diff --git a/setup.py b/setup.py
index d3dd4f5..05cbeb7 100644
--- a/setup.py
+++ b/setup.py
@@ -14,10 +14,14 @@
from setuptools import find_packages, setup
+packages = find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"])
+
setup(
- setup_requires=["pbr"],
- pbr=True,
- licenses_files=["LICENSE"],
- packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
+ setup_requires=[],
+ license_files=["LICENSE"],
+ py_modules=["viya4_ark"],
+ packages=packages,
+ include_package_data=True,
+ package_data={package: ["*"] for package in packages},
python_requires=">=3.6",
)
diff --git a/viya-ark.py b/viya-ark.py
deleted file mode 100644
index 7626a89..0000000
--- a/viya-ark.py
+++ /dev/null
@@ -1,139 +0,0 @@
-####################################################################
-# ### viya-ark.py ###
-####################################################################
-# ### Author: SAS Institute Inc. ###
-####################################################################
-# ###
-# Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA. ###
-# All Rights Reserved. ###
-# SPDX-License-Identifier: Apache-2.0 ###
-# ###
-####################################################################
-
-import importlib
-import inspect
-import os
-import pkgutil
-import sys
-
-from viya_ark_library.command import Command
-
-# command line options #
-_HELP_SHORT_OPT_ = "h"
-_HELP_LONG_OPT_ = "help"
-
-# return codes #
-_SUCCESS_RC_ = 0
-_BAD_OPT_RC_ = 1
-
-
-################
-# Main #
-################
-def main(argv: list):
- """
- The main executable method for the viya-ark launcher script.
-
- :param argv: The list of arguments passed at invocation.
- """
- try:
- # get the requested command value #
- command_name = argv[0]
-
- # print the usage and exit, if requested #
- if command_name in (f"-{_HELP_SHORT_OPT_}", f"--{_HELP_LONG_OPT_}"):
- usage(_SUCCESS_RC_)
-
- # convert any dashes in the given command to underscores to align with Pythonic package/module standards #
- command_module_name = command_name.replace("-", "_")
-
- # attempt to import the requested command module #
- imported_module = None
- try:
- imported_module = importlib.import_module(f"{command_module_name}.{command_module_name}")
- except ModuleNotFoundError:
- print()
- print(f"ERROR: Command [{command_name}] not found.")
- usage(_BAD_OPT_RC_)
-
- # find any attributes in the module that implement the Command class using reflection #
- command = None
- for attribute_name in dir(imported_module):
- # get the current module attribute by name #
- attribute = getattr(imported_module, attribute_name)
-
- # if the attribute is: #
- # (1) a class -AND- #
- # (2) a subclass of Command -AND- #
- # (3) not abstract #
- # then the attribute defines a command for the project. #
- if inspect.isclass(attribute) and issubclass(attribute, Command) and not inspect.isabstract(attribute):
- command = attribute
- # the Command implementation was found, the loop can break #
- break
-
- if command is not None:
- # call the Command's run() method to delegate execution to the module, pass all relevant arguments #
- command.run(argv[1:])
- else:
- # if a Command implementation wasn't found, print the usage message #
- print()
- print(f"ERROR: Command [{command_name}] not found.")
- usage(_BAD_OPT_RC_)
-
- except IndexError:
- # if the launcher script wasn't given enough args, print the usage #
- print()
- print("ERROR: A command must be provided.")
- usage(_BAD_OPT_RC_)
-
-
-#################
-# Usage #
-#################
-def usage(exit_code: int):
- """
- Prints the usage statement for the viya-ark launcher script and exits with the provided exit_code.
-
- :param exit_code: The code to return upon exit.
- """
- commands = list()
-
- # walk through all packages parallel to this script #
- paths = [os.path.realpath(os.path.dirname(__file__))]
- for importer, name, is_package in pkgutil.walk_packages(path=paths):
- # skip any objects that are packages (i.e. not modules) #
- if not is_package:
- # import the current module #
- try:
- importlib.import_module(name)
- except ModuleNotFoundError as e:
- # ignore any issues importing pytest, raise any other module import errors
- if e.name != "pytest":
- raise e
-
- for subclass in Command.__subclasses__():
- # create a tuple of command details by calling the command_name() and command_desc() methods #
- command_details = (subclass().command_name(), subclass().command_desc())
- # add the command details to the list of discovered commands #
- commands.append(command_details)
-
- # print the commands as well as the static help command to stdout #
- print()
- print(f"Usage: {os.path.basename(__file__)} <command> [options]")
- print()
- print("Commands:")
- for command in commands:
- print(" {:<30} {}".format(command[0], command[1]))
- help_cmd_display = f"-{_HELP_SHORT_OPT_}, --{_HELP_LONG_OPT_}"
- print(" {:<30} {}".format(help_cmd_display, "Display usage for viya-ark."))
- print()
-
- sys.exit(exit_code)
-
-
-##################
-# __main__ #
-##################
-if __name__ == "__main__":
- main(sys.argv[1:])
diff --git a/viya4_ark.py b/viya4_ark.py
new file mode 100644
index 0000000..1af3b79
--- /dev/null
+++ b/viya4_ark.py
@@ -0,0 +1,136 @@
+####################################################################
+# ### main.py ###
+####################################################################
+# ### Author: SAS Institute Inc. ###
+####################################################################
+# ###
+# Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA. ###
+# All Rights Reserved. ###
+# SPDX-License-Identifier: Apache-2.0 ###
+# ###
+####################################################################
+
+import importlib
+import inspect
+import os
+import pkgutil
+import sys
+
+from viya_ark_library.command import Command
+
+# command line options #
+_HELP_SHORT_OPT_ = "h"
+_HELP_LONG_OPT_ = "help"
+
+# return codes #
+_SUCCESS_RC_ = 0
+_BAD_OPT_RC_ = 1
+
+
+################
+# Main #
+################
+def main():
+ """
+ The main executable method for the viya-ark launcher script.
+ """
+ argv = sys.argv[1:]
+
+ if len(argv) == 0:
+ print("ERROR: A command must be provided.")
+ usage(_BAD_OPT_RC_)
+
+ command_name = argv[0]
+
+ # print the usage and exit, if requested #
+ if command_name in (f"-{_HELP_SHORT_OPT_}", f"--{_HELP_LONG_OPT_}"):
+ usage(_SUCCESS_RC_)
+
+ # convert any dashes in the given command to underscores to align with Pythonic package/module standards #
+ command_module_name = command_name.replace("-", "_")
+
+ # attempt to import the requested command module #
+ imported_module = None
+ try:
+ imported_module = importlib.import_module(f"{command_module_name}.{command_module_name}")
+ except ModuleNotFoundError:
+ print()
+ print(f"ERROR: Command [{command_name}] not found.")
+ usage(_BAD_OPT_RC_)
+
+ # find any attributes in the module that implement the Command class using reflection #
+ command = None
+ for attribute_name in dir(imported_module):
+ # get the current module attribute by name #
+ attribute = getattr(imported_module, attribute_name)
+
+ # if the attribute is: #
+ # (1) a class -AND- #
+ # (2) a subclass of Command -AND- #
+ # (3) not abstract #
+ # then the attribute defines a command for the project. #
+ if inspect.isclass(attribute) and issubclass(attribute, Command) and not inspect.isabstract(attribute):
+ command = attribute
+ # the Command implementation was found, the loop can break #
+ break
+
+ if command is not None:
+ # call the Command's run() method to delegate execution to the module, pass all relevant arguments #
+ command.run(argv[1:])
+ else:
+ # if a Command implementation wasn't found, print the usage message #
+ print()
+ print(f"ERROR: Command [{command_name}] not found.")
+ usage(_BAD_OPT_RC_)
+
+
+#################
+# Usage #
+#################
+def usage(exit_code: int):
+ """
+ Prints the usage statement for the viya-ark launcher script and exits with the provided exit_code.
+
+ :param exit_code: The code to return upon exit.
+ """
+ commands = list()
+
+ # walk through all packages parallel to this script #
+ paths = [os.path.realpath(os.path.dirname(__file__))]
+ for importer, name, is_package in pkgutil.walk_packages(path=paths):
+ # skip any objects that are packages (i.e. not modules) #
+ if is_package:
+ continue
+
+ try:
+ importlib.import_module(name)
+ except ModuleNotFoundError as e:
+ # ignore any issues importing pytest, raise any other module import errors
+ if e.name != "pytest":
+ raise e
+
+ for subclass in Command.__subclasses__():
+ # create a tuple of command details by calling the command_name() and command_desc() methods #
+ command_details = (subclass().command_name(), subclass().command_desc())
+ # add the command details to the list of discovered commands #
+ commands.append(command_details)
+
+ # print the commands as well as the static help command to stdout #
+ print()
+ print(f"Usage: {os.path.basename(__file__)} <command> [options]")
+ print()
+ print("Commands:")
+ for command in commands:
+ print(" {:<30} {}".format(command[0], command[1]))
+ help_cmd_display = f"-{_HELP_SHORT_OPT_}, --{_HELP_LONG_OPT_}"
+ print(" {:<30} {}".format(help_cmd_display, "Display usage for viya-ark."))
+ print()
+
+ sys.exit(exit_code)
+
+
+##################
+# __main__ #
+##################
+if __name__ == "__main__":
+ main()
diff --git a/viya_ark_library/templates/__init__.py b/viya_ark_library/templates/__init__.py
new file mode 100644
index 0000000..e69de29

View File

@@ -0,0 +1,96 @@
diff --git a/pre_install_report/library/pre_install_check.py b/pre_install_report/library/pre_install_check.py
index 31b66d8..88a2d96 100644
--- a/pre_install_report/library/pre_install_check.py
+++ b/pre_install_report/library/pre_install_check.py
@@ -218,21 +218,6 @@ class ViyaPreInstallCheck():
output_dir)
return
- def _read_environment_var(self, env_var):
- """
- This method verifies that the KUBECONFIG environment variable is set.
-
- :param env_var: Environment variable to check
- """
- try:
- value_env_var = os.environ[env_var]
- except Exception:
- self.logger.exception("CalledProcessorError")
- print(viya_messages.KUBECONF_ERROR)
- sys.exit(viya_messages.BAD_ENV_RC_)
-
- return value_env_var
-
def _get_nested_info(self, nested_nodes, extracted_nodes, search_key):
try:
diff --git a/pre_install_report/pre_install_report.py b/pre_install_report/pre_install_report.py
index 1379c43..54fbc7e 100644
--- a/pre_install_report/pre_install_report.py
+++ b/pre_install_report/pre_install_report.py
@@ -74,24 +74,6 @@ def _read_config_file(filename):
sys.exit(viya_messages.SET_LIMTS_ERROR_RC_)
-def read_environment_var(env_var):
- """
- This method verifies that the KUBECONFIG environment variable is set.
-
- :param env_var: Environment variable to check
- """
- try:
- value_env_var = os.environ[env_var]
- # Check if specified file exists
- if not os.path.exists(value_env_var):
- print(viya_messages.KUBECONF_FILE_ERROR.format(value_env_var))
- sys.exit(viya_messages.BAD_ENV_RC_)
- except Exception:
- print(viya_messages.KUBECONF_ERROR)
- sys.exit(viya_messages.BAD_ENV_RC_)
- return value_env_var
-
-
class PreInstallReportCommand(Command):
"""
Command implementation for the pre-install command to register
@@ -198,7 +180,6 @@ def main(argv):
sas_logger = ViyaARKLogger(report_log_path, logging_level=logging_level, logger_name="pre_install_logger")
logger = sas_logger.get_logger()
- read_environment_var('KUBECONFIG')
try:
kubectl = Kubectl(namespace=name_space)
diff --git a/pre_install_report/test/test_pre_install_report.py b/pre_install_report/test/test_pre_install_report.py
index ed805ec..f93ec58 100644
--- a/pre_install_report/test/test_pre_install_report.py
+++ b/pre_install_report/test/test_pre_install_report.py
@@ -25,7 +25,6 @@ from pre_install_report.library.pre_install_check import ViyaPreInstallCheck
from pre_install_report.library.pre_install_check_permissions import PreCheckPermissions
from viya_ark_library.jinja2.sas_jinja2 import Jinja2TemplateRenderer
from viya_ark_library.logging import ViyaARKLogger
-from pre_install_report.pre_install_report import read_environment_var
from pre_install_report.library.utils import viya_messages
_SUCCESS_RC_ = 0
@@ -548,20 +547,6 @@ def test_get_calculated_aggregate_memory():
assert str(round(total_calc_memoryGi.to('Gi'), 13)) == '62.5229606628418 Gi'
-def test_kubconfig_file():
- old_kubeconfig = os.environ.get('KUBECONFIG') # /Users/cat/doc
- os.environ['KUBECONFIG'] = 'blah_nonexistentfile_blah'
- new_kubeconfig = os.environ.get('KUBECONFIG') # /Users/cat/doc
- assert new_kubeconfig == 'blah_nonexistentfile_blah'
- try:
- read_environment_var('KUBECONFIG')
- except SystemExit as exc:
- assert exc.code == viya_messages.BAD_ENV_RC_
- pass
- finally:
- os.environ['KUBECONFIG'] = str(old_kubeconfig)
-
-
def test_validated_k8s_server_version():
vpc = createViyaPreInstallCheck(viya_k8s_version_min,

View File

@@ -0,0 +1,155 @@
diff --git a/README.md b/README.md
index db2292b..400fbc2 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Available Commands:
license Download a license for the given order number at the given cadence name and version
Flags:
- -c, --config string config file (default is $HOME/.viya4-orders-cli)
+ -c, --config string config file (default is $XDG_CONFIG_HOME/viya4-orders-cli/config.yaml)
-n, --file-name string name of the file where you want the downloaded order asset to be stored
(defaults:
certs - SASViyaV4_<order number>_certs.zip
@@ -144,7 +144,7 @@ Take the following steps to start using SAS Viya Orders CLI:
1. If you want to use a configuration file, create it.
- The default location for the configuration file is `$HOME/.viya4-orders-cli`.
+ The default location for the configuration file is `$XDG_CONFIG_HOME/viya4-orders-cli/config.yaml`.
You can save the file anywhere you want as long as you use the `--config` /
`-c` option to inform the CLI of any non-default location.
@@ -195,7 +195,7 @@ You have the following options for launching SAS Viya Orders CLI:
The examples in this section correspond to typical tasks that you might perform
using SAS Viya Orders CLI:
-- Using a configuration file, `/c/Users/auser/vocli/.viya4-orders-cli.yaml`, to
+- Using a configuration file, `/c/Users/auser/vocli/.config/viya4-orders-cli/config.yaml`, to
convey your API credentials, get deployment assets for SAS Viya order `923456`
at the latest version of the Long Term Support (`lts`) cadence. Send the
contents to file `/c/Users/auser/vocli/sasfiles/923456_lts_depassets.tgz`:
@@ -203,13 +203,13 @@ using SAS Viya Orders CLI:
```docker
docker run -v /c/Users/auser/vocli:/sasstuff viya4-orders-cli deploymentAssets 923456 lts \
- --config /sasstuff/.viya4-orders-cli.yaml --file-path /sasstuff/sasfiles --file-name 923456_lts_depassets
+ --config /sasstuff/.config/viya4-orders-cli/config.yaml --file-path /sasstuff/sasfiles --file-name 923456_lts_depassets
```
Sample output:
```text
- 2020/10/02 19:16:30 Using config file: /sasstuff/.viya4-orders-cli.yaml
+ 2020/10/02 19:16:30 Using config file: /sasstuff/.config/viya4-orders-cli/config.yaml
OrderNumber: 923456
AssetName: deploymentAssets
AssetReqURL: https://api.sas.com/mysas/orders/923456/cadenceNames/lts/deploymentAssets
diff --git a/cmd/root.go b/cmd/root.go
index ad221c9..9707ed7 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -8,7 +8,6 @@ import (
"log"
"os"
- homedir "github.com/mitchellh/go-homedir"
"github.com/sassoftware/viya4-orders-cli/lib/authn"
"github.com/spf13/cobra"
"github.com/spf13/viper"
@@ -48,7 +47,7 @@ func init() {
// Define global flags / options and set their default values.
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "",
- "config file (default is $HOME/.viya4-orders-cli)")
+ "config file (default is $XDG_CONFIG_HOME/viya4-orders-cli/config.yaml)")
rootCmd.PersistentFlags().StringVarP(&assetFileName, "file-name", "n", "",
"name of the file where you want the downloaded order asset stored\n"+
"(defaults:\n\tcerts - SASViyaV4_<order number>_certs.zip\n\tlicense and depassets - SASViyaV4_<order number>_<renewal sequence>_<cadence information>_<asset name>_<date time stamp>."+
@@ -74,16 +73,9 @@ func initConfig() {
// Use config file from the flag.
viper.SetConfigFile(cfgFile)
} else {
- // Find home directory.
- home, err := homedir.Dir()
- if err != nil {
- log.Fatalln("ERROR: homedir.Dir() returned: " + err.Error())
- }
-
- // Search config in home directory with name ".viya4-orders-cli" (without extension).
- viper.AddConfigPath(home)
- viper.SetConfigName(".viya4-orders-cli")
- // If they provide a config file with no extension if must be in yaml format.
+ viper.AddConfigPath("$XDG_CONFIG_HOME/viya4-orders-cli")
+ viper.AddConfigPath("$HOME/.config/viya4-orders-cli")
+ viper.SetConfigName("config")
viper.SetConfigType("yaml")
}
diff --git a/go.mod b/go.mod
index fbb9bb4..5008b3b 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,6 @@ module github.com/sassoftware/viya4-orders-cli
go 1.19
require (
- github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.15.0
golang.org/x/oauth2 v0.5.0
diff --git a/go.sum b/go.sum
index 2f4164a..507c254 100644
--- a/go.sum
+++ b/go.sum
@@ -140,8 +140,6 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
-github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
-github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
diff --git a/lib/authn/authn.go b/lib/authn/authn.go
index a35c405..6345b6f 100644
--- a/lib/authn/authn.go
+++ b/lib/authn/authn.go
@@ -7,10 +7,10 @@ package authn
import (
"context"
- "encoding/base64"
"errors"
"fmt"
"net/url"
+ "os"
"strings"
"github.com/spf13/viper"
@@ -26,15 +26,20 @@ const (
// GetBearerToken calls the /token SAS Viya Orders API endpoint to exchange client credentials for a Bearer token.
// The client credentials are obtained from the SAS API Portal (https://apiportal.sas.com), and should be defined in
-// Viper (https://github.com/spf13/viper) as clientCredentialsId (key) and clientCredentialsSecret (secret).
+// Viper (https://github.com/spf13/viper) as clientCredentialsIdFile (key file) and clientCredentialsSecretFile (secret file).
func GetBearerToken() (token string, err error) {
- id, err := base64.StdEncoding.DecodeString(viper.GetString("clientCredentialsId"))
+ idFile := viper.GetString("clientCredentialsIdFile")
+ secFile := viper.GetString("clientCredentialsSecretFile")
+
+ // read id and sec from the files
+ id, err := os.ReadFile(idFile)
if err != nil {
- return token, errors.New("ERROR: attempt to decode clientCredentialsId failed: " + err.Error())
+ return token, errors.New("ERROR: attempt to read client credentials ID file failed: " + err.Error())
}
- sec, err := base64.StdEncoding.DecodeString(viper.GetString("clientCredentialsSecret"))
+
+ sec, err := os.ReadFile(secFile)
if err != nil {
- return token, errors.New("ERROR: attempt to decode clientCredentialsSecret failed: " + err.Error())
+ return token, errors.New("ERROR: attempt to read client credentials secret file failed: " + err.Error())
}
// Build the request URL.

View File

@@ -0,0 +1,28 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake viya4-orders-cli
pkgs.buildGoModule rec {
pname = "viya4-orders-cli";
version = "1.7.0";
src = pkgs.fetchFromGitHub {
owner = "sassoftware";
repo = "viya4-orders-cli";
rev = version;
hash = "sha256-ccYQHIHT+zR94KL2B51G4J33L7obYUxh+ilDvatW7dI=";
};
vendorHash = "sha256-iDNSV+oYNela4kFtkLppUIL5/hR1dEbPPuOlN5a5MfE=";
patches = [ ./better-config.patch ];
ldflags = [
"-s"
"-w"
"-X github.com/sassoftware/viya4-orders-cli/cmd.version=${version}"
];
installPhase = ''
mkdir -p $out/bin
cp "$GOPATH/bin/viya4-orders-cli" $out/bin/viya4-orders-cli
'';
}