Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
379 commits
Select commit Hold shift + click to select a range
1e3186a
git ignore
ridweng Feb 11, 2022
68fcc00
Fixed edit
ridweng Feb 11, 2022
d79c043
Dist ais
ridweng Feb 11, 2022
ab8cdca
advanced report generate
shangray Feb 11, 2022
5ad6895
Css added
ridweng Feb 14, 2022
e542f52
css
ridweng Feb 14, 2022
d965c58
name added
ridweng Feb 14, 2022
252f613
stable
ridweng Feb 14, 2022
53a81b9
Merge branch 'develop' into add-scope
ridweng Feb 14, 2022
c80c1e7
Merge pull request #38 from WorkPlaceForMe/add-scope
ridweng Feb 14, 2022
8286a1d
login added
shangray Feb 14, 2022
adfae78
Merge branch 'develop' into add-scope-login
ridweng Feb 15, 2022
999c174
Merge pull request #39 from WorkPlaceForMe/add-scope-login
ridweng Feb 15, 2022
ff36bea
Update 2.2.9
ridweng Feb 15, 2022
9ad5a57
Dist updated
ridweng Feb 15, 2022
c750345
Ad moved
ridweng Feb 16, 2022
12fde4c
Update total number of images fixed
ridweng Feb 16, 2022
c31f416
Checker for duplicates updated
ridweng Feb 18, 2022
b719dd1
updated
ridweng Feb 18, 2022
31cdeaa
Updated admin
ridweng Feb 21, 2022
5bed6ed
manual updated
ridweng Feb 22, 2022
f7a186a
ads
ridweng Feb 22, 2022
0f29901
updt
ridweng Feb 22, 2022
62639f7
up
ridweng Feb 22, 2022
edb6566
up
ridweng Feb 22, 2022
c90ed23
aa
ridweng Feb 22, 2022
52091cf
aaa
ridweng Feb 22, 2022
5319476
a
ridweng Feb 22, 2022
66de58b
update
ridweng Feb 22, 2022
914fbfc
Filtered
ridweng Feb 22, 2022
a7e8bf1
fixed
ridweng Feb 22, 2022
7867751
tables
ridweng Feb 22, 2022
5eda7d1
fixed each row on site dashboard
ridweng Feb 22, 2022
9a06a74
updt
ridweng Feb 22, 2022
ea527d6
a
ridweng Feb 22, 2022
89ddc50
ridweng Feb 22, 2022
7cb8137
aaa
ridweng Feb 22, 2022
ed35662
aa
ridweng Feb 22, 2022
c8c81c6
ridweng Feb 22, 2022
8086e41
fix
ridweng Feb 22, 2022
ee66140
11
ridweng Feb 22, 2022
acb6061
Fixed report handler
ridweng Feb 22, 2022
85229b8
Sites
ridweng Feb 22, 2022
95f2266
Del site on accesstrade
ridweng Feb 22, 2022
cf40b77
Front end
ridweng Feb 23, 2022
4c46c8e
Sites fixed
ridweng Feb 23, 2022
579b701
v2.2.12
ridweng Mar 2, 2022
989e2d4
index
ridweng Mar 3, 2022
77e2958
Ssl
ridweng Mar 8, 2022
78ac9f4
v2.2.14
ridweng Mar 11, 2022
4c707e5
index for adscope test
ridweng Mar 11, 2022
3207132
index
ridweng Mar 11, 2022
1905b59
v2.2.15
ridweng Mar 11, 2022
0e7f7d9
Support
ridweng Mar 21, 2022
f48ef70
Adding jquery in js indirectly so that g3c.scan.image.sph.js can be d…
Apr 28, 2022
9e1f913
Check
ridweng Apr 28, 2022
12680bc
Merged
ridweng Apr 28, 2022
01a27e9
Using relative path for assets
May 5, 2022
e9d2a29
check
ridweng May 6, 2022
7e84f5d
Latest
ridweng May 6, 2022
6f62cc2
V2.3.2
ridweng May 6, 2022
ef91f94
Fixing Jquery not loading issue
May 11, 2022
6bce857
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
May 11, 2022
8809350
Making ajax call async and using lower case name for tables
May 17, 2022
7fefac3
Lowercase tables on repors and dashboard
ridweng May 17, 2022
30254bd
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ridweng May 17, 2022
cde057a
Test
ridweng May 17, 2022
f484c10
Ignoring empty response from redis cache
May 18, 2022
37bb581
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
May 18, 2022
574d75d
Checks
ridweng May 18, 2022
2f94fe6
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ridweng May 19, 2022
616d781
Dependencies fixed
ridweng May 20, 2022
24711b7
Adding async attribute to false so that script loaded in order
May 20, 2022
ef4368b
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
May 20, 2022
64ccb0e
Fixing issue where last image was not processing
May 20, 2022
118b250
Setting cache seter async and fixing object property missing bug
May 23, 2022
95c357c
v2.3.4
ridweng May 23, 2022
b969594
Saving Redis cache saving sync when updating download status
May 24, 2022
9ed8fb4
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
May 24, 2022
79237f9
Manual updated
ridweng May 24, 2022
e45f715
Adding iframe and localStorage code for cross domain tracking
Jun 3, 2022
6d6fa56
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
Jun 3, 2022
c94baa9
Fixing ads issue
ranjit3t Jun 6, 2022
ca9967f
var to const
ridweng Jun 6, 2022
49443c1
updated ver
ridweng Jun 6, 2022
fd9713d
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ridweng Jun 6, 2022
dbade58
Relation of client Id
ridweng Jun 6, 2022
bf63332
Changing tp addEventaddEventListener for load event
ranjit3t Jun 6, 2022
24cc2c8
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ranjit3t Jun 6, 2022
7505447
Category and keyword added to images
ridweng Jun 7, 2022
7f079df
Removed comments
ridweng Jun 7, 2022
f895d0e
Removed coma
ridweng Jun 7, 2022
65b8799
Integer to string on clientId
ridweng Jun 7, 2022
eaa0496
Adding user tracking data to tables
ranjit3t Jun 8, 2022
5e2e666
Adding duration for image view
ranjit3t Jun 9, 2022
47c36d1
Adding image field to clientImgPubl as we have duplicate images
ranjit3t Jul 4, 2022
8176fcd
Adding code for client report end point
ranjit3t Jul 5, 2022
fa03379
Ids added in readCsv
ridweng Jul 6, 2022
6dc84ac
Id changed in download area
ridweng Jul 6, 2022
bda6c30
Changing code for client id creation when client id does not exist in…
ranjit3t Jul 7, 2022
b238c2e
New ids
ridweng Jul 11, 2022
e661498
Changing code for for csv download and further product setup
ranjit3t Jul 13, 2022
3cb4aba
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ranjit3t Jul 13, 2022
62c08cb
Reverting index.html
ranjit3t Jul 13, 2022
cd784f5
Reverting unnecessary code
ranjit3t Jul 13, 2022
d3bafb0
Fixing bugs
ranjit3t Jul 14, 2022
14f602b
Making product match condition more lenient
ranjit3t Jul 14, 2022
2c6aac5
Fixing product csv download authentication issue
ranjit3t Jul 14, 2022
370ddc1
Creating csv parser for each shopping provider
ranjit3t Jul 18, 2022
405942c
COmmiting iframe
ranjit3t Jul 18, 2022
89dec18
Modifying code for larrge csv download and code refactoring
ranjit3t Jul 20, 2022
4e74d8a
Getting random results from database for product and clothes
ranjit3t Jul 20, 2022
a886153
Fixing missing siteId bug
ranjit3t Jul 20, 2022
2c8962e
Changing downloaded csv file name to include site id
ranjit3t Jul 21, 2022
a8784d8
Clearing cache for publisger and updating product and cloth data
ranjit3t Jul 21, 2022
971b758
Removing async keyword and changing method name
ranjit3t Jul 21, 2022
b91e31b
Modifying code to delete cache after product/cloth reloading and code…
ranjit3t Jul 23, 2022
5023782
Improving cloth detection
ranjit3t Jul 25, 2022
6baa231
Dependencies update
ridweng Jul 26, 2022
2cff1a5
Changed path for downloaded files to folder csv
ridweng Jul 26, 2022
efe4ffb
Changed location to define name of downloaded files
ridweng Jul 26, 2022
2aaebba
Making changes for cloth,sports and beauty detection code
ranjit3t Jul 27, 2022
2e5635f
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ranjit3t Jul 27, 2022
7605181
Removing True Shopping as a provider
ranjit3t Jul 27, 2022
fef6d48
Removed True Shopping csv reader
ranjit3t Jul 27, 2022
abcccbb
Removed True Shopping csv reader reference
ranjit3t Jul 27, 2022
888f6ee
Externalize provider campaign ids
ranjit3t Jul 29, 2022
34c2cdf
Test benchmark
ridweng Jul 29, 2022
6543ee1
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ridweng Jul 29, 2022
4bfa81c
Improving mobile and beauty suggestion
ranjit3t Aug 1, 2022
4802a36
Removing duplicate products from a single image result
ranjit3t Aug 1, 2022
38c05fc
Adding redis properties
ranjit3t Aug 5, 2022
2441030
Adding redis password
ranjit3t Aug 5, 2022
40ea6b5
Diversify product/cloth suggestions
ranjit3t Aug 9, 2022
eafc6fd
Adding logger and axis retry request
ranjit3t Aug 11, 2022
2adf67c
Changing err to error
ranjit3t Aug 11, 2022
4afd107
Catching error when csv download or setup fails
ranjit3t Aug 11, 2022
142cf0a
Handling parallel request for a single image
ranjit3t Aug 16, 2022
d74e1cb
Changing file location
ranjit3t Aug 16, 2022
84c44a7
Preventing publisher update when update already in progress
ranjit3t Aug 16, 2022
39226bb
Seeting downloading value true when downloading starts
ranjit3t Aug 16, 2022
58f6075
Adding logger
ranjit3t Aug 16, 2022
eb3bcb1
Adding logger
ranjit3t Aug 16, 2022
799b96e
Changing brackets
ranjit3t Aug 16, 2022
48e7e7a
Adding db port
ranjit3t Aug 16, 2022
466e52b
Fixing reporting
ranjit3t Aug 17, 2022
c977b96
Changing name to Image Icon Impressions
ranjit3t Aug 17, 2022
fc23ee1
Fixing code for capturing clicks and impressions
ranjit3t Aug 17, 2022
94adcd2
Changing code for reporting
ranjit3t Aug 17, 2022
e97a157
Making client web path relative
ranjit3t Aug 17, 2022
cd8cab9
Modifying server path relative
ranjit3t Aug 17, 2022
ddd4d48
Updating rewards on update button
ranjit3t Aug 17, 2022
cc58056
Fixing report export
ranjit3t Aug 18, 2022
7694aca
If one provider data is not downloaded ignoring it and continuing
ranjit3t Aug 19, 2022
3665b57
Dist added
ridweng Aug 19, 2022
1e3699c
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ridweng Aug 19, 2022
f9965b5
Added create and edit to dashboard
ridweng Aug 19, 2022
787da4b
Dist updated
ridweng Aug 19, 2022
0923a2e
Fixing code for not adding same site multiple times
ranjit3t Aug 19, 2022
f589fdc
Adding logger during site registration
ranjit3t Aug 19, 2022
0b5775a
Querying image based on url and site
ranjit3t Aug 19, 2022
f0c4cf0
does not exist
ranjit3t Aug 19, 2022
5c81706
Adding provision for receiving different advertisement for same image…
ranjit3t Aug 19, 2022
e5e8664
Adding UUID to downloaded csv so that system never crash when somehow…
ranjit3t Aug 20, 2022
906969b
Making changes to tackle duplicate sessions or when client id does no…
ranjit3t Aug 22, 2022
6119ba6
Modifying try/catch to handle exception when insetion fails in client…
ranjit3t Aug 22, 2022
c871886
Externalize ssl certificate path
ranjit3t Aug 23, 2022
4d1564a
Code for showing background image adverstisement
ranjit3t Aug 25, 2022
56a44bf
Increase heap memory
ranjit3t Aug 25, 2022
f9f644f
Using span instead of div
ranjit3t Aug 25, 2022
9139167
Changing port
ranjit3t Aug 27, 2022
615d69a
Encode URI and changing axios retyr time and logic
ranjit3t Aug 29, 2022
92dae14
Adding functionality of detecting background image properly
ranjit3t Aug 29, 2022
f7a7ea3
Adding logic for showing ads for little small images
ranjit3t Aug 29, 2022
90ba005
Decreasing image size
ranjit3t Aug 30, 2022
8fed6f5
Reverting image size
ranjit3t Aug 30, 2022
e7300f9
Changing cache and database calls for performance improvement
ranjit3t Aug 30, 2022
4c3e4fe
Improve caching
ranjit3t Aug 30, 2022
2f2b0e2
Increasing column size
ranjit3t Aug 31, 2022
56c509d
Allowing null for table
ranjit3t Aug 31, 2022
4532ded
Increasing column size
ranjit3t Aug 31, 2022
db59a38
Catching exception during database operation
ranjit3t Aug 31, 2022
2b313ef
Increased table column sizes
ranjit3t Aug 31, 2022
535bd34
Adding functionality for catching uncaught exception so that server d…
ranjit3t Aug 31, 2022
c1e3aa4
Removing logger and reverting code
ranjit3t Sep 1, 2022
6a2cd6b
Sorting affililiate result based on vista confifidence and improving …
ranjit3t Sep 2, 2022
4e267ac
getStrippedURL
ranjit3t Sep 4, 2022
2e1bf37
Making alias matching lower case
ranjit3t Sep 4, 2022
139c28c
Removed minimum 60% vista confidence level clause
ranjit3t Sep 5, 2022
959df16
Adding product aliases
ranjit3t Sep 5, 2022
3b99bc3
Fixing reporting bug
ranjit3t Sep 6, 2022
ac55c87
ranjit3t Sep 6, 2022
9a05830
Fixing background image search bug
ranjit3t Sep 8, 2022
023e9c9
Fixing few reporting bugs
ranjit3t Sep 8, 2022
1ac7353
Adding functionality for ads per image for a website
ranjit3t Sep 8, 2022
61ca0d9
Adding code for max and min ads validation
ranjit3t Sep 9, 2022
a3248a7
Code for unique vistors and duration count
ranjit3t Sep 9, 2022
2c64dc5
Error logging
ranjit3t Sep 9, 2022
e150a29
Fixing query
ranjit3t Sep 9, 2022
ef88f38
Adding user count, duration in website, web page html and website report
ranjit3t Sep 10, 2022
1d0a8fa
idItem
ranjit3t Sep 11, 2022
bd592c6
Modifying group condition
ranjit3t Sep 11, 2022
4bb46c1
Error occurred in client publisher data saving
ranjit3t Sep 11, 2022
944bebd
Fixing category report
ranjit3t Sep 11, 2022
506016b
Fix
ranjit3t Sep 11, 2022
1fdcd43
Rearranging report column names
ranjit3t Sep 12, 2022
af83a72
Ad level report
ranjit3t Sep 12, 2022
7939712
Fixing issue
ranjit3t Sep 12, 2022
bd2c2e3
Using set
ranjit3t Sep 13, 2022
6e689ac
FIxing report
ranjit3t Sep 13, 2022
f4d2bac
Bug fix for publisher delete and report
ranjit3t Sep 14, 2022
cdbf59c
Fixing site add and deletion
ranjit3t Sep 14, 2022
0cd0a47
Adding website reload functionality
ranjit3t Sep 15, 2022
f41a34a
Fixing ad report bug
ranjit3t Sep 15, 2022
93a2a61
Changing Dashboard UI code
ranjit3t Sep 16, 2022
37fbd30
Adding functionality for specifying different pattern for website
ranjit3t Sep 17, 2022
84179e8
Removed unused variable
ranjit3t Sep 19, 2022
c0ca4b3
Modifying message for delete publisher
ranjit3t Sep 20, 2022
f8f6102
Modifying logic for site deletion
ranjit3t Sep 20, 2022
3bed600
Fixing web page report
ranjit3t Sep 20, 2022
14c773c
Correcting spelling mistake
ranjit3t Sep 20, 2022
99db436
Modifying image wise report
ranjit3t Sep 20, 2022
27b0a9d
Adding vist detection keywords in adspages table
ranjit3t Sep 22, 2022
f95b5e5
AdsPerImage per page server side change
ranjit3t Sep 24, 2022
bf2a93a
Max Ads Per Image client side changes
ranjit3t Sep 25, 2022
e3eb92c
Fixing trailing / for page issue
ranjit3t Sep 25, 2022
bfc4ef4
Syncing code with latest vista changes
ranjit3t Sep 26, 2022
630afdd
Fix
ranjit3t Sep 26, 2022
f040da2
Using host url
ranjit3t Sep 26, 2022
e290f9b
Adding vista keywords and product category for ad level report
ranjit3t Sep 27, 2022
6cb052b
Adding end point for client publisher data
ranjit3t Sep 27, 2022
3794375
Renaming end point to getAllClientSessionData
ranjit3t Sep 27, 2022
ae3bf87
Adding session data end point
ranjit3t Sep 27, 2022
3dafcb0
Adding session id
ranjit3t Sep 27, 2022
19ba3b6
Modifying client data output
ranjit3t Sep 27, 2022
f425f30
adsperimage
ranjit3t Sep 29, 2022
6c763c5
Used 400 status code
ranjit3t Sep 29, 2022
0cbbaca
interceptor
ridweng Oct 3, 2022
30d1e4b
Merge branch 'develop' of https://github.com/WorkPlaceForMe/ads into …
ridweng Oct 3, 2022
95ba0ac
dist changed
ridweng Oct 3, 2022
693d5f9
auth for certain endpoints
ridweng Oct 3, 2022
6fdc553
distAis
ridweng Oct 3, 2022
9a3c51f
new dist
ridweng Oct 3, 2022
ec64421
dist
ridweng Oct 3, 2022
6e4b505
dist
ridweng Oct 3, 2022
2749d36
Trying to show ads only for element which are in view port
ranjit3t Oct 13, 2022
d6a6cc9
Modifying API
ranjit3t Oct 13, 2022
6a75034
Changing API
ranjit3t Oct 13, 2022
32c5791
pages/sign-in
ranjit3t Oct 13, 2022
9725256
Prod version of distAis
ranjit3t Oct 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 5 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
app.properties
public/**
!public/g3c.scan.image.sph.js
!public/index.html
!public/pictures/iconBorder.gif
!public/pictures/vector2x.png
!public/pictures/graymaticsLogo.png
adscopeManual.docx
.eslintrc.js
.prettierrc
Expand All @@ -14,4 +15,6 @@ csv/**
!csv/objetos2.json
index.html
startDocker.sh
.gitignore
.gitignore
oldDist
test.js
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ public/**
!public/g3c.scan.image.sph.js
!public/pictures/iconBorder.gif
!public/pictures/vector2x.png
!public/iframe.html
adscopeManual.docx
.eslintrc.js
.prettierrc
access.log
node_modules/**
clientClient
clientAis
clientAis/node_modules/**
clientClient/node_modules/**
csv/**
!csv/objetos2.json
index.html
startDocker.sh
startDocker.sh
oldDist
test.js
.vscode/settings.json
.gitignore
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node
FROM node:12-alpine

WORKDIR /usr/src/app

Expand Down
Binary file modified adscopeManual.pdf
Binary file not shown.
189 changes: 147 additions & 42 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const express = require('express')
const path = require('path')
const cookieParser = require('cookie-parser')
const logger = require('morgan')
const handleError = require('./helper/handle-error')
const routers = require('./routes')
const cors = require('cors')
Expand All @@ -10,60 +9,142 @@ const mysql = require('mysql2/promise')
const app = express()
const port = conf.get('port')
const portS = conf.get('portS')
const https = require('https');
const http = require('http');
const fs = require('fs');
const shell = require("shelljs");
const refreshTimeInterval = conf.get('refresh_time_interval') || 604800000
const https = require('https')
const http = require('http')
const fs = require('fs')
const options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
key: fs.readFileSync(conf.get('ssl_key_file_path')),
cert: fs.readFileSync(conf.get('ssl_cert_file_path'))
}
const sequelize = require('./campaigns-db/database')
const httpsServer = https.createServer(options, app);
const httpServer = http.createServer(app);
const httpsServer = https.createServer(options, app)
const httpServer = http.createServer(app)
const db = require('./campaigns-db/database')
const products = db.products
const clothing = db.clothing
const publishers = db.publishers
const User = db.users
const { delay } = require('bluebird')
const bcrypt = require('bcrypt')
const axios = require('axios')
const axiosRetry = require('axios-retry')
const { reloadPublisher } = require('./helper/util')

let server = conf.get('server').split('/')
server[2] = `www.${server[2]}`
server = server.join('/')

app.use(express.json())
app.use(express.urlencoded({ extended: false }))
app.use(cookieParser())
app.use(cors())

require("./helper/cacheManager");
require('./helper/cacheManager')

function customHeaders(req, res, next) {
app.disable('X-Powered-By')
res.setHeader('X-Powered-By', 'Graymatics-server')
next()
}

process.on('uncaughtException', (err) => {
console.log('Unexpected error occurred')
console.log(err)
})

app.use(customHeaders)

app.all(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE')
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept, x-access-token',
)
next()
})

async function check() {
const publisherList = await publishers.findAll()

if (publisherList) {
for (const publisher of publisherList) {
const sampleProductClothList = await Promise.all([products.findOne({ where: { Page_ID: publisher.dataValues.publisherId } }),
clothing.findOne({ where: { Page_ID: publisher.dataValues.publisherId } })])
const updatedAtTime = publisher.dataValues.updatedAt.getTime()
const currentTime = new Date().getTime()

if((currentTime - updatedAtTime) >= refreshTimeInterval || (!sampleProductClothList[0] && !sampleProductClothList[1])) {
reloadPublisher(publisher)
}
}
}

//Wait and run the same method after 1 day
await delay(86400000)

return check()
}

async function createAdminUser() {
const adminCreated = await User.findOne({ where: { username: 'adminAis' } })
if (!adminCreated) {
await User.create({
username: 'adminAis',
password: bcrypt.hashSync('AisGraymatics1!', 12),
email: 'test@graymatics.com',
role: 'ADMIN',
})
}
}

if (conf.get('install') == true) {
console.log("Installing DB")
console.log('Installing DB...')
mysql
.createConnection({
user: conf.get('user'),
password: conf.get('password'),
host: conf.get('host')
})
.then(connection => {
connection.query('CREATE DATABASE IF NOT EXISTS ' + conf.get('database') + ' CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci;').then(() => {
sequelize.sequelize.sync({force: true}).then(()=>{
console.log('sequelize is connected')
}).catch(err =>{
console.error('no se concecto',err)
})
.createConnection({
user: conf.get('user'),
password: conf.get('password'),
host: conf.get('host'),
port: conf.get('dbport')
})
})
.then((connection) => {
connection
.query(
'CREATE DATABASE IF NOT EXISTS ' +
conf.get('database') +
' CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci;',
)
.then(() => {
sequelize.sequelize
.sync({ force: false, alter: true })
.then(() => {
console.log('Sequelize is connected and updated.')
createAdminUser()
check()
})
.catch((err) => {
console.error('Sequelize was not able to connect.', err)
})
})
})
} else {
console.log('Sequelize is connected.')
check()
}

// view engine setup
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'pug')
app.use(logger('Date: :date[web] // Url: :remote-addr // Method: :method:url // Status::status // User-agent: :user-agent'))
app.use(logger('Date: :date[web] // Url: :remote-addr // Method: :method:url // Status::status // User-agent: :user-agent',
{
stream: fs.createWriteStream('./access.log', { flags: 'a' })
}
)
)
app.use('/system',express.static(path.join(__dirname, 'public')))
app.set('view engine', 'jade')
app.use('/not-found', express.static('./views/error.html'))

app.use('/system', express.static(path.join(__dirname, 'public')))

app.use('/management',express.static(conf.get('dashboardAis')));
app.use('/system/2', express.static(path.join(__dirname, 'public')))

app.use('/client',express.static(conf.get('dashboardClient')));
app.use('/management', express.static(conf.get('dashboardAis')))

app.use('/client', express.static(conf.get('dashboardClient')))

app.use('/api/pictures', express.static('./public/pictures'))

Expand All @@ -73,11 +154,35 @@ app.use(routers)
// global error handling
app.use(handleError)

httpsServer.listen(portS || 3000, function () {
console.log(`App is up on port ${portS || '3000'} on HTTPS`)
});
// 404 re-route
app.get('*', function (req, res) {
const path = req._parsedUrl.path.split('/')[1]
switch (path) {
case 'management':
return res.redirect('/management')
case 'client':
return res.redirect('/client')
default:
return res.redirect('/not-found')
}
})

httpsServer.listen(portS || 3311, function () {
console.log(`App is running on HTTPS mode using port: ${portS || '3311'}`)
})

httpServer.listen(port || 3000, function () {
console.log(`App is up on port ${port || '3000'} on HTTP`)
});
httpServer.listen(port || 3310, function () {
console.log(`App is running on HTTP mode using port: ${port || '3310'}`)
})

axiosRetry(axios, {
retries: 2,
retryDelay: (retryCount) => {
console.log(`retry attempt: ${retryCount}`)
return retryCount * 1000
},
retryCondition: (error) => {
return (error && (error.reponse == null || error.response.status !== 200 ||
error.response.status !== 201 || error.response.status !== 404 || error.response.status !== 500))
}
})
57 changes: 42 additions & 15 deletions app.properties
Original file line number Diff line number Diff line change
@@ -1,26 +1,53 @@
vista_api_url=
vista_api_user=
vista_api_password=
vista_api_url=http://20.119.220.118
vista_api_user=admin
vista_api_password=admin
server=http://localhost:3310

accesstrade_endpoint=https://gurkha.accesstrade.in.th

accesstrade_user=
accesstrade_pass=
accesstrade_user=alex@graymatics.com
accesstrade_pass=GDdpeQB!nH8tCD9o

host=localhost
user=
password=
database=ads1
dbport=3306
user=graymatics
password=graymatics
database=campaign

port=3309
portS=3310

port=3310
portS=3311
install=true

install=false
dashboardAis=./distAis
dashboardClient=./distClient

dashboardAis= ./distAis
dashboardClient= ./distClient

redis_host= localhost
redis_host=127.0.0.1
redis_port=6379
redis_password=''

#Product and cloth Refresh time interval in milisecond
refresh_time_interval=604800000

#Campaign id for providers
bigc.campaign_id=308
lazada.campaign_id=520
topsOnline.campaign_id=704
jdCentral.campaign_id=722
centralOnline.campaign_id=730

#SSL Configuration
ssl_key_file_path=key.pem
ssl_cert_file_path=cert.pem

#CSV download folder location
csv_download_folder_location=csv

#dataset size
male_cloth_dataset_size=7500
female_cloth_dataset_size=7500
product_dataset_size=15000

#min and max possible ads for image for publishers
min_possible_ads_count_per_image=1
max_possible_ads_count_per_image=4
24 changes: 24 additions & 0 deletions benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const autocannon = require('autocannon')
const { PassThrough } = require('stream')

function run (url) {
const buf = []
const outputStream = new PassThrough()

const inst = autocannon({
url,
connections: 100,
duration: 20
})

autocannon.track(inst, { outputStream })

outputStream.on('data', data => buf.push(data))
inst.on('done', function () {
process.stdout.write(Buffer.concat(buf))
})
}

console.log('Running all benchmarks in parallel ...')

run('http://localhost:3310/system/')
Loading