Skip to content

Commit

Permalink
Changes related to #22
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Grigorian committed Jan 21, 2021
1 parent 3f36620 commit f8470c1
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 24 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Chrome Extension - MILK
# MILK — Cookie Manager
> Cookie's best friend! Modern cookie manager.
![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge&color=1A73E8)
![Version 2.3.0](https://img.shields.io/badge/Version-2.3.0-yellow.svg?style=for-the-badge&color=1A73E8)
![Users](https://img.shields.io/chrome-web-store/d/haipckejfdppjfblgondaakgckohcihp.svg?style=for-the-badge&color=1A73E8)
![Rating](https://img.shields.io/chrome-web-store/rating/haipckejfdppjfblgondaakgckohcihp.svg?style=for-the-badge&color=1A73E8)
![Reviews](https://img.shields.io/chrome-web-store/rating-count/haipckejfdppjfblgondaakgckohcihp.svg?style=for-the-badge&color=1A73E8)
![Chrome Users](https://img.shields.io/chrome-web-store/d/haipckejfdppjfblgondaakgckohcihp.svg?style=for-the-badge&color=1A73E8&label=chrome-users)
![Chrome Rating](https://img.shields.io/chrome-web-store/rating/haipckejfdppjfblgondaakgckohcihp.svg?style=for-the-badge&color=1A73E8&label=chrome-rating)
<!-- ![Firefox Users](https://img.shields.io/amo/users/031ab6ca80074459a477.svg?style=for-the-badge&color=1A73E8&label=firefox-users) -->
<!-- ![Firefox Rating](https://img.shields.io/amo/rating/031ab6ca80074459a477.svg?style=for-the-badge&color=1A73E8&label=firefox-rating) -->

![screenshot](assets/images/github-banner.png)

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "milk-cookie-manager",
"version": "2.3.0",
"description": "Chrome extension that manages your browser's cookies",
"description": "Cookie's best friend! Modern cookie manager.",
"author": "Rafael Grigorian <[email protected]>",
"license": "MIT",
"scripts": {
Expand All @@ -14,14 +14,14 @@
"publish:chrome": "echo not supported yet",
"clean": "rm -rf dist .parcel-cache target",
"nuke": "yarn clean && rm -rf node_modules",
"test": "yarn clean && yarn build && mocha spec",
"test:chrome": "yarn clean && yarn build && mocha spec",
"marketing": "yarn clean && yarn build && node tools/create-marketing.js"
},
"dependencies": {
"@emotion/react": "^11.1.1",
"@emotion/styled": "^11.0.0",
"@material-ui/core": "^5.0.0-alpha.18",
"@material-ui/icons": "^5.0.0-alpha.14",
"@material-ui/icons": "^5.0.0-alpha.23",
"bluebird": "^3.7.2",
"copy-to-clipboard": "^3.3.1",
"lodash": "^4.17.20",
Expand Down
4 changes: 2 additions & 2 deletions spec/ui.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict"

const Promise = require ("bluebird")
const Chrome = require ("../utils/Chrome")
const Browser = require ("../utils/Browser")
const assert = require ("assert")

describe ( "User Interface", function () {
Expand All @@ -10,7 +10,7 @@ describe ( "User Interface", function () {

describe ( "Search", function () {
it ( "Can type in search box", function () {
return Chrome ( async chrome => await Promise.resolve ()
return Browser ( async chrome => await Promise.resolve ()
.then ( () => chrome.goto ( "index.html" ) )
.then ( () => chrome.page.type ( "#search", "Hello World" ) )
.then ( () => chrome.page.$("#search") )
Expand Down
20 changes: 10 additions & 10 deletions tools/create-marketing.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use strict"

const Promise = require ("bluebird")
const Chrome = require ("../utils/Chrome")
const Browser = require ("../utils/Browser")
const cookies = require ("../data/marketing")
const jimp = require ("jimp")

return Chrome ( async chrome => await Promise.resolve ()
return Browser ( async chrome => await Promise.resolve ()
.then ( () => chrome.goto ("index.html") )
.then ( () => chrome.cookies.set ( cookies ) )
.then ( () => chrome.cookies.protect ([ cookies [ 0 ], cookies [ 3 ] ]) )
Expand All @@ -22,39 +22,39 @@ return Chrome ( async chrome => await Promise.resolve ()
.then ( () => chrome.page.setViewport ({ width: 550, height: 530 }))
.then ( () => chrome.goto ("index.html") )
.then ( () => chrome.storage ({ regexp: false, dark: false }) )
.then ( () => chrome.page.screenshot ({ type: "png" }) )
.then ( () => chrome.screenshot () )
.then ( image => jimp.read ( image ) ),
dark_panel_list: await Promise.resolve ()
.then ( () => chrome.page.setViewport ({ width: 550, height: 530 }))
.then ( () => chrome.goto ("index.html") )
.then ( () => chrome.storage ({ regexp: true, dark: true }) )
.then ( () => chrome.page.screenshot ({ type: "png" }) )
.then ( () => chrome.screenshot () )
.then ( image => jimp.read ( image ) ),
light_panel_list_highlight: await Promise.resolve ()
.then ( () => chrome.page.setViewport ({ width: 550, height: 530 }))
.then ( () => chrome.goto ("index.html") )
.then ( () => chrome.storage ({ regexp: false, dark: false }) )
.then ( () => chrome.page.type ( "#search", "example.com" ) )
.then ( () => chrome.page.screenshot ({ type: "png" }) )
.then ( () => chrome.screenshot () )
.then ( image => jimp.read ( image ) ),
dark_panel_list_highlight: await Promise.resolve ()
.then ( () => chrome.page.setViewport ({ width: 550, height: 530 }))
.then ( () => chrome.goto ("index.html") )
.then ( () => chrome.storage ({ regexp: true, dark: true }) )
.then ( () => chrome.page.type ( "#search", "^.?(example|blog)" ) )
.then ( () => chrome.page.screenshot ({ type: "png" }) )
.then ( () => chrome.screenshot () )
.then ( image => jimp.read ( image ) ),
dark_options_top: await Promise.resolve ()
.then ( () => chrome.page.setViewport ({ width: 1280, height: 800 }))
.then ( () => chrome.goto ("options.html") )
.then ( () => chrome.storage ({ regexp: true, dark: true }) )
.then ( () => chrome.page.screenshot ({ type: "png" }) )
.then ( () => chrome.screenshot () )
.then ( image => jimp.read ( image ) ),
dark_options_bottom: await Promise.resolve ()
.then ( () => chrome.page.setViewport ({ width: 1280, height: 800 }))
.then ( () => chrome.goto ("options.html#blocked-cookies") )
.then ( () => chrome.storage ({ regexp: true, dark: true }) )
.then ( () => chrome.page.screenshot ({ type: "png" }) )
.then ( () => chrome.screenshot () )
.then ( image => jimp.read ( image ) ),
light_panel_add: await Promise.resolve ()
.then ( () => chrome.page.setViewport ({ width: 550, height: 530 }))
Expand All @@ -64,7 +64,7 @@ return Chrome ( async chrome => await Promise.resolve ()
.then ( () => chrome.page.type ( "input[name='domain']", "example.com" ) )
.then ( () => chrome.page.type ( "input[name='value']", "d29vdCwgeW91IGZpZ3VyZWQgaXQgb3V0IQ==" ) )
.then ( () => chrome.page.type ( "input[name='name']", "modern_cookie_manager" ) )
.then ( () => chrome.page.screenshot ({ type: "png" }) )
.then ( () => chrome.screenshot () )
.then ( image => jimp.read ( image ) ),
dark_panel_add: await Promise.resolve ()
.then ( () => chrome.page.setViewport ({ width: 550, height: 530 }))
Expand All @@ -74,7 +74,7 @@ return Chrome ( async chrome => await Promise.resolve ()
.then ( () => chrome.page.type ( "input[name='domain']", "example.com" ) )
.then ( () => chrome.page.type ( "input[name='value']", "d29vdCwgeW91IGZpZ3VyZWQgaXQgb3V0IQ==" ) )
.then ( () => chrome.page.type ( "input[name='name']", "modern_cookie_manager" ) )
.then ( () => chrome.page.screenshot ({ type: "png" }) )
.then ( () => chrome.screenshot () )
.then ( image => jimp.read ( image ) ),
}))
.then ( ({ template, ...screenshot }) => {
Expand Down
16 changes: 15 additions & 1 deletion utils/Chrome.js → utils/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ const Promise = require ("bluebird")
const puppeteer = require ("puppeteer")
const manifest = require ("../static/manifest.json")

function sleep ( ms ) {
return new Promise ( resolve => {
setTimeout ( resolve, ms )
})
}

async function launch () {
const browser = await puppeteer.launch ({
headless: false,
Expand Down Expand Up @@ -32,7 +38,7 @@ async function launch () {
module.exports = async function ( callback ) {
const { browser, page, template } = await launch ()
return callback ({
browser, page,
browser, page, sleep,
goto ( path ) {
return page.goto (`${template}/${path}`)
},
Expand All @@ -46,6 +52,14 @@ module.exports = async function ( callback ) {
)
}, data )
},
screenshot () {
return Promise.resolve ()
.then ( () => page.evaluate ( () => {
document.title = "🔴Waiting For Screenshot"
}))
.then ( () => sleep ( 1000 ) )
.then ( () => page.screenshot ({ type: "png" }) )
},
cookies: {
hash ( cookie ) {
return `<${cookie.name}><${cookie.domain}><${cookie.path}>`
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1396,10 +1396,10 @@
react-is "^16.8.0 || ^17.0.0"
react-transition-group "^4.4.0"

"@material-ui/icons@^5.0.0-alpha.14":
version "5.0.0-alpha.19"
resolved "https://registry.yarnpkg.com/@material-ui/icons/-/icons-5.0.0-alpha.19.tgz#16a57cdb54aea3c57c0ba5601e9283bf28f3f90d"
integrity sha512-5FNUZ0Xw9BXBJhQVwTO5rV5yvR2N3C52IfFOWYSSVWVSot0WJ1ZP9qU+dY+qJWEcTlEcV+aG6nvG6b9eLoP7KA==
"@material-ui/icons@^5.0.0-alpha.23":
version "5.0.0-alpha.23"
resolved "https://registry.yarnpkg.com/@material-ui/icons/-/icons-5.0.0-alpha.23.tgz#b7d5141cfaa1df4a9697c60e50df2e5f2c6a0047"
integrity sha512-paML0ghK4qN+Z0oAd66lDfX1+Vt1LBPkMA9uSUEBmGga2yY8aGpo9tAVGM3UR7kTx0BEWT5e/4u2aDvwbdGZPQ==
dependencies:
"@babel/runtime" "^7.4.4"

Expand Down

0 comments on commit f8470c1

Please sign in to comment.