gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: send api request param as fil


From: gnunet
Subject: [taler-wallet-core] branch master updated: send api request param as file
Date: Mon, 06 Nov 2023 18:09:53 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 78b9f3e4d send api request param as file
78b9f3e4d is described below

commit 78b9f3e4d94af915c7f4480519e937fa5dacf620
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Mon Nov 6 14:09:47 2023 -0300

    send api request param as file
---
 packages/taler-util/src/compat.d.ts     | 1 +
 packages/taler-util/src/compat.node.ts  | 5 +++++
 packages/taler-util/src/compat.qtart.ts | 6 +++++-
 packages/taler-wallet-cli/src/index.ts  | 4 +++-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/packages/taler-util/src/compat.d.ts 
b/packages/taler-util/src/compat.d.ts
index 078f6147b..d7ccf19f0 100644
--- a/packages/taler-util/src/compat.d.ts
+++ b/packages/taler-util/src/compat.d.ts
@@ -20,3 +20,4 @@ export function readlinePrompt(prompt: string): 
Promise<string>;
 export function pathBasename(s: string): string;
 export function setUnhandledRejectionHandler(h: (e: any) => void): void;
 export function getenv(name: string): string | undefined;
+export function readFile(fileName: string): string;
diff --git a/packages/taler-util/src/compat.node.ts 
b/packages/taler-util/src/compat.node.ts
index fb2db2995..2f78c9346 100644
--- a/packages/taler-util/src/compat.node.ts
+++ b/packages/taler-util/src/compat.node.ts
@@ -18,6 +18,7 @@ import process from "node:process";
 import readline from "node:readline";
 import path from "node:path";
 import os from "node:os";
+import fs from "node:fs";
 
 export function processExit(status: number): never {
   process.exit(status);
@@ -57,3 +58,7 @@ export function setUnhandledRejectionHandler(h: (e: any) => 
void): void {
 export function getenv(name: string): string | undefined {
   return process.env[name];
 }
+
+export function readFile(fileName: string): string {
+  return fs.readFileSync(fileName, "utf-8");
+}
diff --git a/packages/taler-util/src/compat.qtart.ts 
b/packages/taler-util/src/compat.qtart.ts
index f8b336b11..7d11cf375 100644
--- a/packages/taler-util/src/compat.qtart.ts
+++ b/packages/taler-util/src/compat.qtart.ts
@@ -29,7 +29,7 @@ export function processArgv(): string[] {
 }
 
 export function readlinePrompt(prompt: string): Promise<string> {
-  throw new Error("not supported");
+  throw new Error("realinePrompt not yet supported in qtart");
 }
 
 export function pathBasename(p: string): string {
@@ -51,3 +51,7 @@ export function setUnhandledRejectionHandler(h: (e: any) => 
void): void {
 export function getenv(name: string): string | undefined {
   return std.getenv(name);
 }
+
+export function readFile(fileName: string): string {
+  throw new Error("readFile not yet supported in qtart");
+}
diff --git a/packages/taler-wallet-cli/src/index.ts 
b/packages/taler-wallet-cli/src/index.ts
index ee6b93381..dddac071b 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -48,6 +48,7 @@ import {
   getenv,
   pathHomedir,
   processExit,
+  readFile,
   readlinePrompt,
   setUnhandledRejectionHandler,
 } from "@gnu-taler/taler-util/compat";
@@ -374,8 +375,9 @@ walletCli
     await withWallet(args, async (wallet) => {
       let requestJson;
       logger.info(`handling 'api' request (${args.api.operation})`);
+      const jsonContent = args.api.request.startsWith("@") ? 
readFile(args.api.request.substring(1)) : args.api.request
       try {
-        requestJson = JSON.parse(args.api.request);
+        requestJson = JSON.parse(jsonContent);
       } catch (e) {
         console.error("Invalid JSON");
         processExit(1);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]