Skip to content

Commit

Permalink
Merge pull request #64 from SensCritique/fix/new-extension-name
Browse files Browse the repository at this point in the history
Release 1.2.15
  • Loading branch information
audreylamy authored Oct 14, 2022
2 parents 177c912 + ececb7b commit 028d095
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CONTRIB.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ All the code is the same for Chrome and Firefox except for the event system whic
- SensCritique (HTTP): Fetch video ID and Type
- SensCritique (HTTP): Fetch video note
##### Content_script
- Noteflix: Generate DOM with providers notes.
- SensCritique-extension: Generate DOM with providers notes.

# Installation / Test
## Installation
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="/images/logo-128.png" height=50/>

# NoteFlix
# SensCritique-extension
Permet d'avoir un score SensCritique sur les pages de descriptions Netflix

[Cliquez ici pour installer l'extension depuis le store firefox](https://addons.mozilla.org/fr/firefox/addon/noteflix/)
Expand Down
2 changes: 1 addition & 1 deletion __tests__/dom/Ratings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ test('It should render one div for SensCritique', () => {

expect(ratingsDiv).not.toBeNull()
expect(ratingsDiv.childNodes.length).toBe(1)
expect((ratingsDiv.childNodes[0] as Element).classList).toContain('senscritique_XXX')
expect((ratingsDiv.childNodes[0] as Element).classList).toContain('senscritique_extension_XXX')
})
12 changes: 6 additions & 6 deletions __tests__/dom/SensCritiqueRating.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ test.each(successDataset)('It should convert SensCritique note (%s) in percentag
name: 'test',
redirect: ''
})
const noteflixScore = sensCritiqueRating.ratingInPercent(sensCritiqueNote)
const sensCritiqueExtensionScore = sensCritiqueRating.ratingInPercent(sensCritiqueNote)

expect(noteflixScore).toBe(expected)
expect(sensCritiqueExtensionScore).toBe(expected)
})

const errorDataset = [
Expand All @@ -27,11 +27,11 @@ const errorDataset = [
test.each(errorDataset)('It should convert wrong SensCritique note (%s) to null', (sensCritiqueNote, expected) => {
const sensCritiqueRating = new SensCritiqueRating({
name: 'test',
redirect: '',
redirect: ''
})
const noteflixScore = sensCritiqueRating.ratingInPercent(sensCritiqueNote)
const sensCritiqueExtensionScore = sensCritiqueRating.ratingInPercent(sensCritiqueNote)

expect(noteflixScore).toBe(expected)
expect(sensCritiqueExtensionScore).toBe(expected)
})

test('It should create instance with rights rating', () => {
Expand All @@ -49,7 +49,7 @@ test('It should render node with rights info', () => {
rating: '8,5',
redirect: 'https://google.fr',
hashId: 'XXX',
name: 'test',
name: 'test'
})
const sensCritiqueRatingRendered = sensCritiqueRating.render()

Expand Down
4 changes: 2 additions & 2 deletions __tests__/storage/Cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import Cache from '../../src/storage/Cache'
test('It should save information in sessionStorage', () => {
const cache = new Cache()
cache.save({ rating: '10', name: 'Breaking bad' }, Service.SENSCRITIQUE)
const item = sessionStorage.getItem('noteflix_5c68903a7be732b58d17c41f5c4c24ff')
const item = sessionStorage.getItem('senscritique_extension_5c68903a7be732b58d17c41f5c4c24ff')

expect(item).toBe('{"rating":"10","name":"Breaking bad","hashId":"5c68903a7be732b58d17c41f5c4c24ff"}')
})

test('It should fetch information in sessionStorage', () => {
const cache = new Cache()
sessionStorage.setItem('noteflix_5c68903a7be732b58d17c41f5c4c24ff', '{"rating":"10","name":"Breaking bad","hashId":"5c68903a7be732b58d17c41f5c4c24ff"}')
sessionStorage.setItem('senscritique_extension_5c68903a7be732b58d17c41f5c4c24ff', '{"rating":"10","name":"Breaking bad","hashId":"5c68903a7be732b58d17c41f5c4c24ff"}')

const item = cache.get('Breaking bad', Service.SENSCRITIQUE)
expect(item).toStrictEqual({ rating: '10', name: 'Breaking bad', hashId: '5c68903a7be732b58d17c41f5c4c24ff' })
Expand Down
2 changes: 1 addition & 1 deletion manifest_chrome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "SensCritique",
"version": "1.2.14",
"version": "1.2.15",
"description": "Permet d'avoir les scores et avis SensCritique sur Netflix",
"icons": {
"48": "images/logo-48.png",
Expand Down
2 changes: 1 addition & 1 deletion manifest_firefox.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "SensCritique",
"version": "1.2.14",
"version": "1.2.15",
"description": "Permet d'avoir les scores et avis SensCritique sur Netflix",
"icons": {
"48": "images/logo-48.png",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "noteflix",
"version": "1.2.14",
"name": "senscritique-extension",
"version": "1.2.15",
"description": "Permet d'avoir les scores SensCritique sur Netflix",
"author": "SensCritique",
"repository": {
"url": "https://github.com/senscritique/noteflix"
"url": "https://github.com/senscritique/SensCritique-extension"
},
"scripts": {
"test": "jest"
Expand Down
Binary file modified releases/latest_chrome.zip
Binary file not shown.
Binary file modified releases/latest_firefox.xpi
Binary file not shown.
4 changes: 2 additions & 2 deletions src/dom/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default class Manager {
}

showAbTestModal (): void {
const cacheKey = 'noteflix_help'
const cacheKey = 'senscritique_extension_help'
const helpModalAlreadyDisplayed = sessionStorage.getItem(cacheKey)

if (document.getElementById(AbTestModalId) == null && !helpModalAlreadyDisplayed) {
Expand All @@ -126,7 +126,7 @@ export default class Manager {
}

showNotSupportedModal (): void {
const cacheKey = 'noteflix_not_supported'
const cacheKey = 'senscritique_extension_not_supported'
const NotSupportedModalIdDisplayed = sessionStorage.getItem(cacheKey)

if (document.getElementById(NotSupportedModalId) == null && !NotSupportedModalIdDisplayed) {
Expand Down
10 changes: 5 additions & 5 deletions src/dom/Modals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logo64 from '../../images/logo'

export const AbTestModalId = 'noteflix_help_modal'
export const NotSupportedModalId = 'noteflix_not_supported_modal'
export const AbTestModalId = 'senscritique_extension_help_modal'
export const NotSupportedModalId = 'senscritique_extension_not_supported_modal'

const Modal = (id: string, text: Element): Element => {
const modal = document.createElement('div')
Expand Down Expand Up @@ -42,8 +42,8 @@ export const ABTestModal = (): Element => {
button.innerText = 'Désactiver l\'option "Participer à des tests"'
button.href = 'https://www.netflix.com/DoNotTest'
text.innerHTML = `
Votre compte Netflix semble faire parti d'une phase de test, ce qui le rend incompatible avec NoteFlix.<br />
${button.outerHTML} pour que NoteFlix fonctionne.
Votre compte Netflix semble faire parti d'une phase de test, ce qui le rend incompatible avec SensCritique-extension.<br />
${button.outerHTML} pour que SensCritique-extension fonctionne.
`
return Modal(AbTestModalId, text)
}
Expand All @@ -55,7 +55,7 @@ export const NotSupportedModal = (): Element => {
text.style.marginLeft = '10px'

text.innerHTML = `
L'interface de Netflix ne semble plus être supportée par Noteflix pour le moment. <br />
L'interface de Netflix ne semble plus être supportée par SensCritique-extension pour le moment. <br />
Aucune crainte, nous sommes déjà sur le coup...🚀 <br />
`
return Modal(NotSupportedModalId, text)
Expand Down
2 changes: 1 addition & 1 deletion src/dom/Ratings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Ratings {
const senscritiqueElement = document.createElement('div')
senscritiqueElement.style.padding = '0 .5em 0 .5em'
senscritiqueElement.style.position = 'relative'
senscritiqueElement.classList.add(`senscritique_${hash}`)
senscritiqueElement.classList.add(`senscritique_extension_${hash}`)
mainDiv.appendChild(senscritiqueElement)

return mainDiv
Expand Down
2 changes: 1 addition & 1 deletion src/http/SensCritique.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class SensCritique implements Client {
async getVideoInfo (search: string, type: VideoType, year: string = null): Promise<VideoInfo> {
if (search) {
const headers = new Headers()
headers.append('User-Agent', `Noteflix v${app.version}`)
headers.append('User-Agent', `senscritique-extension v${app.version}`)
headers.append('Content-Type', 'application/json')
const response = await fetch(this.searchUrl, {
headers,
Expand Down
2 changes: 1 addition & 1 deletion src/logging/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class Logger {
context: {
app_version: chrome.runtime.getManifest().version,
netflix_ui_version: Netflix.getUiVersion(),
service: 'noteflix'
service: 'senscritique-extension'
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class Cache {
private readonly prefix: string;

constructor () {
this.prefix = 'noteflix_'
this.prefix = 'senscritique_extension_'
}

save (videoInfo: VideoInfo, service: Service): VideoInfo {
Expand Down

0 comments on commit 028d095

Please sign in to comment.