Skip to content

Commit

Permalink
src: js class implementation in cookie injector
Browse files Browse the repository at this point in the history
Implement Injector using a javascript `class` over relying on dependency
`inherit`

PR-URL: #37
  • Loading branch information
makemek committed Apr 26, 2017
1 parent 087d1d7 commit 89fbdda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"body-parser": "1.17.1",
"express": "4.15.2",
"express-handlebars": "3.0.0",
"inherit": "2.2.6",
"morgan": "1.8.1",
"passport": "0.3.2",
"passport-local": "1.0.0",
Expand Down
11 changes: 5 additions & 6 deletions src/dmm/cookie-injector.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict'

const inherit = require('inherit')
const log = require('../logger')('service:dmm')
const tough = require('tough-cookie')
const Cookie = tough.Cookie

const Injector = {
class Injector {

__constructor: function(cookies, subdomains) {
constructor(cookies, subdomains) {
cookies = cookies || []
subdomains = subdomains || ['/']

Expand All @@ -16,9 +15,9 @@ const Injector = {
this.cookies = cookies
this.subdomains = subdomains
this.domain = 'dmm.com'
},
}

revokeRegionRestriction: function() {
revokeRegionRestriction() {
const targetCookie = {key: 'ckcy', value: 1}

log.info('revoke foriegner (non-japan) access restriction')
Expand Down Expand Up @@ -64,4 +63,4 @@ function generateCookies(keyVal, domains, paths) {
return cookies
}

module.exports = inherit(Injector)
module.exports = Injector

0 comments on commit 89fbdda

Please sign in to comment.