gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: copyright headers


From: gnunet
Subject: [taler-wallet-core] branch master updated: copyright headers
Date: Tue, 12 Apr 2022 20:55:37 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new f3d8b447 copyright headers
f3d8b447 is described below

commit f3d8b4474302a00fd923581046b0f5828a4c5976
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Apr 12 20:55:34 2022 +0200

    copyright headers
---
 packages/anastasis-core/src/crypto.ts              | 16 +++++++++++
 packages/anastasis-core/src/index.ts               | 32 ++++++++++++++++++++++
 packages/anastasis-core/src/provider-types.ts      | 18 ++++++++++--
 packages/anastasis-core/src/reducer-types.ts       | 16 +++++++++++
 packages/anastasis-webui/preact.config.js          | 30 ++++++++++----------
 .../src/components/menu/NavigationBar.tsx          |  8 ++++++
 .../src/hooks/use-anastasis-reducer.ts             | 26 ++----------------
 .../src/context/devContext.ts                      | 23 ++++++++++++++--
 8 files changed, 125 insertions(+), 44 deletions(-)

diff --git a/packages/anastasis-core/src/crypto.ts 
b/packages/anastasis-core/src/crypto.ts
index 37e8c4f5..9f412c6d 100644
--- a/packages/anastasis-core/src/crypto.ts
+++ b/packages/anastasis-core/src/crypto.ts
@@ -1,3 +1,19 @@
+/*
+ This file is part of GNU Anastasis
+ (C) 2021-2022 Anastasis SARL
+
+ GNU Anastasis is free software; you can redistribute it and/or modify it 
under the
+ terms of the GNU Affero General Public License as published by the Free 
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT 
ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
+
+ You should have received a copy of the GNU Affero General Public License 
along with
+ GNU Anastasis; see the file COPYING.  If not, see 
<http://www.gnu.org/licenses/>
+ */
+
 import {
   canonicalJson,
   decodeCrock,
diff --git a/packages/anastasis-core/src/index.ts 
b/packages/anastasis-core/src/index.ts
index 5a9199e0..542e7eaf 100644
--- a/packages/anastasis-core/src/index.ts
+++ b/packages/anastasis-core/src/index.ts
@@ -74,6 +74,7 @@ import {
   DiscoveryResult,
   PolicyMetaInfo,
   ChallengeInfo,
+  AggregatedPolicyMetaInfo,
 } from "./reducer-types.js";
 import fetchPonyfill from "fetch-ponyfill";
 import {
@@ -1451,6 +1452,37 @@ async function updateSecretExpiration(
   });
 }
 
+export function mergeDiscoveryAggregate(
+  newPolicies: PolicyMetaInfo[],
+  oldAgg: AggregatedPolicyMetaInfo[],
+): AggregatedPolicyMetaInfo[] {
+  const aggregatedPolicies: AggregatedPolicyMetaInfo[] = [...oldAgg] ?? [];
+  const polHashToIndex: Record<string, number> = {};
+  for (const pol of newPolicies) {
+    const oldIndex = polHashToIndex[pol.policy_hash];
+    if (oldIndex != null) {
+      aggregatedPolicies[oldIndex].providers.push({
+        provider_url: pol.provider_url,
+        version: pol.version,
+      });
+    } else {
+      aggregatedPolicies.push({
+        attribute_mask: pol.attribute_mask,
+        policy_hash: pol.policy_hash,
+        providers: [
+          {
+            provider_url: pol.provider_url,
+            version: pol.version,
+          },
+        ],
+        secret_name: pol.secret_name,
+      });
+      polHashToIndex[pol.policy_hash] = aggregatedPolicies.length - 1;
+    }
+  }
+  return aggregatedPolicies;
+}
+
 const backupTransitions: Record<
   BackupStates,
   Transition<ReducerStateBackup>
diff --git a/packages/anastasis-core/src/provider-types.ts 
b/packages/anastasis-core/src/provider-types.ts
index fe6292b0..b788f629 100644
--- a/packages/anastasis-core/src/provider-types.ts
+++ b/packages/anastasis-core/src/provider-types.ts
@@ -1,7 +1,21 @@
+/*
+ This file is part of GNU Anastasis
+ (C) 2021-2022 Anastasis SARL
+
+ GNU Anastasis is free software; you can redistribute it and/or modify it 
under the
+ terms of the GNU Affero General Public License as published by the Free 
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT 
ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
+
+ You should have received a copy of the GNU Affero General Public License 
along with
+ GNU Anastasis; see the file COPYING.  If not, see 
<http://www.gnu.org/licenses/>
+ */
+
 import {
-  Amounts,
   AmountString,
-  TalerProtocolDuration,
   TalerProtocolTimestamp,
 } from "@gnu-taler/taler-util";
 
diff --git a/packages/anastasis-core/src/reducer-types.ts 
b/packages/anastasis-core/src/reducer-types.ts
index 47238cd3..7e8d4da2 100644
--- a/packages/anastasis-core/src/reducer-types.ts
+++ b/packages/anastasis-core/src/reducer-types.ts
@@ -1,3 +1,19 @@
+/*
+ This file is part of GNU Anastasis
+ (C) 2021-2022 Anastasis SARL
+
+ GNU Anastasis is free software; you can redistribute it and/or modify it 
under the
+ terms of the GNU Affero General Public License as published by the Free 
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT 
ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
+
+ You should have received a copy of the GNU Affero General Public License 
along with
+ GNU Anastasis; see the file COPYING.  If not, see 
<http://www.gnu.org/licenses/>
+ */
+
 import {
   AmountString,
   buildCodecForObject,
diff --git a/packages/anastasis-webui/preact.config.js 
b/packages/anastasis-webui/preact.config.js
index 8d6da191..f9a8d6cb 100644
--- a/packages/anastasis-webui/preact.config.js
+++ b/packages/anastasis-webui/preact.config.js
@@ -15,31 +15,31 @@
  */
 
 /**
-*
-* @author Sebastian Javier Marchano (sebasjm)
-*/
+ *
+ * @author Sebastian Javier Marchano (sebasjm)
+ */
 
-import { DefinePlugin } from 'webpack';
+import { DefinePlugin } from "webpack";
 
-import pack from './package.json';
-import * as cp from 'child_process';
+import pack from "./package.json";
+import * as cp from "child_process";
 
-const commitHash = cp.execSync('git rev-parse --short HEAD').toString();
+const commitHash = cp.execSync("git rev-parse --short HEAD").toString();
 
 export default {
   webpack(config, env, helpers) {
     // add __VERSION__ to be use in the html
     config.plugins.push(
       new DefinePlugin({
-        'process.env.__VERSION__': JSON.stringify(env.isProd ? pack.version : 
`dev-${commitHash}`),
+        "process.env.__VERSION__": JSON.stringify(
+          env.isProd ? pack.version : `dev-${commitHash}`,
+        ),
       }),
     );
-    const crittersWrapper = helpers.getPluginsByName(config, 'Critters')
+    const crittersWrapper = helpers.getPluginsByName(config, "Critters");
     if (crittersWrapper && crittersWrapper.length > 0) {
-      const [{ index }] = crittersWrapper
-      config.plugins.splice(index, 1)
+      const [{ index }] = crittersWrapper;
+      config.plugins.splice(index, 1);
     }
-
-  }
-}
-
+  },
+};
diff --git a/packages/anastasis-webui/src/components/menu/NavigationBar.tsx 
b/packages/anastasis-webui/src/components/menu/NavigationBar.tsx
index bc6d923d..650ebd99 100644
--- a/packages/anastasis-webui/src/components/menu/NavigationBar.tsx
+++ b/packages/anastasis-webui/src/components/menu/NavigationBar.tsx
@@ -51,6 +51,14 @@ export function NavigationBar({ onMobileMenu, title }: 
Props): VNode {
         >
           Report a bug
         </a>
+        <a
+          style={{
+            alignSelf: "center",
+            padding: "0.5em",
+          }}
+        >
+          Settings
+        </a>
         {/* <a
           role="button"
           class="navbar-burger"
diff --git a/packages/anastasis-webui/src/hooks/use-anastasis-reducer.ts 
b/packages/anastasis-webui/src/hooks/use-anastasis-reducer.ts
index 321cf3f0..b1c17eb9 100644
--- a/packages/anastasis-webui/src/hooks/use-anastasis-reducer.ts
+++ b/packages/anastasis-webui/src/hooks/use-anastasis-reducer.ts
@@ -6,6 +6,7 @@ import {
   DiscoveryCursor,
   getBackupStartState,
   getRecoveryStartState,
+  mergeDiscoveryAggregate,
   PolicyMetaInfo,
   RecoveryStates,
   reduceAction,
@@ -255,30 +256,7 @@ export function useAnastasisReducer(): AnastasisReducerApi 
{
     },
     async discoverStart(): Promise<void> {
       const res = await discoverPolicies(this.currentReducerState!, undefined);
-      const aggregatedPolicies: AggregatedPolicyMetaInfo[] = [];
-      const polHashToIndex: Record<string, number> = {};
-      for (const pol of res.policies) {
-        const oldIndex = polHashToIndex[pol.policy_hash];
-        if (oldIndex != null) {
-          aggregatedPolicies[oldIndex].providers.push({
-            provider_url: pol.provider_url,
-            version: pol.version,
-          });
-        } else {
-          aggregatedPolicies.push({
-            attribute_mask: pol.attribute_mask,
-            policy_hash: pol.policy_hash,
-            providers: [
-              {
-                provider_url: pol.provider_url,
-                version: pol.version,
-              },
-            ],
-            secret_name: pol.secret_name,
-          });
-          polHashToIndex[pol.policy_hash] = aggregatedPolicies.length - 1;
-        }
-      }
+      const aggregatedPolicies = mergeDiscoveryAggregate(res.policies, []);
       setAnastasisState({
         ...anastasisState,
         discoveryState: {
diff --git a/packages/taler-wallet-webextension/src/context/devContext.ts 
b/packages/taler-wallet-webextension/src/context/devContext.ts
index edd52c11..1ce483d8 100644
--- a/packages/taler-wallet-webextension/src/context/devContext.ts
+++ b/packages/taler-wallet-webextension/src/context/devContext.ts
@@ -34,14 +34,31 @@ const Context = createContext<Type>({
 
 export const useDevContext = (): Type => useContext(Context);
 
-export const DevContextProviderForTesting = ({ value, children }: { value: 
boolean, children: any }): VNode => {
-  return h(Context.Provider, { value: { devMode: value, toggleDevMode: () => { 
null } }, children });
+export const DevContextProviderForTesting = ({
+  value,
+  children,
+}: {
+  value: boolean;
+  children: any;
+}): VNode => {
+  return h(Context.Provider, {
+    value: {
+      devMode: value,
+      toggleDevMode: () => {
+        null;
+      },
+    },
+    children,
+  });
 };
 
 export const DevContextProvider = ({ children }: { children: any }): VNode => {
   const [value, setter] = useLocalStorage("devMode");
   const devMode = value === "true";
   const toggleDevMode = (): void => setter((v) => (!v ? "true" : undefined));
-  children = children.length === 1 && typeof children === "function" ? 
children({ devMode }) : children;
+  children =
+    children.length === 1 && typeof children === "function"
+      ? children({ devMode })
+      : children;
   return h(Context.Provider, { value: { devMode, toggleDevMode }, children });
 };

-- 
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]