Skip to content

Commit

Permalink
feat: Remove cozy-authentication from playgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Dec 10, 2024
1 parent 5144089 commit d4db7d3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 49 deletions.
6 changes: 0 additions & 6 deletions packages/playgrounds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
yarn start
```

If you work on a local cozy and you don't have https enabled you have to define a global `ALLOW_HTTP` var at start to be able to login (see this line in cozy-authentication <https://github.com/cozy/cozy-libs/blob/master/packages/cozy-authentication/src/steps/SelectServer.jsx#L111>). With `parcel` you can use the `--global` option to do so

```
yarn start --global __ALLOW_HTTP__
```

You need to launch your browser with disabled CORS, for example on macOS (the important bits are the flags):

```
Expand Down
1 change: 0 additions & 1 deletion packages/playgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"@babel/runtime": "7.18.6",
"@material-ui/core": "3.9.4",
"@material-ui/lab": "^4.0.0-alpha.60",
"cozy-authentication": "^3.6.1",
"cozy-client": "13.21.0",
"cozy-device-helper": "^3.7.1",
"cozy-doctypes": "^1.97.1",
Expand Down
22 changes: 2 additions & 20 deletions packages/playgrounds/src/common/App.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import '@babel/polyfill'
import 'date-fns/locale/en/index'
import React from 'react'
import { hashHistory } from 'react-router'

import { MobileRouter } from 'cozy-authentication'
import { CozyProvider } from 'cozy-client'
import Alerter from 'cozy-ui/transpiled/react/Alerter'
import { getUniversalLinkDomain } from 'cozy-ui/transpiled/react/AppLinker'
import I18n from 'cozy-ui/transpiled/react/I18n'
import IconSprite from 'cozy-ui/transpiled/react/Icon/Sprite'
import 'cozy-ui/transpiled/react/stylesheet.css'
Expand Down Expand Up @@ -57,29 +54,14 @@ class ErrorBoundary extends React.Component {
/** A generic App component, meant to be used by all examples */
class App extends React.Component {
render() {
const { title, icon, client, children, existingStore } = this.props
/**
* We need to pass a loginPath with the current locationHash to be able
* to stay on the right page after a refresh since cozy-authentication
* redirect to loginPath after the login
*/
const { client, children, existingStore } = this.props

return (
<ErrorBoundary>
<Alerter />
<I18n dictRequire={() => ({})} lang="fr">
<CozyProvider store={existingStore} client={client}>
<MobileRouter
history={hashHistory}
protocol="cozyexample://"
universalLinkDomain={getUniversalLinkDomain()}
appTitle={title}
appIcon={icon}
appSlug="example"
loginPath={window.location.hash.replace('#', '')}
>
{children}
</MobileRouter>
{children}
</CozyProvider>
</I18n>
<IconSprite />
Expand Down
23 changes: 1 addition & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10965,17 +10965,6 @@ cosmiconfig@^8.2.0:
parse-json "^5.2.0"
path-type "^4.0.0"

cozy-authentication@^3.6.1:
version "3.6.1"
resolved "https://registry.yarnpkg.com/cozy-authentication/-/cozy-authentication-3.6.1.tgz#316c5ab3de8a527878f3e10f7dde3a9d05d4fa09"
integrity sha512-NwU4nGEoOtBYIGeVpGHZs0SnwvZ94OBbrmK8ILCc7d0CcEmY3JfEKZ+AsjvWKmXlD71YoOFpFnhbtbTSkaeuAw==
dependencies:
cozy-device-helper "^3.7.1"
localforage "1.7.3"
prop-types "15.7.2"
snarkdown "1.2.2"
url-polyfill "1.1.7"

cozy-bi-auth@0.0.25:
version "0.0.25"
resolved "https://registry.yarnpkg.com/cozy-bi-auth/-/cozy-bi-auth-0.0.25.tgz#00947925dc3cbb664f4fa54cedde80e47d55fdd0"
Expand Down Expand Up @@ -18748,12 +18737,6 @@ loader-utils@^2.0.0, loader-utils@^2.0.4:
emojis-list "^3.0.0"
json5 "^2.1.2"

localforage@1.7.3:
version "1.7.3"
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.7.3.tgz#0082b3ca9734679e1bd534995bdd3b24cf10f204"
dependencies:
lie "3.1.1"

localforage@^1.8.1:
version "1.10.0"
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4"
Expand Down Expand Up @@ -25381,7 +25364,7 @@ snapdragon@^0.8.1:
source-map-resolve "^0.5.0"
use "^3.1.0"

snarkdown@1.2.2, snarkdown@^1.2.2:
snarkdown@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/snarkdown/-/snarkdown-1.2.2.tgz#0cfe2f3012b804de120fc0c9f7791e869c59cc74"

Expand Down Expand Up @@ -27479,10 +27462,6 @@ url-parse@^1.4.3, url-parse@^1.4.4, url-parse@^1.5.3:
querystringify "^2.1.1"
requires-port "^1.0.0"

url-polyfill@1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/url-polyfill/-/url-polyfill-1.1.7.tgz#402ee84360eb549bbeb585f4c7971e79a31de9e3"

url-search-params-polyfill@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/url-search-params-polyfill/-/url-search-params-polyfill-7.0.0.tgz#98b56ed29e67710588fdc3c361083b0f78303d95"
Expand Down

0 comments on commit d4db7d3

Please sign in to comment.