Skip to content

Commit

Permalink
Merge pull request #157 from konnectors/fix/firstRelease
Browse files Browse the repository at this point in the history
[SCR-870] Fix/first release
  • Loading branch information
KillianCourvoisier authored Oct 7, 2024
2 parents 7922d16 + 81b338d commit 1e4c703
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"dependencies": {
"@cozy/minilog": "1.0.0",
"cozy-clisk": "^0.38.0",
"date-fns": "2.30.0",
"ky": "0.25.1"
"date-fns": "2.30.0"
},
"eslintConfig": {
"extends": [
Expand Down
31 changes: 4 additions & 27 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
} from 'cozy-clisk/dist/contentscript'
import Minilog from '@cozy/minilog'
import { blobToBase64 } from 'cozy-clisk/dist/contentscript/utils'
import ky from 'ky'
const log = Minilog('ContentScript')
Minilog.enable('poleemploiCCC')

Expand Down Expand Up @@ -34,22 +33,6 @@ const PDF_HEADERS = {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/pdf'
}
const ATTESTATION_HEADERS = {
Accept:
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br, zstd',
Referer:
'https://candidat.francetravail.fr/candidat/situationadministrative/suiviinscription/attestation/recapitulatif',
Host: 'candidat.francetravail.fr',
'Accept-Language': 'fr-FR,fr;q=0.8,en-US;q=0.5,en;q=0.3',
Connection: 'keep-alive',
'Upgrade-Insecure-Requests': 1,
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-User': '?1',
Priority: 'u=0, i'
}

// const baseUrl = 'https://www.francetravail.fr/accueil/'
const loginFormUrl = 'https://candidat.francetravail.fr/espacepersonnel/'
Expand Down Expand Up @@ -338,16 +321,10 @@ class PoleemploiContentScript extends ContentScript {

async computeAttestation() {
this.log('info', '📍️ computeAttestation starts')
const blob = await ky
.get(
'https://candidat.francetravail.fr/candidat/situationadministrative/suiviinscription/attestation/recapitulatif:telechargerattestationpdf',
{
headers: {
...ATTESTATION_HEADERS
}
}
)
.blob()
const response = await fetch(
'https://candidat.francetravail.fr/candidat/situationadministrative/suiviinscription/attestation/recapitulatif:telechargerattestationpdf'
)
const blob = await response.blob()
const dataUri = await blobToBase64(blob)
const today = new Date()
const formattedDate = formatDate(today)
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3417,7 +3417,7 @@ kind-of@^6.0.2:
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==

ky@0.25.1, ky@^0.25.1:
ky@^0.25.1:
version "0.25.1"
resolved "https://registry.yarnpkg.com/ky/-/ky-0.25.1.tgz#0df0bd872a9cc57e31acd5dbc1443547c881bfbc"
integrity sha512-PjpCEWlIU7VpiMVrTwssahkYXX1by6NCT0fhTUX34F3DTinARlgMpriuroolugFPcMgpPWrOW4mTb984Qm1RXA==
Expand Down

0 comments on commit 1e4c703

Please sign in to comment.