diff --git a/admin/package.json b/admin/package.json index 57711b8be..c649ca752 100644 --- a/admin/package.json +++ b/admin/package.json @@ -4,7 +4,7 @@ "main": "index.js", "author": "Moriz Wahl", "version": "1.8.3", - "license": "MIT", + "license": "Apache-2.0", "private": false, "scripts": { "start": "node run/server.js", diff --git a/backend/log4js-config.json b/backend/log4js-config.json index 1c4b3fb6d..451da56ab 100644 --- a/backend/log4js-config.json +++ b/backend/log4js-config.json @@ -13,6 +13,14 @@ { "type": "dateFile", "filename": "../logs/backend/apollo.log", + "pattern": "%d{ISO8601} %p %c %m", + "keepFileExt" : true, + "fileNameSep" : "_" + }, + "backend": + { + "type": "dateFile", + "filename": "../logs/backend/backend.log", "pattern": "%d{ISO8601} %p %c %X{user} %f:%l %m", "keepFileExt" : true, "fileNameSep" : "_" @@ -31,24 +39,52 @@ "level": "error", "appender": "errorFile" }, - "out": + "out": { "type": "stdout", "layout": { "type": "pattern", "pattern": "%d{ISO8601} %p %c %X{user} %f:%l %m" } - - } + }, + "apolloOut": + { + "type": "stdout", + "layout": + { + "type": "pattern", "pattern": "%d{ISO8601} %p %c %m" + } + } }, - "categories": + "categories": { "default": { "appenders": [ "out", + "errors" + ], + "level": "debug", + "enableCallStack": true + }, + "apollo": + { + "appenders": + [ "apollo", + "apolloOut", + "errors" + ], + "level": "debug", + "enableCallStack": true + }, + "backend": + { + "appenders": + [ + "backend", + "out", "errors" ], "level": "debug", diff --git a/backend/package.json b/backend/package.json index 678e3578a..ff483a0c6 100644 --- a/backend/package.json +++ b/backend/package.json @@ -5,7 +5,7 @@ "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", "author": "Ulf Gebhardt", - "license": "MIT", + "license": "Apache-2.0", "private": false, "scripts": { "build": "tsc --build", diff --git a/backend/src/config/index.test.ts b/backend/src/config/index.test.ts index 3c4c7865e..1dabf9292 100644 --- a/backend/src/config/index.test.ts +++ b/backend/src/config/index.test.ts @@ -3,7 +3,7 @@ import CONFIG from './index' describe('config/index', () => { describe('decay start block', () => { it('has the correct date set', () => { - expect(CONFIG.DECAY_START_TIME).toEqual(new Date('2021-05-13 17:46:31')) + expect(CONFIG.DECAY_START_TIME).toEqual(new Date('2021-05-13 17:46:31-0000')) }) }) }) diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 559b8e9c5..28318ed6b 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -11,7 +11,7 @@ Decimal.set({ const constants = { DB_VERSION: '0036-unique_previous_in_transactions', - DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0 + DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info LOG_LEVEL: process.env.LOG_LEVEL || 'info', diff --git a/backend/src/graphql/arg/UpdateUserInfosArgs.ts b/backend/src/graphql/arg/UpdateUserInfosArgs.ts index d1e95ebef..81c07a329 100644 --- a/backend/src/graphql/arg/UpdateUserInfosArgs.ts +++ b/backend/src/graphql/arg/UpdateUserInfosArgs.ts @@ -19,7 +19,4 @@ export default class UpdateUserInfosArgs { @Field({ nullable: true }) passwordNew?: string - - @Field({ nullable: true }) - coinanimation?: boolean } diff --git a/backend/src/graphql/enum/Setting.ts b/backend/src/graphql/enum/Setting.ts deleted file mode 100644 index 8efeec72d..000000000 --- a/backend/src/graphql/enum/Setting.ts +++ /dev/null @@ -1,5 +0,0 @@ -enum Setting { - COIN_ANIMATION = 'coinanimation', -} - -export { Setting } diff --git a/backend/src/graphql/model/User.ts b/backend/src/graphql/model/User.ts index 4f577f60a..86c56312f 100644 --- a/backend/src/graphql/model/User.ts +++ b/backend/src/graphql/model/User.ts @@ -15,8 +15,6 @@ export class User { this.language = user.language this.publisherId = user.publisherId this.isAdmin = user.isAdmin - // TODO - this.coinanimation = null this.klickTipp = null this.hasElopage = null } @@ -61,11 +59,6 @@ export class User { @Field(() => Date, { nullable: true }) isAdmin: Date | null - // TODO this is a bit inconsistent with what we query from the database - // therefore all those fields are now nullable with default value null - @Field(() => Boolean, { nullable: true }) - coinanimation: boolean | null - @Field(() => KlickTipp, { nullable: true }) klickTipp: KlickTipp | null diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 1afce832b..78b630834 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -344,7 +344,6 @@ describe('UserResolver', () => { expect.objectContaining({ data: { login: { - coinanimation: true, email: 'bibi@bloxberg.de', firstName: 'Bibi', hasElopage: false, @@ -479,7 +478,6 @@ describe('UserResolver', () => { firstName: 'Bibi', lastName: 'Bloxberg', language: 'de', - coinanimation: true, klickTipp: { newsletterState: false, }, diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 7080ad68b..9b42d76b5 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -3,7 +3,7 @@ import { backendLogger as logger } from '@/server/logger' import { Context, getUser } from '@/server/context' import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware, Mutation } from 'type-graphql' -import { getConnection, getCustomRepository } from '@dbTools/typeorm' +import { getConnection } from '@dbTools/typeorm' import CONFIG from '@/config' import { User } from '@model/User' import { User as DbUser } from '@entity/User' @@ -13,8 +13,6 @@ import CreateUserArgs from '@arg/CreateUserArgs' import UnsecureLoginArgs from '@arg/UnsecureLoginArgs' import UpdateUserInfosArgs from '@arg/UpdateUserInfosArgs' import { klicktippNewsletterStateMiddleware } from '@/middleware/klicktippMiddleware' -import { UserSettingRepository } from '@repository/UserSettingRepository' -import { Setting } from '@enum/Setting' import { OptInType } from '@enum/OptInType' import { LoginEmailOptIn } from '@entity/LoginEmailOptIn' import { sendResetPasswordEmail as sendResetPasswordEmailMailer } from '@/mailer/sendResetPasswordEmail' @@ -228,15 +226,6 @@ export class UserResolver { // Elopage Status & Stored PublisherId user.hasElopage = await this.hasElopage(context) - // coinAnimation - const userSettingRepository = getCustomRepository(UserSettingRepository) - const coinanimation = await userSettingRepository - .readBoolean(userEntity.id, Setting.COIN_ANIMATION) - .catch((error) => { - logger.error('error:', error) - throw new Error(error) - }) - user.coinanimation = coinanimation logger.debug(`verifyLogin... successful: ${user.firstName}.${user.lastName}, ${user.email}`) return user } @@ -294,15 +283,6 @@ export class UserResolver { DbUser.save(dbUser) } - // coinAnimation - const userSettingRepository = getCustomRepository(UserSettingRepository) - const coinanimation = await userSettingRepository - .readBoolean(dbUser.id, Setting.COIN_ANIMATION) - .catch((error) => { - throw new Error(error) - }) - user.coinanimation = coinanimation - context.setHeaders.push({ key: 'token', value: encode(dbUser.pubKey), @@ -598,12 +578,10 @@ export class UserResolver { @Mutation(() => Boolean) async updateUserInfos( @Args() - { firstName, lastName, language, password, passwordNew, coinanimation }: UpdateUserInfosArgs, + { firstName, lastName, language, password, passwordNew }: UpdateUserInfosArgs, @Ctx() context: Context, ): Promise { - logger.info( - `updateUserInfos(${firstName}, ${lastName}, ${language}, ***, ***, ${coinanimation})...`, - ) + logger.info(`updateUserInfos(${firstName}, ${lastName}, ${language}, ***, ***)...`) const userEntity = getUser(context) if (firstName) { @@ -655,15 +633,6 @@ export class UserResolver { await queryRunner.startTransaction('READ UNCOMMITTED') try { - if (coinanimation !== null && coinanimation !== undefined) { - queryRunner.manager - .getCustomRepository(UserSettingRepository) - .setOrUpdate(userEntity.id, Setting.COIN_ANIMATION, coinanimation.toString()) - .catch((error) => { - throw new Error('error saving coinanimation: ' + error) - }) - } - await queryRunner.manager.save(userEntity).catch((error) => { throw new Error('error saving user: ' + error) }) diff --git a/backend/src/seeds/graphql/mutations.ts b/backend/src/seeds/graphql/mutations.ts index 4598cbbe2..6e1fe9174 100644 --- a/backend/src/seeds/graphql/mutations.ts +++ b/backend/src/seeds/graphql/mutations.ts @@ -31,7 +31,6 @@ export const updateUserInfos = gql` $password: String $passwordNew: String $locale: String - $coinanimation: Boolean ) { updateUserInfos( firstName: $firstName @@ -39,7 +38,6 @@ export const updateUserInfos = gql` password: $password passwordNew: $passwordNew language: $locale - coinanimation: $coinanimation ) } ` diff --git a/backend/src/seeds/graphql/queries.ts b/backend/src/seeds/graphql/queries.ts index 82067c968..16b2b71ae 100644 --- a/backend/src/seeds/graphql/queries.ts +++ b/backend/src/seeds/graphql/queries.ts @@ -8,7 +8,6 @@ export const login = gql` firstName lastName language - coinanimation klickTipp { newsletterState } @@ -26,7 +25,6 @@ export const verifyLogin = gql` firstName lastName language - coinanimation klickTipp { newsletterState } diff --git a/backend/src/server/logger.ts b/backend/src/server/logger.ts index 939d7eaba..27d0cf75b 100644 --- a/backend/src/server/logger.ts +++ b/backend/src/server/logger.ts @@ -12,7 +12,6 @@ log4js.configure(options) const apolloLogger = log4js.getLogger('apollo') const backendLogger = log4js.getLogger('backend') -apolloLogger.addContext('user', 'unknown') backendLogger.addContext('user', 'unknown') export { apolloLogger, backendLogger } diff --git a/backend/src/server/plugins.ts b/backend/src/server/plugins.ts index f3067d44a..134ca1bb9 100644 --- a/backend/src/server/plugins.ts +++ b/backend/src/server/plugins.ts @@ -32,16 +32,16 @@ const logPlugin = { requestDidStart(requestContext: any) { const { logger } = requestContext const { query, mutation, variables } = requestContext.request - logger.trace(`Request: + logger.info(`Request: ${mutation || query}variables: ${JSON.stringify(filterVariables(variables), null, 2)}`) return { willSendResponse(requestContext: any) { - if (requestContext.context.user) logger.trace(`User ID: ${requestContext.context.user.id}`) + if (requestContext.context.user) logger.info(`User ID: ${requestContext.context.user.id}`) if (requestContext.response.data) - logger.trace(`Response-Data: + logger.info(`Response-Data: ${JSON.stringify(requestContext.response.data, null, 2)}`) if (requestContext.response.errors) - logger.trace(`Response-Errors: + logger.error(`Response-Errors: ${JSON.stringify(requestContext.response.errors, null, 2)}`) return requestContext }, diff --git a/backend/src/typeorm/repository/UserSettingRepository.ts b/backend/src/typeorm/repository/UserSettingRepository.ts index 528090ff2..f911cfd1a 100644 --- a/backend/src/typeorm/repository/UserSettingRepository.ts +++ b/backend/src/typeorm/repository/UserSettingRepository.ts @@ -1,33 +1,22 @@ import { EntityRepository, Repository } from '@dbTools/typeorm' import { UserSetting } from '@entity/UserSetting' -import { Setting } from '@enum/Setting' import { isStringBoolean } from '@/util/validate' @EntityRepository(UserSetting) export class UserSettingRepository extends Repository { - async setOrUpdate(userId: number, key: Setting, value: string): Promise { - switch (key) { - case Setting.COIN_ANIMATION: - if (!isStringBoolean(value)) { - throw new Error("coinanimation value isn't boolean") - } - break - default: - throw new Error("key isn't defined: " + key) - } - let entity = await this.findOne({ userId: userId, key: key }) + async setOrUpdate(userId: number, value: string): Promise { + let entity = await this.findOne({ userId: userId }) if (!entity) { entity = new UserSetting() entity.userId = userId - entity.key = key } entity.value = value return this.save(entity) } - async readBoolean(userId: number, key: Setting): Promise { - const entity = await this.findOne({ userId: userId, key: key }) + async readBoolean(userId: number): Promise { + const entity = await this.findOne({ userId: userId }) if (!entity || !isStringBoolean(entity.value)) { return true } diff --git a/database/package.json b/database/package.json index f5a16fd31..7a960994c 100644 --- a/database/package.json +++ b/database/package.json @@ -5,7 +5,7 @@ "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/database", "author": "Ulf Gebhardt", - "license": "MIT", + "license": "Apache-2.0", "private": false, "scripts": { "build": "mkdir -p build/src/config/ && cp src/config/*.txt build/src/config/ && tsc --build", diff --git a/docu/Concepts/BusinessRequirements/graphics/Creation_Flowchart.drawio b/docu/Concepts/BusinessRequirements/graphics/Creation_Flowchart.drawio new file mode 100644 index 000000000..4c401e10e --- /dev/null +++ b/docu/Concepts/BusinessRequirements/graphics/Creation_Flowchart.drawio @@ -0,0 +1 @@ +7VxbU9s6EP41eaTju5NHEug5D7TDlHZanhhhK45AtjKyQpL++rNy5PgiJ4Rgx4c2M8xgrVe2tN/u6vNKMLAn8eofjuazLyzEdGAZ4WpgXw0syzQNC35JyXojGXqjjSDiJFRKheCO/MZKaCjpgoQ4rSgKxqgg86owYEmCA1GRIc7Zsqo2ZbT61jmKsCa4CxDVpT9JKGZqFq5RyP/FJJqJ7YTVnRjlykqQzlDIliWRfT2wJ5wxsbmKVxNMpfFyu2z6fd5xdzswjhNxSIcoffphXUeTWCx/jtyft/OXr+GFQucF0YWa8MDyKDxvPIMXeJG8+kzZMpghLkARUA5JyOBqwjEShCVp3gHeXPRRUxbr3I4Cr7KnipiCwITLVHD2jCeMMg6ShCWgOZ4SSmuidI4CkkQgcIvWdzYHwQVM2R4vZ0TgO5DLVy3BDUHGXjCf0szcMxKGOAEZZ4skxNIaxnaEoAYj22lRc4sTODhmMRZ8DSqqg+UoaJVv26q5LBzF9pVsVnKSvBtSvhltn1zABxcKwTeg6Tqa3XEI7qyajIsZi1iC6HUhrZml0LlhmY0lVE9YiLWKTbQQrAokXhHxS3b/5KrWfenO1Uo9OWusK9aXg9tve5gLW/AA75m0rbIC4hEWe/RMuxlMjik48kt1IK1DY2uBNmGJ4ORxoYKohlsVlSYXLyHQhi8bw4ovm5buzFtZ2Zm9zpzZ0IxyUmf2D/dmsDFf/yo37ot4kM2iW9bqIAqcU0VB1vWSc7QuKcwZSURaevKtFBTeZTpuLVPW1qqavm0N9+nDxWYEhXdtp/IOh7M/Svb8QP62AbKvrOuZR0AKRG0u704pXl1KCtkuzNYxOH8yHLOM9QVIzNfgzlq3mBMwJub9+UCvLuBbfUR1D1b2jXea+ajMblcpsOm+ktir6q7KuZ3mdWcv9YI7NyR57p+BudUl8n9AwNx+18NjEmUlSZ50QXRPRcDeh6n34TjOB4DU7ZXjHENbO+Y4x3w71XD2rL7pzaHwe1avEa2tbpdhTJLelzPPqzGD3tezoWap7xwlKQqaKzDpksQUbaqSwBfyeJLWC2aEhjdozRZyzKlAwXPeGs8YJ79BHxV1TsSFihnbqGjcyZ7qmRynoHOb29esib6gVUXxBqUiHw2jFM1T8piNT3aMwWVJMmZCsLgSF20SFL+h3Ombrg6oae9BVL3tGw4ESiKYQUEVvdr7hg0OZDQ4UP11iEJ6SJDAYxkCqeZHLVDMkeZaonCtB7GGXFt3L1UQP7QKjiiJEmhSPJXdJJAkQPRSiWMShpvEvqmP32RqV04h+aYM5OyojiuiD2Nzx/ADNpzIxdaFsU6gbRZt+JHqXACNhuEjkrkPBodcYumUsJAIJNDjNlwO8r23fDnurrc3OuA+/3tXRsk3qUq4L1LMH6DTGe7W4fZ6h9vU4A5KX5IPFL4jz9h3gv3oQOw721rzjtla64ZlF0XBLUO+rxDkzj+MTOtDUON8mAdvuv1ZlC8kHGcERIVsOyywvjWzDbkyLRs1peW8Y/s465ur52X4HanY3BG1u2lXM+CdrcN6RbeyDofA9c/Id4B8AwM7LfKWXu0I5DkkHD4g0THkQq7Px+NdB6lF/DvDu4F1NeJteV3h7Wl4xzhmZ6TbRto0vb6h9jWoUQxc+RzW7YPtWD2Dbep5PGYh5kiwM23rCnVv2PfqrVfge6if/I0BPzoQ+u6yu14hB+inhMdn6tYJ5PBd3jPktl4cLyB/XJ8hbx1yt2+67uh0vZLgT7AR9jfi7vfN3R2du3P8hANxjvSOKnB9E3jvmHNknW+HmP7gDRsiXZ8f8g7dJen3iLx/BJItojbo63TfwfBsstvpD1ZX91k857WT1VV9Vx3X6fRodW7DUuK/xzApQ77XMr7qlTp4KJmn0oe6P4JWP0HkmQ0EqekI2rCzXWT9C/hHivmfvhPZApZm/S8HjIZPWqcBy86OE/qN3zfn0yCt1LK8N5/8agS/s1KWr285k2m2JkQppDWOd+J+xF/A5y4QgM0kUdntBE05tbpWZxBtzgRYfkuxuT0Hl6PTdFLTbAceaBb/MmGzjBX/eMK+/g8= \ No newline at end of file diff --git a/docu/Concepts/BusinessRequirements/image/Creation_flowchart.drawio.png b/docu/Concepts/BusinessRequirements/image/Creation_flowchart.drawio.png new file mode 100644 index 000000000..1e5b21d75 Binary files /dev/null and b/docu/Concepts/BusinessRequirements/image/Creation_flowchart.drawio.png differ diff --git a/docu/Concepts/TechnicalRequirements/Federation.md b/docu/Concepts/TechnicalRequirements/Federation.md index 2f4ffc0f9..959aa8afe 100644 --- a/docu/Concepts/TechnicalRequirements/Federation.md +++ b/docu/Concepts/TechnicalRequirements/Federation.md @@ -1,8 +1,10 @@ # Federation -This document contains the concept and technical details for the *federation* of gradido communities. It base on the [ActivityPub specification](https://www.w3.org/TR/activitypub/ " ") and is extended for the gradido requirements. +This document contains the concept and technical details for the *federation* of gradido communities. The first idea of federation was to base on the [ActivityPub specification](https://www.w3.org/TR/activitypub/ " ") and extend it for the gradido requirements. -## ActivityPub +But meanwhile the usage of a DHT like HyperSwarm promises more coverage of the gradido requirements out of the box. More details about HyperSwarm can be found here [@hyperswarm/dht](https://github.com/hyperswarm/dht). + +## ActivityPub (deprecated) The activity pub defines a server-to-server federation protocol to share information between decentralized instances and will be the main komponent for the gradido community federation. @@ -25,8 +27,387 @@ The Variant A with an internal server contains the benefit to be as independent The Varaint B with an external server contains the benefit to reduce the implementation efforts and the responsibility for an own ActivitPub-Server. But it will cause an additional dependency to a third party service provider and the growing hosting costs. +## HyperSwarm +The decision to switch from ActivityPub to HyperSwarm base on the arguments, that the *hyperswarm/dht* library will satify the most federation requirements out of the box. It is now to design the business requirements of the [gradido community communication](../BusinessRequirements/CommunityVerwaltung.md#UC-createCommunity) in a technical conception. -## ActivityStream +The challenge for the decentralized communities of gradido will be *how to become a new community aquainted with an existing community* ? -An ActivityStream includes all definitions and terms needed for community activities and content flow around the gradido community network. +To enable such a relationship between an existing community and a new community several stages has to run through: + +1. Federation + * join&connect + * direct exchange +2. Authentication +3. Autorized Communication + +### Overview + +At first the following diagramm gives an overview of the three stages and shows the handshake between an existing community-A and a new created community-B including the data exchange for buildup such a federated, authenticated and autorized relationship. + +![FederationHyperSwarm.png](./image/FederationHyperSwarm.png) + +### Prerequisits + +Before starting in describing the details of the federation handshake, some prerequisits have to be defined. + +#### Database + +With the federation additional data tables/entities have to be created. + +##### Community-Entity + +Create the new *Community* table to store attributes of the own community. This table is used more like a frame for own community data in the future like the list of federated foreign communities, own users, own futher accounts like AUF- and Welfare-account and the profile data of the own community: + +| Attributes | Type | Description | +| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| id | int | technical unique key of this entity | +| uuid | string | unique key for a community, which will never changed as long as the community exists | +| name | string | name of the community shown on UI e.g for selection of a community | +| description | string | description of the community shown on UI to present more community details | +| ... | | for the near future additional attributes like profile-info, trading-level, set-of-rights,... will follow with the next level of Multi-Community Readyness | + +##### CommunityFederation-Entity + +Create the new *CommunityFederation* table to store at this point of time only the attributes used by the federation handshake: + +| Attributes | Type | Description | +| ---------------- | --------- | ------------------------------------------------------------------------------------------------------ | +| id | int | technical unique key of this entity | +| uuid | string | unique key for a community, which will never changed as long as the community exists | +| foreign | boolean | flag to mark the entry as a foreign or own community entry | +| createdAt | timestamp | the timestamp the community entry was created | +| privateKey | string | the private key of the community for asynchron encryption (only set for the own community) | +| pubKey | string | the public key of the community for asynchron encryption | +| pubKeyVerifiedAt | timestamp | the timestamp the pubkey of this foreign community is verified (for the own community its always null) | +| authenticatedAt | timestamp | the timestamp of the last successfull authentication with this foreign community | +| | | for the near future additional attributes will follow with the next level of Multi-Community Readyness | + +##### CommunityApiVersion-Entity + +Create the new *CommunityApiVersion* table to support several urls and apiversion of one community at once. It references the table *CommunityFederation* with the foreignkey *communityFederationID* (naming pattern foreignkea = `ID`) for a 1:n relationship + +| Attributes | Type | Description | +| --------------------- | --------- | ------------------------------------------------------------------------------------------------------------------ | +| id | int | technical unique key of this entity | +| communityFederationID | int | the technical foreign key to the community entity | +| url | string | the URL the community will provide its services, could be changed during lifetime of the community | +| apiversion | string | the API version the community will provide its services, will increase with each release | +| validFrom | timestamp | the timestamp as of the url and api are provided by the community | +| verifiedAt | timestamp | the timestamp the url and apiversion of this foreign community is verified (for the own community its always null) | + +#### Configuration + +The preparation of a community infrastructure needs some application-outside configuration, which will be read during the start phase of the gradido components. The configuration will be defined in a file based manner like key-value-pairs as properties or in a structured way like xml or json files. + +| Key | Value | Default-Value | Description | +| ----------------------------------------------- | :------------------------------------ | --------------------- | ------------------------------------------------------------------------------------------------- | +| stage.name | dev
stage1
stage2
prod | dev | defines the name of the stage this instance will serve | +| stage.host | | | the name of the host or ip this instance will run | +| stage.mode | test
prod | test | the running mode this instance will work | +| federation.communityname | | Gradido-Akademie | the name of this community | +| federation.apiversion | `` | current 1.7 | defines the current api version this instance will provide its services | +| federation.apiversion.`.`url | |
gdd.gradido.net |
defines the url on which this instance of a community will provide its services | +| federation.apiversion.`.`validFrom | | | defines the timestamp the apiversion is or will be valid | +| federation.dhtnode.topic | | dht_gradido_topic | defines the name of the federation topic, which is used to join and connect as federation-channel | +| federation.dhtnode.host | | | defines the host where the DHT-Node is hosted, if outside apollo | +| federation.dhtnode.port | | | defines the port on which the DHT-node will provide its services, if outside apollo | + +#### 1st Start of a community + +The first time a new community infrastructure on a server is started, the start-phase has to check and prepair the own community database for federation. That means the application has to read the configuration and check against the database, if all current configured data is propagated in the database especially in the *CommunityXXX* entities. + +* check if the*Community* table is empty or if an exisiting community entry is not equals the configured values, then update as follows: + + * community.id = next sequence value + * community.uuid = generated UUID (version 4) + * community.name = Configuration.federation.communityname + * community.description = null +* prepare the *CommunityFederation* table + + * communityFederation.id = next sequence value + * communityFederation.uuid = community.uuid + * communityFederation.foreign = FALSE + * communityFederation.createdAt = NOW + * communityFederation.privateKey = null + * communityFederation.pubKey = null + * communityFederation.pubKeyVerifiedAt = null + * communityFederation.authenticatedAt = null +* prepare the *CommunityApiVersion* table with all configured apiversions: + + * communityApiVersion.id = next sequence value + * communityApiVersion.communityFederationID = communityFederation.id + * communityApiVersion.url = Configuration.federation.apiversion.``.url + * communityApiVersion.apiversion = Configuration.federation.apiversion + * communityApiVersion.validFrom = Configuration.federation.apiversion.``.validFrom + * communityApiVersion.verifiedAt = null + +### Stage1 - Federation + +For the 1st stage the *hyperswarm dht library* will be used. It supports an easy way to connect a new community with other existing communities. As shown in the picture above the *hyperswarm dht library* will be part of the component *DHT-Node* separated from the *apollo server* component. The background for this separation is to keep off the federation activity from the business processes or to enable component specific scaling in the future. In consequence for the inter-component communication between *DHT-Node*, *apollo server* and other components like *database* the interface and security has to be defined during development on using technical standards. + +For the first federation release the *DHT-Node* will be part of the *apollo server*, but internally designed and implemented as a logical saparated component. + +#### Sequence join&connect + +1. In the own database of community_A the entites *Community*, *CommunityFederation* and *CommunityApiVersion* are initialized +2. When starting the *DHT-Node* of community_A it search per *apollo-ORM* for the own community entry and check on existing keypair *CommunityFederation.pubKey* and *CommunityFederation.privateKey* in the database. If they not exist, the *DHT-Node* generates the keypair *pubkey* and *privatekey* and writes them per *apollo-ORM* in the database +3. For joining with the correct channel of *hyperswarm dht* a topic has to be used. The *DHT-Node* reads the configured value of the property *federation.dhtnode.topic*. +4. with the *CommunityFederation.pubKey* and the *federation.dhtnode.topic* the *DHT-Node* joins the *hyperswarm dht* and listen for other *DHT-nodes* on the topic. +5. As soon as a the *hyperswarm dht* notifies an additional node in the topic, the *DHT-node* reads the *pubKey* of this additional node and search it per *apollo-ORM* in the *CommunityFederation* table by filtering with *CommunityFederation.foreign* = TRUE +6. if an entry with the C*ommunityFederation.pubKey* of the foreign node still exists and the *CommunityFederation.pubKeyVerifiedAt* is not NULL both the *DHT-node* and the foreign node had pass through the federation process before. Nevertheless the following steps and stages have to be processed for updating e.g the api versions or other meanwhile changed date. +7. if an entry with the *CommunityFederation.pubKey* of the additional node can't be found, the *DHT-Node* starts with the next step *direct exchange* of the federation handshake anyway. + +#### Sequence direct exchange + +1. if the *CommunityFederation.pubKey* of the additional node does not exists in the *CommunityFederation* table the *DHT-node* starts a *direct exchange* with this foreign node to gets the data the first time, otherwise to update previous exchanged data. +2. the *DHT-node* opens a direct connection per *hyperswarm* with the additional node and exchange respectively the *url* and *apiversion* between each other. + 1. to support the future feature that one community can provide several urls and apiversion at once the exchanged data should be in a format, which can represent structured information, like JSON (or simply CSV - feel free how to implement, but be aware about security aspects to avoid possible attacks during parsing the exchanged data and the used parsers for it) + + ``` + { + "API": + { + "url" : "comB.com", + "version" : "1.0", + "validFrom" : "2022.01.01" + } + "API" : + { + "url" : "comB.com", + "version" : "1.1", + "validFrom" : "2022.04.15" + } + "API" : + { + "url" : "comB.de", + "version" : "2.0", + "validFrom" : "2022.06.01" + } + } + ``` + 2. the *DHT-Node* writes per *apollo-ORM* the received and parsed data from the foreign node in the database + + 1. For the future an optimization step will be introduced here to avoid possible attacks of a foreign node by polute our database with mass of data. + + 1. before the *apollo-ORM* writes the data in the database, the *apollo-graphQL* invokes for all received urls and apiversions at the foreign node the request https.//`//getPubKey()`. + 2. Normally the foreign node will response in a very short time with its publicKey, because there will be nothing to en- or decrypt or other complex processing steps. + 3. if such a request runs in a timeout anyhow, the previous exchanged data with the foreign node will be almost certainly a fake and can be refused without storing in database. Break the further federation processing steps and stages and return back to stage1 join&connect. + 4. if the response is in time the received publicKey must be equals with the pubKey of the foreign node the *DHT-Node* gets from *hyperswarm dht* per topic during the join&connect stage before + 5. if both keys are the same, the writing of the exchanged data per *apollo-ORM* can go on. + 6. if both keys will not match the exchanged data during the direct connection will be almost certainly a fake and can be refused without storing in database. Break the further federation processing steps and stages and return back to stage1 join&connect. + 2. the *apollo-ORM* inserts / updates or deletes the received data as follow + + * insert/update in the *CommunityFederation* table for this foreign node: + + | Column | insert | update | + | ------------------------------------ | -------------------- | :------------------ | + | communityFederation.id | next sequence value | keep existing value | + | communityFederation.uuid | null | keep existing value | + | communityFederation.foreign | TRUE | keep existing value | + | communityFederation.createdAt | NOW | keep existing value | + | communityFederation.privateKey | null | keep existing value | + | communityFederation.pubKey | exchangedData.pubKey | keep existing value | + | communityFederation.pubKeyVerifiedAt | null | keep existing value | + | communityFederation.authenticatedAt | null | keep existing value | + * for each exchangedData API + + if API not exists in database then insert in the *CommunityApiVersion* table: + + | Column | insert | + | ----------------------------------------- | --------------------------- | + | communityApiVersion.id | next sequence value | + | communityApiVersion.communityFederationID | communityFederation.id | + | communityApiVersion.url | exchangedData.API.url | + | communityApiVersion.apiversion | exchangedData.API.version | + | communityApiVersion.validFrom | exchangedData.API.validFrom | + | communityApiVersion.verifiedAt | null | + + if API exists in database but was not part of the last data exchange, then delete it from the *CommunityApiVersion* table + + if API exists in database and was part of the last data exchange, then update it in the *CommunityApiVersion* table + + | Column | update | + | ----------------------------------------- | --------------------------- | + | communityApiVersion.id | keep existing value | + | communityApiVersion.communityFederationID | keep existing value | + | communityApiVersion.url | keep existing value | + | communityApiVersion.apiversion | keep existing value | + | communityApiVersion.validFrom | exchangedData.API.validFrom | + | communityApiVersion.verifiedAt | keep existing value | + * + 3. After all received data is stored successfully, the *DHT-Node* starts the *stage2 - Authentication* of the federation handshake + +### Stage2 - Authentication + +The 2nd stage of federation is called *authentication*, because during the 1st stage the *hyperswarm dht* only ensures the knowledge that one node is the owner of its keypairs *pubKey* and *privateKey*. The exchanged data between two nodes during the *direct exchange* on the *hyperswarm dht channel* must be verified, means ensure if the proclaimed *url(s)* and *apiversion(s)* of a node is the correct address to reach the same node outside the hyperswarm infrastructure. + +As mentioned before the *DHT-node* invokes the *authentication* stage on *apollo server* *graphQL* with the previous stored data of the foreign node. + +#### Sequence - view of existing Community + +1. the authentication stage starts by reading for the *foreignNode* from the previous federation step all necessary data + 1. select with the *foreignNode.pubKey* from the tables *CommunityFederation* and *CommunityApiVersion* where *CommunityApiVersion.validFrom* <= NOW and *CommunityApiVersion.verifiedAt* = null + 2. the resultSet will be a list of data with the following attributes + * foreignNode.pubKey + * foreignNode.url + * foreignNode.apiVersion +2. read the own keypair and uuid by `select uuid, privateKey, pubKey from CommunityFederation cf where cf.foreign = FALSE` +3. for each entry of the resultSet from step 1 do + 1. encryptedURL = encrypting the *foreignNode.url* and *foreignNode.apiVersion* with the *foreignNode.pubKey* + 2. signedAndEncryptedURL = sign the result of the encryption with the own *privateKey* + 3. invoke the request `https:////openConnection(own.pubKey, signedAndEncryptedURL )` + 4. the foreign node will response immediately with an empty response OK, otherwise break the authentication stage with an error +4. the foreign node will process the request on its side - see [description below](#Sequence - view of new Community) - and invokes a redirect request base on the previous exchanged data during stage1 - Federation. This could be more than one redirect request depending on the amount of supported urls and apiversions we propagate to the foreignNode before. + 1. if the other community will not react with an `openConnectionRedirect`-request, ther will be an error like missmatching data and the further federation processing will end and go back to join&connect. +5. for each received request `https:////openConnectionRedirect(onetimecode, foreignNode.url, encryptedRedirectURL )` do + 1. with the given parameter the following steps will be done + 1. search for the *foreignNode.pubKey* by `select cf.pubKey from CommunityApiVersion cav, CommunityFederation cf where cav.url = foreignNode.url and cav.communityFederationID = cf.id` + 2. decrypt with the `own.privateKey` the received `encryptedRedirectURL` parameter, which contains a full qualified url inc. apiversion and route + 3. verify signature of `encryptedRedirectURL` with the previous found *foreignNode.pubKey* from the own database + 4. if the decryption and signature verification are successful then encrypt the *own.uuid* with the *own.privateKey* to *encryptedOwnUUID* + 5. invoke the redirect request with https://`(onetimecode, encryptedOwnUUID)` and + 6. wait for the response with the `encryptedForeignUUID` + 7. decrypt the `encrpytedForeignUUID` with the *foreignNode.pubKey* + 8. write the encrypted *foreignNode.UUID* in the database by updating the CommunityFederation table per `update CommunityFederation cf set values (cf.uuid = foreignNode.UUID, cf.pubKeyVerifiedAt = NOW) where cf.pubKey = foreignNode.pubkey` + +After all redirect requests are process, all relevant authentication data of the new community are well know here and stored in the database. + +#### Sequence - view of new Community + +This chapter contains the description of the Authentication Stage on the new community side as the request `openConnection(pubKey, signedAndEncryptedURL)` + +As soon the *openConnection* request is invoked: + +1. decrypted the 2nd `parameter.signedAndEncryptedURL` with the own *privatKey* +2. with the 1st parameter *pubKey* search in the own database `select uuid, url, pubKey from CommunityFederation cf where cf.foreign = TRUE and cf.pubKey = parameter.pubKey` +3. check if the decrypted `parameter.signedAndEncryptedURL` is equals the selected url from the previous selected CommunityFederationEntry + 1. if not then break the further processing of this request by only writing an error-log event. There will be no answer to the invoker community, because this community will only go on with a `openConnectionRedirect`-request from this community. + 2. if yes then verify the signature of `parameter.signedAndEncryptedURL` with the `cf.pubKey` read in step 2 before + 3. +4. + +### Stage3 - Autorized Business Communication + +ongoing + +# Review von Ulf + +## Communication concept + +The communication happens in 4 stages. + +- Stage1: Federation +- Stage2: Direct-Connection +- Stage3: GraphQL-Verification +- Stage4: GraphQL-Content + +### Stage1 - Federation + +Using the hyperswarm dht library we can find eachother easily and exchange a pubKey and data of which we know that the other side owns the private key of. + +``` +ComA ---- announce ----> DHT +ComB <--- listen ------- DHT +``` + +Each peer will know the `pubKey` of the other participants. Furthermore a direct connection is possible. + +``` +ComB ---- connect -----> ComA +ComB ---- data --------> ComA +``` + +### Stage2 - Direct-Connection + +The hyperswarm dht library offers a secure channel based on the exchanged `pubKey` so we do not need to verify things. + +The Idea is now to exchange the GraphQL Endpoints and their corresponding versions API versions in form of json + +``` +{ + "API": { + "1.0": "https://comB.com/api/1.0/", + "1.1": "https://comB.com/api/1.1/", + "2.4": "https://comB.de/api/2.4/" + } +} +``` + +### Stage3 - GraphQL-Verification + +The task of Stage3 is to verify that the collected data through the two Federation Stages are correct, since we did not verify yet that the proclaimed URL is actually the guy we talked to in the federation. Furthermore the sender must be verified to ensure the queried community does not reveal things to a third party not authorized. + +``` +ComA ----- verify -----> ComB +ComA <---- authorize --- ComB +``` + +Assuming this Dataset on ComA after a federation (leaving out multiple API endpoints to simplify things): + +``` +| PubKey | API-Endpoint | PubKey Verified On | +|--------|---------------|--------------------| +| PubA* | ComA.com/api/ | NULL | +| PubB | ComB.com/api/ | NULL | +| PubC | ComB.com/api/ | NULL | + +* = self +``` + +using the GraphQL Endpoint to query things: + +``` +ComA ---- getPubKey ---> ComB.com +ComA <--- PubB --------- ComB.com + +ComA UPDATE database SET pubKeyVerifiedOn = now WHERE API-Endpoint=queryURL AND PubKey=QueryResult +``` + +resulting in: + +``` +| PubKey | API-Endpoint | PubKey Verified On | +|--------|---------------|--------------------| +| PubA* | ComA.com/api/ | 1.1.1970 | +| PubB | ComB.com/api/ | NOW | +| PubC | ComB.com/api/ | NULL | +``` + +Furthermore we use the Header to transport a proof of who the caller is when calling and when answering: + +``` +ComA ---- getPubKey, sign({pubA, crypt(timeToken,pubB)},privA) --> ComB.com +ComB: is pubA known to me? +ComB: is the signature correct? +ComB: can I decrypt payload? +ComB: is timeToken <= 10sec? +ComA <----- PubB, sign({timeToken}, privB) ----------------------- ComB.com +ComA: is timeToken correct? +ComA: is signature correct? +``` + +This process we call authentication and can result in several errors: + +1. Your pubKey was not known to me +2. Your signature is incorrect +3. I cannot decrypt your payload +4. Token Timeout (recoverable) +5. Result token was incorrect +6. Result signature was incorrect + +``` +| PubKey | API-Endpoint | PubKey Verified On | AuthenticationLastSuccess | +|--------|---------------|--------------------|----------------------------| +| PubA* | ComA.com/api/ | 1.1.1970 | 1.1.1970 | +| PubB | ComB.com/api/ | NOW | NOW | +| PubC | ComB.com/api/ | NULL | NULL | +``` + +The next process is the authorization. This happens on every call on the receiver site to determine which call is allowed for the other side. + +``` +ComA ---- getPubKey, sign({pubA, crypt(timeToken,pubB)},privA) --> ComB.com +ComB: did I verify pubA? SELECT PubKeyVerifiedOn FROm database WHERE PubKey = pubA +ComB: is pubA allowed to query this? +``` diff --git a/docu/Concepts/TechnicalRequirements/graphics/FederationHyperSwarm.drawio b/docu/Concepts/TechnicalRequirements/graphics/FederationHyperSwarm.drawio new file mode 100644 index 000000000..b5f120f52 --- /dev/null +++ b/docu/Concepts/TechnicalRequirements/graphics/FederationHyperSwarm.drawio @@ -0,0 +1,650 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docu/Concepts/TechnicalRequirements/image/FederationHyperSwarm.png b/docu/Concepts/TechnicalRequirements/image/FederationHyperSwarm.png new file mode 100644 index 000000000..526da1721 Binary files /dev/null and b/docu/Concepts/TechnicalRequirements/image/FederationHyperSwarm.png differ diff --git a/docu/Style/Images/Bild_1_1920.jpg b/docu/Style/Images/Bild_1_1920.jpg new file mode 100644 index 000000000..561e49f57 Binary files /dev/null and b/docu/Style/Images/Bild_1_1920.jpg differ diff --git a/docu/Style/Images/Bild_1_2400.jpg b/docu/Style/Images/Bild_1_2400.jpg new file mode 100644 index 000000000..834ec73df Binary files /dev/null and b/docu/Style/Images/Bild_1_2400.jpg differ diff --git a/docu/Style/Images/Bild_2_1920.jpg b/docu/Style/Images/Bild_2_1920.jpg new file mode 100644 index 000000000..db13280c8 Binary files /dev/null and b/docu/Style/Images/Bild_2_1920.jpg differ diff --git a/docu/Style/Images/Bild_2_2400.jpg b/docu/Style/Images/Bild_2_2400.jpg new file mode 100644 index 000000000..fc66d9bed Binary files /dev/null and b/docu/Style/Images/Bild_2_2400.jpg differ diff --git a/docu/Style/Images/Bild_3_1920.jpg b/docu/Style/Images/Bild_3_1920.jpg new file mode 100644 index 000000000..1ff4fbc9a Binary files /dev/null and b/docu/Style/Images/Bild_3_1920.jpg differ diff --git a/docu/Style/Images/Bild_3_2400.jpg b/docu/Style/Images/Bild_3_2400.jpg new file mode 100644 index 000000000..d81b4c3f4 Binary files /dev/null and b/docu/Style/Images/Bild_3_2400.jpg differ diff --git a/docu/graphics/brainstorm-gradido.drawio b/docu/graphics/brainstorm-gradido.drawio new file mode 100644 index 000000000..c6fb1c9a4 --- /dev/null +++ b/docu/graphics/brainstorm-gradido.drawio @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docu/other/Contribution/contribution-mockup-konzept.odt b/docu/other/Contribution/contribution-mockup-konzept.odt new file mode 100644 index 000000000..9644062f9 Binary files /dev/null and b/docu/other/Contribution/contribution-mockup-konzept.odt differ diff --git a/docu/other/Contribution/contribution-mockup-konzept.pdf b/docu/other/Contribution/contribution-mockup-konzept.pdf new file mode 100644 index 000000000..14b63d2c0 Binary files /dev/null and b/docu/other/Contribution/contribution-mockup-konzept.pdf differ diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 5127fc1cc..f32eca810 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -45,7 +45,6 @@ module.exports = { extensions: ['.js', '.vue'], // TODO: remove ignores ignores: [ - '/site.thx./', '/form./', '/time./', '/decay.types./', @@ -55,7 +54,6 @@ module.exports = { 'settings.password.set', 'settings.password.set-password.text', 'settings.password.subtitle', - 'site.login.signin', ], enableFix: false, }, diff --git a/frontend/package.json b/frontend/package.json index 68c4aca84..ae5dca33c 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -99,5 +99,6 @@ "not ie <= 10" ], "author": "Gradido-Akademie - https://www.gradido.net/", + "license": "Apache-2.0", "description": "Gradido, the Natural Economy of Life, is a way to worldwide prosperity and peace in harmony with nature. - Gradido, die Natürliche Ökonomie des lebens, ist ein Weg zu weltweitem Wohlstand und Frieden in Harmonie mit der Natur." } diff --git a/frontend/public/img/template/Foto_01_2400_small.jpg b/frontend/public/img/template/Foto_01_2400_small.jpg index 90b24d99a..834ec73df 100644 Binary files a/frontend/public/img/template/Foto_01_2400_small.jpg and b/frontend/public/img/template/Foto_01_2400_small.jpg differ diff --git a/frontend/public/img/template/Foto_02_2400_small.jpg b/frontend/public/img/template/Foto_02_2400_small.jpg index 48489347f..fc66d9bed 100644 Binary files a/frontend/public/img/template/Foto_02_2400_small.jpg and b/frontend/public/img/template/Foto_02_2400_small.jpg differ diff --git a/frontend/public/img/template/Foto_03_2400_small.jpg b/frontend/public/img/template/Foto_03_2400_small.jpg index b6f6829c7..d81b4c3f4 100644 Binary files a/frontend/public/img/template/Foto_03_2400_small.jpg and b/frontend/public/img/template/Foto_03_2400_small.jpg differ diff --git a/frontend/public/img/template/Foto_04_2400_small.jpg b/frontend/public/img/template/Foto_04_2400_small.jpg deleted file mode 100644 index 958824ddc..000000000 Binary files a/frontend/public/img/template/Foto_04_2400_small.jpg and /dev/null differ diff --git a/frontend/src/assets/scss/gradido-template.scss b/frontend/src/assets/scss/gradido-template.scss index 97118ca2b..09c8588e9 100644 --- a/frontend/src/assets/scss/gradido-template.scss +++ b/frontend/src/assets/scss/gradido-template.scss @@ -17,10 +17,17 @@ body { /* Navbar */ a, -.navbar-light .navbar-nav .nav-link { +.navbar-light, +.navbar-nav, +.nav-link { color: #047006; } +a:hover, +.nav-link:hover { + color: #383838 !important; +} + .navbar-light .navbar-nav .nav-link.active { color: rgb(35 121 188 / 90%); } @@ -36,31 +43,58 @@ a, /* Button */ .btn { border-radius: 25px; - padding-right: 50px; - padding-left: 50px; } .btn-gradido { - background-image: linear-gradient(146deg, rgb(220 167 44) 50%, rgb(197 141 56 / 100%) 100%); - background-size: auto; - background-position: 0% 0%; - background-repeat: repeat; - border-style: none; - box-shadow: 10px 10px 50px 10px rgb(56 56 56 / 31%); + display: inline-block; + padding: 0.6em 3em; + letter-spacing: 0.05em; color: #fff; + transition: all 0.5s ease; + background: rgb(249 205 105); + background: linear-gradient(135deg, rgb(249 205 105 / 100%) 2%, rgb(197 141 56 / 100%) 55%); + box-shadow: rgb(0 0 0 / 40%) 0 30px 90px; + border-radius: 26px; + padding-right: 50px; + padding-left: 50px; + border-style: none; } .btn-gradido:hover { - color: #212529; + color: #fff; + box-shadow: 0 5px 10px rgb(0 0 0 / 20%); } .btn-gradido:focus { outline: none; } +.btn-gradido-disable { + padding: 0.6em 3em; + letter-spacing: 0.05em; + color: #fff; + transition: all 0.5s ease; + background: rgb(97 97 97); + background: linear-gradient(135deg, rgb(180 180 180 / 100%) 46%, rgb(180 180 180 / 100%) 99%); + box-shadow: rgb(0 0 0 / 40%) 0 30px 90px; + border-radius: 26px; + padding-right: 50px; + padding-left: 50px; + border-style: none; +} + +.btn-gradido-disable:hover { + color: #fff; +} + .btn-outline-gradido { color: rgb(140 121 88); border: 1px solid #f5b805; + box-shadow: 10px 10px 50px 10px rgb(56 56 56 / 31%); +} + +.btn-outline-gradido:hover { + box-shadow: 10px 10px 50px 10px rgb(56 56 56 / 0%); } .form-control, diff --git a/frontend/src/components/Auth/Carousel.vue b/frontend/src/components/Auth/AuthCarousel.vue similarity index 70% rename from frontend/src/components/Auth/Carousel.vue rename to frontend/src/components/Auth/AuthCarousel.vue index d46352c59..db3037828 100644 --- a/frontend/src/components/Auth/Carousel.vue +++ b/frontend/src/components/Auth/AuthCarousel.vue @@ -1,10 +1,9 @@ @@ -25,5 +24,10 @@ export default { .carousel-inner { height: 100%; border-radius: 0% 49% 49% 0% / 0% 51% 49% 0%; + -webkit-border-radius: 0% 49% 49% 0% / 0% 51% 49% 0%; + backface-visibility: hidden; + -webkit-backface-visibility: hidden; + transform: translate3d(0, 0, 0); + -webkit-transform: translate3d(0, 0, 0); } diff --git a/frontend/src/components/Auth/AuthFooter.vue b/frontend/src/components/Auth/AuthFooter.vue new file mode 100644 index 000000000..d74593e36 --- /dev/null +++ b/frontend/src/components/Auth/AuthFooter.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/frontend/src/components/Auth/MobileStart.vue b/frontend/src/components/Auth/AuthMobileStart.vue similarity index 87% rename from frontend/src/components/Auth/MobileStart.vue rename to frontend/src/components/Auth/AuthMobileStart.vue index b6bfcbc2d..7b11df0f3 100644 --- a/frontend/src/components/Auth/MobileStart.vue +++ b/frontend/src/components/Auth/AuthMobileStart.vue @@ -9,36 +9,36 @@ {{ $t('auth.left.newCurrency') }}
- + {{ $t('signup') }}
@@ -46,7 +46,7 @@ {{ $t('auth.left.hereLogin') }} @@ -58,6 +58,9 @@ diff --git a/frontend/src/components/Auth/Navbar.vue b/frontend/src/components/Auth/AuthNavbar.vue similarity index 92% rename from frontend/src/components/Auth/Navbar.vue rename to frontend/src/components/Auth/AuthNavbar.vue index ffef864fe..7b3eed0e3 100644 --- a/frontend/src/components/Auth/Navbar.vue +++ b/frontend/src/components/Auth/AuthNavbar.vue @@ -10,7 +10,7 @@ /> @@ -37,8 +37,8 @@ export default { name: 'AuthNavbar', data() { return { - logo: 'img/brand/green.png', - sheet: 'img/template/Blaetter.png', + logo: '/img/brand/green.png', + sheet: '/img/template/Blaetter.png', } }, } diff --git a/frontend/src/components/Auth/NavbarSmall.vue b/frontend/src/components/Auth/AuthNavbarSmall.vue similarity index 93% rename from frontend/src/components/Auth/NavbarSmall.vue rename to frontend/src/components/Auth/AuthNavbarSmall.vue index 1bb06b481..836e72aeb 100644 --- a/frontend/src/components/Auth/NavbarSmall.vue +++ b/frontend/src/components/Auth/AuthNavbarSmall.vue @@ -12,6 +12,6 @@ diff --git a/frontend/src/components/Auth/Footer.vue b/frontend/src/components/Auth/Footer.vue deleted file mode 100644 index 02268f4f6..000000000 --- a/frontend/src/components/Auth/Footer.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - - - diff --git a/frontend/src/components/Message/Message.spec.js b/frontend/src/components/Message/Message.spec.js index 7b28d83fd..2ac5bf29d 100644 --- a/frontend/src/components/Message/Message.spec.js +++ b/frontend/src/components/Message/Message.spec.js @@ -4,8 +4,8 @@ import Message from './Message' const localVue = global.localVue const propsData = { - headline: 'site.thx.title', - subtitle: 'site.thx.email', + headline: 'Headline text', + subtitle: 'Subtitle text', buttonText: 'login', linkTo: '/login', } @@ -32,8 +32,8 @@ describe('Message', () => { describe('with button', () => { it('renders title, subtitle, and button text', () => { - expect(wrapper.find('.test-message-headline').text()).toBe('site.thx.title') - expect(wrapper.find('.test-message-subtitle').text()).toBe('site.thx.email') + expect(wrapper.find('.test-message-headline').text()).toBe('Headline text') + expect(wrapper.find('.test-message-subtitle').text()).toBe('Subtitle text') expect(wrapper.find('.test-message-button').text()).toBe('login') }) @@ -51,8 +51,8 @@ describe('Message', () => { }) it('renders title, subtitle, and button text', () => { - expect(wrapper.find('.test-message-headline').text()).toBe('site.thx.title') - expect(wrapper.find('.test-message-subtitle').text()).toBe('site.thx.email') + expect(wrapper.find('.test-message-headline').text()).toBe('Headline text') + expect(wrapper.find('.test-message-subtitle').text()).toBe('Subtitle text') }) it('button is not shown', () => { diff --git a/frontend/src/components/UserSettings/UserCoinAnimation.spec.js b/frontend/src/components/UserSettings/UserCoinAnimation.spec.js deleted file mode 100644 index aabf927fb..000000000 --- a/frontend/src/components/UserSettings/UserCoinAnimation.spec.js +++ /dev/null @@ -1,127 +0,0 @@ -import { mount } from '@vue/test-utils' -import UserCoinAnimation from './UserCoinAnimation' -import { updateUserInfos } from '@/graphql/mutations' - -import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup' - -const localVue = global.localVue - -const mockAPIcall = jest.fn() - -const storeCommitMock = jest.fn() - -describe('UserCard_CoinAnimation', () => { - let wrapper - - const mocks = { - $t: jest.fn((t) => t), - $store: { - state: { - language: 'de', - coinanimation: true, - }, - commit: storeCommitMock, - }, - $apollo: { - mutate: mockAPIcall, - }, - } - - const Wrapper = () => { - return mount(UserCoinAnimation, { localVue, mocks }) - } - - describe('mount', () => { - beforeEach(() => { - jest.clearAllMocks() - wrapper = Wrapper() - }) - - it('renders the component', () => { - expect(wrapper.find('div#formusercoinanimation').exists()).toBeTruthy() - }) - - it('has an edit BFormCheckbox switch', () => { - expect(wrapper.find('.Test-BFormCheckbox').exists()).toBeTruthy() - }) - - describe('enable with success', () => { - beforeEach(async () => { - await wrapper.setData({ CoinAnimationStatus: false }) - mockAPIcall.mockResolvedValue({ - data: { - updateUserInfos: { - validValues: 1, - }, - }, - }) - await wrapper.find('input').setChecked() - }) - - it('calls the updateUserInfos mutation', () => { - expect(mockAPIcall).toBeCalledWith({ - mutation: updateUserInfos, - variables: { - coinanimation: true, - }, - }) - }) - - it('updates the store', () => { - expect(storeCommitMock).toBeCalledWith('coinanimation', true) - }) - - it('toasts a success message', () => { - expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.True') - }) - }) - - describe('disable with success', () => { - beforeEach(async () => { - await wrapper.setData({ CoinAnimationStatus: true }) - mockAPIcall.mockResolvedValue({ - data: { - updateUserInfos: { - validValues: 1, - }, - }, - }) - await wrapper.find('input').setChecked(false) - }) - - it('calls the subscribe mutation', () => { - expect(mockAPIcall).toBeCalledWith({ - mutation: updateUserInfos, - variables: { - coinanimation: false, - }, - }) - }) - - it('updates the store', () => { - expect(storeCommitMock).toBeCalledWith('coinanimation', false) - }) - - it('toasts a success message', () => { - expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.False') - }) - }) - - describe('disable with server error', () => { - beforeEach(() => { - mockAPIcall.mockRejectedValue({ - message: 'Ouch', - }) - wrapper.find('input').trigger('change') - }) - - it('resets the CoinAnimationStatus', () => { - expect(wrapper.vm.CoinAnimationStatus).toBeTruthy() - }) - - it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith('Ouch') - }) - }) - }) -}) diff --git a/frontend/src/components/UserSettings/UserCoinAnimation.vue b/frontend/src/components/UserSettings/UserCoinAnimation.vue deleted file mode 100644 index 040825105..000000000 --- a/frontend/src/components/UserSettings/UserCoinAnimation.vue +++ /dev/null @@ -1,65 +0,0 @@ - - diff --git a/frontend/src/components/UserSettings/UserPassword.spec.js b/frontend/src/components/UserSettings/UserPassword.spec.js index 59ec65bd7..14df1f41f 100644 --- a/frontend/src/components/UserSettings/UserPassword.spec.js +++ b/frontend/src/components/UserSettings/UserPassword.spec.js @@ -189,7 +189,7 @@ describe('UserCard_FormUserPasswort', () => { }) it('toasts a success message', () => { - expect(toastSuccessSpy).toBeCalledWith('site.thx.reset') + expect(toastSuccessSpy).toBeCalledWith('message.reset') }) it('cancels the edit process', () => { diff --git a/frontend/src/components/UserSettings/UserPassword.vue b/frontend/src/components/UserSettings/UserPassword.vue index 430f9a75d..0ba1576e8 100644 --- a/frontend/src/components/UserSettings/UserPassword.vue +++ b/frontend/src/components/UserSettings/UserPassword.vue @@ -89,7 +89,7 @@ export default { }, }) .then(() => { - this.toastSuccess(this.$t('site.thx.reset')) + this.toastSuccess(this.$t('message.reset')) this.cancelEdit() }) .catch((error) => { diff --git a/frontend/src/graphql/mutations.js b/frontend/src/graphql/mutations.js index 672af5f04..9b035cba6 100644 --- a/frontend/src/graphql/mutations.js +++ b/frontend/src/graphql/mutations.js @@ -31,7 +31,6 @@ export const updateUserInfos = gql` $password: String $passwordNew: String $locale: String - $coinanimation: Boolean ) { updateUserInfos( firstName: $firstName @@ -39,7 +38,6 @@ export const updateUserInfos = gql` password: $password passwordNew: $passwordNew language: $locale - coinanimation: $coinanimation ) } ` diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 2bd905e5e..601880a51 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -7,7 +7,6 @@ export const login = gql` firstName lastName language - coinanimation klickTipp { newsletterState } @@ -25,7 +24,6 @@ export const verifyLogin = gql` firstName lastName language - coinanimation klickTipp { newsletterState } diff --git a/frontend/src/layouts/AuthLayout.spec.js b/frontend/src/layouts/AuthLayout.spec.js index dd2d2cab3..2246793d5 100644 --- a/frontend/src/layouts/AuthLayout.spec.js +++ b/frontend/src/layouts/AuthLayout.spec.js @@ -43,6 +43,10 @@ describe('AuthLayout', () => { it('has Component AuthMobileStart', () => { expect(wrapper.findComponent({ name: 'AuthMobileStart' }).exists()).toBe(true) }) + + it('has Component AuthNavbarSmall', () => { + expect(wrapper.findComponent({ name: 'AuthNavbarSmall' }).exists()).toBe(true) + }) }) describe('Desktop Version Start', () => { diff --git a/frontend/src/layouts/AuthLayout.vue b/frontend/src/layouts/AuthLayout.vue index 1cc4923d1..024d56906 100644 --- a/frontend/src/layouts/AuthLayout.vue +++ b/frontend/src/layouts/AuthLayout.vue @@ -1,16 +1,16 @@ diff --git a/frontend/src/pages/thx.spec.js b/frontend/src/pages/thx.spec.js deleted file mode 100644 index a9d5ba3b7..000000000 --- a/frontend/src/pages/thx.spec.js +++ /dev/null @@ -1,101 +0,0 @@ -import { mount } from '@vue/test-utils' -import Thx from './thx' - -const localVue = global.localVue - -const createMockObject = (comingFrom) => { - return { - $t: jest.fn((t) => t), - $route: { - params: { - comingFrom, - }, - }, - } -} - -describe('Thx', () => { - let wrapper - - const Wrapper = (mocks) => { - return mount(Thx, { localVue, mocks }) - } - - describe('mount', () => { - beforeEach(() => { - wrapper = Wrapper(createMockObject('forgotPassword')) - }) - - it('renders the thx page', () => { - expect(wrapper.find('div.header').exists()).toBeTruthy() - }) - - it('renders the title', () => { - expect(wrapper.find('p.h1').text()).toBe('site.thx.title') - }) - }) - - describe('coming from /forgot-password', () => { - beforeEach(() => { - wrapper = Wrapper(createMockObject('forgotPassword')) - }) - - it('renders the thanks text', () => { - expect(wrapper.find('p.h4').text()).toBe('site.thx.email') - }) - - it('renders the thanks redirect button', () => { - expect(wrapper.find('a.btn').text()).toBe('login') - }) - - it('links the redirect button to /login', () => { - expect(wrapper.find('a.btn').attributes('href')).toBe('/login') - }) - }) - - describe('coming from /reset-password', () => { - beforeEach(() => { - wrapper = Wrapper(createMockObject('resetPassword')) - }) - - it('renders the thanks text', () => { - expect(wrapper.find('p.h4').text()).toBe('site.thx.reset') - }) - - it('renders the thanks redirect button', () => { - expect(wrapper.find('a.btn').text()).toBe('login') - }) - - it('links the redirect button to /login', () => { - expect(wrapper.find('a.btn').attributes('href')).toBe('/login') - }) - }) - - describe('coming from /register', () => { - beforeEach(() => { - wrapper = Wrapper(createMockObject('register')) - }) - - it('renders the thanks text', () => { - expect(wrapper.find('p.h4').text()).toBe('site.thx.register') - }) - }) - - describe('coming from /login', () => { - beforeEach(() => { - wrapper = Wrapper(createMockObject('login')) - }) - - it('renders the thanks text', () => { - expect(wrapper.find('p.h4').text()).toBe('site.thx.activateEmail') - }) - - it('renders the thanks redirect button', () => { - expect(wrapper.find('a.btn').text()).toBe('settings.password.reset') - }) - - it('links the redirect button to /forgot-password', () => { - expect(wrapper.find('a.btn').attributes('href')).toBe('/forgot-password') - }) - }) -}) diff --git a/frontend/src/pages/thx.vue b/frontend/src/pages/thx.vue deleted file mode 100644 index 7e203e8aa..000000000 --- a/frontend/src/pages/thx.vue +++ /dev/null @@ -1,76 +0,0 @@ - - diff --git a/frontend/src/routes/router.test.js b/frontend/src/routes/router.test.js index 925b3ffca..32ab90d4e 100644 --- a/frontend/src/routes/router.test.js +++ b/frontend/src/routes/router.test.js @@ -49,8 +49,8 @@ describe('router', () => { expect(routes.find((r) => r.path === '/').redirect()).toEqual({ path: '/login' }) }) - it('has seventeen routes defined', () => { - expect(routes).toHaveLength(17) + it('has sixteen routes defined', () => { + expect(routes).toHaveLength(16) }) describe('overview', () => { @@ -111,31 +111,6 @@ describe('router', () => { }) }) - describe('thx', () => { - const thx = routes.find((r) => r.path === '/thx/:comingFrom/:code?') - - it('loads the "Thx" page', async () => { - const component = await thx.component() - expect(component.default.name).toBe('Thx') - }) - - describe('beforeEnter', () => { - const beforeEnter = thx.beforeEnter - const next = jest.fn() - - it('redirects to login when not coming from a valid page', () => { - beforeEnter({}, { path: '' }, next) - expect(next).toBeCalledWith({ path: '/login' }) - }) - - it('enters the page when coming from a valid page', () => { - jest.resetAllMocks() - beforeEnter({}, { path: '/forgot-password' }, next) - expect(next).toBeCalledWith() - }) - }) - }) - describe('forgot password', () => { it('loads the "ForgotPassword" page', async () => { const component = await routes.find((r) => r.path === '/forgot-password').component() diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index a6586c201..e68f97502 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -46,18 +46,6 @@ const routes = [ path: '/register/:code?', component: () => import('@/pages/Register.vue'), }, - { - path: '/thx/:comingFrom/:code?', - component: () => import('@/pages/thx.vue'), - beforeEnter: (to, from, next) => { - const validFrom = ['forgot-password', 'reset-password', 'register', 'login', 'checkEmail'] - if (!validFrom.includes(from.path.split('/')[1])) { - next({ path: '/login' }) - } else { - next() - } - }, - }, { path: '/forgot-password', component: () => import('@/pages/ForgotPassword.vue'), diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 526a2c84f..129337e7f 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -38,9 +38,6 @@ export const mutations = { isAdmin: (state, isAdmin) => { state.isAdmin = !!isAdmin }, - coinanimation: (state, coinanimation) => { - state.coinanimation = coinanimation - }, hasElopage: (state, hasElopage) => { state.hasElopage = hasElopage }, @@ -53,7 +50,6 @@ export const actions = { // commit('username', data.username) commit('firstName', data.firstName) commit('lastName', data.lastName) - commit('coinanimation', data.coinanimation) commit('newsletterState', data.klickTipp.newsletterState) commit('hasElopage', data.hasElopage) commit('publisherId', data.publisherId) @@ -65,7 +61,6 @@ export const actions = { // commit('username', '') commit('firstName', '') commit('lastName', '') - commit('coinanimation', true) commit('newsletterState', null) commit('hasElopage', false) commit('publisherId', null) @@ -91,7 +86,6 @@ try { // username: '', token: null, isAdmin: false, - coinanimation: true, newsletterState: null, hasElopage: false, publisherId: null, diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js index 9eadedd6b..e8d680f94 100644 --- a/frontend/src/store/store.test.js +++ b/frontend/src/store/store.test.js @@ -20,7 +20,6 @@ const { token, firstName, lastName, - coinanimation, newsletterState, publisherId, isAdmin, @@ -78,14 +77,6 @@ describe('Vuex store', () => { }) }) - describe('coinanimation', () => { - it('sets the state of coinanimation', () => { - const state = { coinanimation: true } - coinanimation(state, false) - expect(state.coinanimation).toEqual(false) - }) - }) - describe('newsletterState', () => { it('sets the state of newsletterState', () => { const state = { newsletterState: null } @@ -134,7 +125,6 @@ describe('Vuex store', () => { language: 'de', firstName: 'Peter', lastName: 'Lustig', - coinanimation: false, klickTipp: { newsletterState: true, }, @@ -145,7 +135,7 @@ describe('Vuex store', () => { it('calls nine commits', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenCalledTimes(9) + expect(commit).toHaveBeenCalledTimes(8) }) it('commits email', () => { @@ -168,29 +158,24 @@ describe('Vuex store', () => { expect(commit).toHaveBeenNthCalledWith(4, 'lastName', 'Lustig') }) - it('commits coinanimation', () => { - login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(5, 'coinanimation', false) - }) - it('commits newsletterState', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(6, 'newsletterState', true) + expect(commit).toHaveBeenNthCalledWith(5, 'newsletterState', true) }) it('commits hasElopage', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(7, 'hasElopage', false) + expect(commit).toHaveBeenNthCalledWith(6, 'hasElopage', false) }) it('commits publisherId', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(8, 'publisherId', 1234) + expect(commit).toHaveBeenNthCalledWith(7, 'publisherId', 1234) }) it('commits isAdmin', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(9, 'isAdmin', true) + expect(commit).toHaveBeenNthCalledWith(8, 'isAdmin', true) }) }) @@ -200,7 +185,7 @@ describe('Vuex store', () => { it('calls nine commits', () => { logout({ commit, state }) - expect(commit).toHaveBeenCalledTimes(9) + expect(commit).toHaveBeenCalledTimes(8) }) it('commits token', () => { @@ -223,29 +208,24 @@ describe('Vuex store', () => { expect(commit).toHaveBeenNthCalledWith(4, 'lastName', '') }) - it('commits coinanimation', () => { - logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(5, 'coinanimation', true) - }) - it('commits newsletterState', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(6, 'newsletterState', null) + expect(commit).toHaveBeenNthCalledWith(5, 'newsletterState', null) }) it('commits hasElopage', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(7, 'hasElopage', false) + expect(commit).toHaveBeenNthCalledWith(6, 'hasElopage', false) }) it('commits publisherId', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(8, 'publisherId', null) + expect(commit).toHaveBeenNthCalledWith(7, 'publisherId', null) }) it('commits isAdmin', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(9, 'isAdmin', false) + expect(commit).toHaveBeenNthCalledWith(8, 'isAdmin', false) }) // how to get this working? diff --git a/package.json b/package.json index 20ab8dd35..b607c476d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "repository": "git@github.com:gradido/gradido.git", "author": "Ulf Gebhardt ", - "license": "MIT", + "license": "Apache-2.0", "scripts": { "release": "scripts/release.sh" },