Giter VIP home page Giter VIP logo

cozy-home's Introduction

Travis build status shield Github Release version shield NPM Licence shield

Cozy Home

What's Cozy?

Cozy Logo

Cozy is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you.

What is Home ?

An application to configure and runs cozy konnectors. It is the main entrypoint to a Cozy.

  • Lists applications and konnectors
  • Manage konnectors and accounts through Harvest
  • Runs services that take care of synchronizing io.cozy.accounts and io.cozy.ciphers.

You can read more:

Cozy Home is developed by Cozy Cloud and distributed under the AGPL v3 license.

cozy-home's People

Contributors

acezard avatar aenario avatar cballevre avatar cpatchane avatar crash-- avatar dependabot[bot] avatar doubleface avatar flohhhh avatar gooz avatar gregorylegarec avatar jacquarg avatar jf-cozy avatar kosssi avatar ldoppea avatar lespacedunmatin avatar lucst avatar m4dz avatar merkur39 avatar narkfr avatar nono avatar paultranvan avatar poupotte avatar probot-auto-merge[bot] avatar ptbrowne avatar renovate-bot avatar renovate[bot] avatar transifex-integration[bot] avatar trollepierre avatar y-lohse avatar zatteo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cozy-home's Issues

Use namespaced helpers

Use namespace for helpers usage:

import { * as konnectors } from './helpers/konnectors
konnectors.isTwoFAError(...)

instead of

import { isKonnectorTwoFAError } from './helpers/konnectors
isKonnectorTwoFAError(...)

Backport cozy-home locales to cozy-harvest-lib and cleanup cozy-home locales

Connection error translations have moved from cozy-home to
cozy-harvest-lib. But we haven't backported translated files
from transifex/cozy-home to transifex/cozy-harvest-lib.

Below is an archive of the locales of cozy-home on the 15/01/2019
before cleaning up of the cozy-home locales was done. This should
enable us to send those locales inside harvest.

cozy-home-locales-15-01-2019.zip

We should also think of removing the deprecated connection.error slice
from cozy-home's locales. A potential problem would be that an older
cozy-home version would not find old locales on transifex. This is why I think
we should not integrate locales at build time but periodically download
them and commit them to the repo, so that

  • the old version not finding old locales problem would be solved (since it would
    take the locales from its repo)
  • an application can be built without talking to Transifex
  • more reproducible build

Generic login and password fields

In Collect, we are considering that every konnector use a couple of fields login/password to gather user credentials for external services.

But it is not always the case, some konnectors are configured to expect a identifier or an email in place of a login. However, the most part of the konnectors are using login/password. As we expect to deal with more and more konnectors in the future, the case will happen when a konnecor will use a totally unexpected name for the login field, let's say for example userKey.

The code actually deals with only three possibilities, login, email, and identifier. We cannot expect to deal with every new login field name which will pop up in the future.

Using a role attribute in manifest

A solution could be to use a role attribute for a field. Those role coule be login or password. May be the list of possible value may evolve in the future. This role coule be precised in the manifest.konnector:

"fields": {
	"identifier": {
    	"role": "login",
		"type": "text"
  	},
  	"secret": {
		"role": "password",
		"type": "password"
	}
}

Legacy

To maintain legacy and avoid updating all konnectors manifests, we should keep the login and password identifier as reserved default ones. So we could use helpers like:

const isLogin = field => [field.name, field.role].includes('login')
const isPassword = field => [field.name, field.role].includes('password')

TL:DR;

  • Use default login and password field for credentials
  • Add login and password role attribute for credential fields with a different name

This solution seems pretty simple and future-proof but experience showed us that in Collect and konnectors some technical choices can have heavy consequences. Do you see a flaw on this solution?

Konnector modal won't closed

Scenario

  1. I connected an account throught cozy collect
  2. I waited for the completion of the konnector
  3. I tried to close the konnector modal and it won't close :
Uncaught (in promise) TypeError: Cannot read property 'focus' of null
    at t.value (app.js:formatted:18132)
    at g (app.js:formatted:7148)
    at T (app.js:formatted:7339)
    at O (app.js:formatted:7284)
    at T (app.js:formatted:7306)
    at O (app.js:formatted:7284)
    at T (app.js:formatted:7306)
    at u (app.js:formatted:7077)

The line of the error:

        c(t, [{
            key: "componentDidMount",
            value: function() {
                this.props.giveFocus && h.default.findDOMNode(this).querySelector("input").focus()
            }
        }, {

Is useAppDataset hook necessary ?

I discovered the useAppDataset hooks and I wonder if a hook was really necessary. It seems that for every component using this hook, we will have two renders (initial render + after the setState) where only one was necessary. Subsequent renders will not trigger a DOM access but still, it makes two render instead of one.

I wonder if the dataset access method should not be directly in CozyClient ? This way at app start, we init from the dataset div and then we can access values directly via CozyClient without a second render.

More context in the PR : #1391 (comment)

A connector cannot declare a field of type `tel`.

As described by one of our users, a connector does not work because it declares a field of type tel:

"fields": {
    "login": {
        "type": "tel"
    },
    "password": {
        "type": "password"
    }
}

https://github.com/konnectors/digitick/blob/23a92158ff9abfa06f2c67311534b937c8d76ce4/manifest.konnector#L14

The documentation and the codebase are saying the same: the type must be one of dropdown, email, hidden, password, text, checkbox.

I open this issue to ask to add a type tel: it is as useful as a type email. Otherwise type text would be enough.

Update Cozy-UI

update UI from beta2 to beta19

  • beta2 uses the old modal $dialog -> use the React component modal instead
  • trash base/_colors.styl and base/_normalize.styl & adapt color variables (embedded with Cozy-UI)
  • remove base-font-size = 16 it's in Cozy-UI
  • Divide & conquer. Not everything in one only file
  • Review the application's DOM so it fits Cozy-UI's layout needs (See Drive app's DOM for an example)
  • Re-use UI styles for form elements & buttons
  • Use the Notifier React component from Cozy-UI

⚠️ This is just a draft of what I saw, this is not an exhaustive list.

Validation for fields ?

Linxo has a similar file as src/config/konnector.js where they describe all the banks they connect to and what credentials each bank needs.

For each fields, they have a validation in the form of a regexp. It might be something to consider to provide validation for our fields.

Example:

      {
        "id": "86",
        "label": "Identifiant",
        "type": "TextField",
        "regexp": "[0-9]+"
      }

reverse the logic of the connector config file

In the connector config file, we declare a konnector as this:

[
  {
    "oauth": true,
    "slug": "maif",
    "name": "MAIF",
    "editor": "Cozy Cloud",
    "vendorLink": "maif.fr",
    "testing": true,
    "categories": ["insurance"],
    "fields": {
      "access_token": {
        "type": "hidden"
      }
    },
    "dataType": ["profile", "contract", "home", "family", "sinister"],
    "source": "git://github.com/konnectors/cozy-konnector-maif.git#latest",
    "oauth_scope": "openid+profile+offline_access"
  }
]

If you don't want the konncetor to be shipped (for test purposes), you need to add a property "testing": true. But if your forget to add this property, then it will be shipped and could break the cozy-stack database by creating inconsistent data.

"testing": true should be the default value, then errors can not be made as we have to declare "testing": false or "prod": true if we do want the connector to go into production.

Broken link when installing suggested konnector

Hi,
My self-hosted instance uses the nested subdomains scheme (mon.cozy.chez.moi), which is defined in the /etc/cozy/cozy.yml.local file:

[...]
subdomains: nested
[...]

But when I try to install a suggested konnector from the home App by clicking on a tile, the generated link uses the flat scheme (mon-cozy.chez.moi/#/discover/slug), leading to TLS certificate error.

I noticed that the current code seems to retrieve the instance subdomain scheme to build the correct URL, so it might be an issue in my server configuration.

Any idea on how to fix it? Is it a misconfiguration on my side or a real issue?

N.B.: I have the same issue when I try to access the retrieved documents of a connected Konnector from the Home app.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • fix(deps): update dependency cozy-client to ^48.1.1
  • fix(deps): update dependency cozy-harvest-lib to ^26.0.3
  • fix(deps): update dependency cozy-sharing to ^15.0.1
  • fix(deps): update dependency redux to v4.2.1
  • fix(deps): update dependency terser-webpack-plugin to v1.4.5
  • fix(deps): update dependency @types/classnames to v2.3.1
  • fix(deps): update dependency babel-preset-cozy-app to v2.1.0
  • fix(deps): update dependency bundlemon to v1.4.0
  • fix(deps): update dependency date-fns to v2.30.0
  • fix(deps): update dependency es-abstract to v1.23.3
  • fix(deps): update dependency eslint to v8.57.0
  • fix(deps): update dependency eslint-config-cozy-app to v4.2.1
  • fix(deps): update dependency leaflet to v1.9.4
  • fix(deps): update dependency moment to v2.30.1
  • fix(deps): update dependency node to v20.14.0
  • fix(deps): update dependency papaparse to v5.4.1
  • fix(deps): update dependency react-router-dom to v6.23.1
  • fix(deps): update dependency redux-thunk to v2.4.2
  • fix(deps): update dependency stylus to v0.63.0
  • fix(deps): update dependency url-search-params-polyfill to v8.2.5
  • fix(deps): update react monorepo (@types/react, @types/react-dom, react, react-dom, react-test-renderer)
  • fix(deps): update testing-library monorepo (@testing-library/jest-dom, @testing-library/react)
  • fix(deps): update actions/checkout action to v4
  • fix(deps): update dependency bundlemon to v2
  • fix(deps): update dependency date-fns to v3
  • fix(deps): update dependency eslint to v9
  • fix(deps): update dependency eslint-config-cozy-app to v6
  • fix(deps): update dependency form-data to v4
  • fix(deps): update dependency husky to v9
  • fix(deps): update dependency lint-staged to v15
  • fix(deps): update dependency react-inspector to v6
  • fix(deps): update dependency react-redux to v9
  • fix(deps): update dependency redux to v5
  • fix(deps): update dependency redux-thunk to v3
  • fix(deps): update dependency remark-preset-lint-recommended to v7
  • fix(deps): update dependency reselect to v5
  • fix(deps): update dependency terser-webpack-plugin to v5
  • fix(deps): update github/codeql-action action to v3
  • fix(deps): update jest monorepo to v29 (major) (babel-jest, jest, jest-environment-jsdom)
  • fix(deps): update testing-library monorepo (major) (@testing-library/jest-dom, @testing-library/react)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v2
  • github/codeql-action v1
  • github/codeql-action v1
  • github/codeql-action v1
npm
package.json
  • cozy-client ^48.1.0
  • cozy-device-helper 2.7.0
  • cozy-doctypes 1.83.8
  • cozy-flags 3.2.2
  • cozy-harvest-lib ^26.0.1
  • cozy-intent ^2.19.2
  • cozy-interapp ^0.9.0
  • cozy-keys-lib ^6.0.0
  • cozy-logger 1.10.4
  • cozy-minilog ^3.3.1
  • cozy-realtime 4.6.0
  • cozy-sharing ^15.0.0
  • cozy-stack-client ^48.0.0
  • cozy-tsconfig 1.2.0
  • cozy-ui ^109.1.1
  • date-fns 2.28.0
  • es-abstract 1.20.2
  • form-data 2.5.1
  • leaflet 1.7.1
  • localforage ^1.10.0
  • lodash 4.17.21
  • moment 2.29.4
  • papaparse 5.3.1
  • prop-types ^15.8.1
  • react 18.2.0
  • react-dom 18.2.0
  • react-inspector 5.1.1
  • react-redux 7.2.6
  • react-remove-scroll ^2.5.5
  • react-router-dom 6.6.2
  • react-swipeable-views 0.14.0
  • redux 4.2.0
  • redux-logger 3.0.6
  • redux-persist ^6.0.0
  • redux-thunk 2.3.0
  • reselect ^4.1.8
  • terser-webpack-plugin 1.4.4
  • @testing-library/jest-dom 5.16.5
  • @testing-library/react 13.3.0
  • @testing-library/react-hooks 8.0.1
  • @types/classnames 2.2.6
  • @types/react 18.0.17
  • @types/react-dom 18.0.6
  • babel-jest 27.5.1
  • babel-preset-cozy-app 2.0.2
  • bundlemon 1.3.2
  • cozy-scripts 8.2.0
  • eslint 8.9.0
  • eslint-config-cozy-app 4.0.0
  • eslint-import-resolver-alias ^1.1.2
  • eslint-plugin-import ^2.26.0
  • eslint-plugin-import-alias ^1.2.0
  • git-directory-deploy 1.5.1
  • husky 1.3.1
  • ignore-not-found-export-webpack-plugin 1.0.2
  • jest 28.1.3
  • jest-environment-jsdom 28.1.3
  • jest-fetch-mock 3.0.3
  • lint-staged 8.2.1
  • mockdate 3.0.5
  • npm-run-all 4.1.5
  • react-hot-loader ^4.13.0
  • react-test-renderer 18.2.0
  • remark-preset-lint-recommended 5.0.0
  • stylint 2.0.0
  • stylus 0.55.0
  • url-search-params-polyfill 8.1.1
nvm
.nvmrc
  • node 20
travis
.travis.yml
  • node 20.11.0

  • Check this box to trigger a request for Renovate to run again on this repository

[feature request] Add Cozy Collect connector for Property Ads

Add connectors for Property ads to rent/buy a flat or house, by connecting to sites such as seLoger.com, leboncoin.fr, pap.fr, bienici.fr, and so on. If a user connects its cozy cloud to its personal profiles on these sites, he/she would be able to visualize in one single place all the ads, and compare their properties - surface, cost, room count, localisation. Of course, it would require a new ui app to sort these ads out, and a custom doctype is also important.

[edit] : was added as a request in the providers page. A discussion could be interesting to do though to gather ideas around how to proceed - where to start given https://docs.cozy.io/en/dev/konnector/ and how to parse the ads elements and produce a good use case for cozy cloud - not yet existing way to gather these information from different profiles.

Migrate to React

The home should migrate to React as soon as possible to diminish the number of hard to resolve bugs due to lack of compatibility between React and Preact.

It seems one of the task that could be done step by step would be the removal of direct context usage, which does not work with React (cannot access the context as easily as in Preact). After those replacements, it will be easier to switch to React.

To replace direct context usage:

  • components using context.t, context.f are wrapped in translate() and props.t/props.f can be used used
  • for client/domain, withClient can be used
  • context.router via withRouter
  • For context.store a custom HOC could be used.

Below are the instances of direct context usage:

test/jestLib/I18n.js
13:export const tMock = context.t
15:export const fMock = context.f

src/components/AppTile.jsx
10:    const { domain, secure } = this.context

src/components/TriggerFolderLink.jsx
29:    const { client } = this.context

src/components/KonnectorTile.jsx
71:    const { domain, features, secure } = this.context

src/lib/statefulForm.jsx
25:        const { t } = context
215:        const { t } = this.context

src/components/KonnectorHeaderIcon.jsx
10:    const { domain, secure } = this.context

src/components/KonnectorSuccess.jsx
129:      return <BanksLink key={i} banksUrl={context.store.banksUrl} />

src/store/configureStore.js
10:const configureStore = (client, context, options = {}) => {

src/containers/IntentHandler.jsx
12:    this.store = context.store
63:    const { t } = this.context

src/containers/ConnectionManagement.jsx
34:    this.store = this.context.store
36:    const { t } = this.context
188:    const { t } = this.context
207:      const { router } = this.context

src/containers/IntentService.jsx
40:    const { t } = this.context

src/containers/AccountConnection.jsx
30:    this.store = this.context.store
205:    const { t } = this.context

src/containers/App.jsx
31:    this.store = this.context.store

src/lib/redux-cozy-client/connect.jsx
14:      const dispatch = this.context.store.dispatch
21:      const { t, f, client, store } = this.context

src/components/intents/CreateAccountIntent.jsx
9:    this.store = this.context.store

src/ducks/connections/components/queue/queue.jsx
52:    const { domain, secure } = this.context

Allow other image formats

I am working on the banking connectors. Linxo's API has a listFinancialInstitutions route which list all the banks along with their logos etc... I will rely on this data to generate the config to copy/paste in config/konnectors.json. Some images for the logo are not in SVG. Can we support other formats : png, jpg, gif ?

Manifest permission

Since the Home is not listed in the Store, we don't display its permissions for now so we don't have the permissions' list in our translation files.

Even if the app has a specific behavior, we should try to keep as close as possible to our global behavior aka, we should write the permissions in our translations files

(see #1503 (comment) for more context)

installedkonnectors

Je viens de faire une PR un peu crade pour faire un hotfix (#1478)

On s'attend à ce que installedKonnectors soit un array :

installedKonnectors: PropTypes.array.isRequired,

Sauf que installedKonnectors vient de getInstalledKonnectors https://github.com/cozy/cozy-home/blob/master/src/ducks/konnectors/index.js#L37 et que si j'ai pas de !!state.documents ça va retourner false.

Et du coup false.some ne fonctionne pas. Vu qu'on utilise getInstalledKonnectors à plusieurs endroits j'ai pas voulu corriger à la source pour pas faire un hotfix trop large

Redux migration

We're planning to migrate Collect's store to redux. First of all, I think we should agree about what the state should look like.

So there is my first proposition, let's discuss :

Entities

As specified in this presentation made by @goldoraf, we should keep a list of our entities.

The entities we need are : Konnectors, Konnector results, Accounts, Jobs.

{
  api: {
    endpoint: { ... },
    entities: {
      io.cozy.konnectors: { // installed konnectors },
      io.cozy.konnectors.result: {},
      io.cozy.accounts: {},
      io.cozy.jobs: {}
      }
    },
  },
  ...

If I undestood well, those entities are already managed by redux-cozy-client, so let's dive into the custom part.

Store

At startup, no konnector is installed and the konnector list comes from the file src/config/konnectors.json.

  ...,
  store: {
    konnectors: {
      ...
      maif: { ... }
      trainline: { ... }
      ...
    }
  }
  ...

Connections

We use connections to reflect the status of an account associated with a konnector. To determine this status we need at least the last konnectorResult for the given konnector, and a running job if it exists.

This part of the state will play a major role in Collect, and will be at the center of the realtime logic.

My first idea for this part is something like this. This example is multi-accounts ready !

  ...,
  connections: {
    konnectors: {
      trainline: {
        accounts: {
          '3214543345345345453': {
            status: 'connecting',
            folder: {
              status: 'created'
            },
            konnectorResult: {
              id: '8889987657564364',
              status: 'errored',
              error: {
                message: { 'LOGIN_FAILED' }
              }
            },
            job: {
              id: '556586856588658909009',
              status: 'running'
            }
          }
        }
      }  
    }
  }
  ...

UI

The UI part will consider all the konnectors filtered lists, the use-case and the opened modal. It should look like :

  ...,
  ui: {
    categories: {
      travel: {
        konnectors: [ 'trainline', ... ]
      }
    },
    usecases: [...],
    modal: {
      konnector: trainline
    }
  }
  ...

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Login button is disabled when there's no required fields

I have a connector that doesn't take any credentials, so I don't have any required fields on the login page :

image

The problem is that initially the submit button is disabled. If I type something in the optionnal field, it becomes enabled, even if I clear it afterwards :

image

image

Error "something went wrong..." in collect

Hi,
When I go to the collect applications, I get the following error in French:
Quelque chose s’est mal passé pendant la récupération de vos connecteurs et de vos informations. Merci de recharger la page.

In the log, I see
time="2017-10-08T20:15:16+02:00" level=error msg="[http] GET /realtime/ websocket: not a websocket handshake: 'upgrade' token not found in 'Connection' header" domain=cozy.mytld

I moved to 1.02 version of collect andnow I have the same error as above plus:
time="2017-10-08T20:15:17+02:00" level=error msg="[http] GET /jobs/queue/konnector code=403, message=Forbidden" domain=cozy.mytld

I'm using an Apache proxy with the following config:

<VirtualHost *:443>
     ServerName cozy.levillain.fr.nf
     ServerAlias *.cozy.levillain.fr.nf
 
     SSLEngine on
     Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
     SSLCertificateFile "/etc/letsencrypt/live/levillain.fr.nf/fullchain.pem"
     SSLCertificateKeyFile "/etc/letsencrypt/live/levillain.fr.nf/privkey.pem"
 
     ProxyPass / http://127.0.0.1:8080/
     ProxyPassReverse / cozy.levillain.fr.nf
#added this for websocket error 
    ProxyPass /realtime/ ws://127.0.0.1:8080/
# tried this, does not work
#   Header set Connection "upgrade"
#  RequestHeader set Connection "upgrade"                                                                                                  
     ProxyPreserveHost on
 
     ErrorLog ${APACHE_LOG_DIR}/cozy_error.log
     CustomLog ${APACHE_LOG_DIR}/cozy_access.log combined
 </VirtualHost>

I googled the error and found it's a websocket issue but neither adding myself the upgrade to the connexion header, nor using mod_proxy_wstunnel with a ProxyPass on /realtime/ to a ws url will work...

Requests to /triggers/undefined when removing account

When deleting an account from the home, I see requests to /triggers/undefined being sent.

The trigger is removed at the end so I guess that in the process, one of the request is successful (so it seems not critical).

7:26:33Z" level=debug msg="request: GET [REDACTED]%2Fio-cozy-triggers/undefined " domain=pbrowne.mycozy.cloud nspace=couchdb
7:26:33Z" level=debug msg="CouchDB(not_found): missing" domin=[REDACTED].mycozy.cloud nspace=couchdb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.