Commit 2ae59785 authored by Gyeongho Park's avatar Gyeongho Park

[Add] 에듀라인 스키퍼 프로젝트 추가

parents
node_modules
npm-debug.log
\ No newline at end of file
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# Nuxt generate
dist
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE / Editor
.idea
# Service worker
sw.*
# macOS
.DS_Store
# Vim swap files
*.swp
cache/
.awspublish-*
FROM node:16
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5100
CMD [ "node", "bin/www" ]
\ No newline at end of file
socket service
\ No newline at end of file
require('dotenv').config();
const createError = require('http-errors');
const express = require('express');
const cors = require('cors');
const path = require('path');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const indexRouter = require('./routes/index');
const app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(logger('dev'));
app.use(express.json({ limit: '10mb' }));
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use(cors());
app.use('/', indexRouter);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
// res.status(err.status || 500);
// res.render('error');
res.status(errorcode.c001.status).json(errorcode.c001)
});
module.exports = app;
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('rms-socket:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '5100');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port, () => {
console.log(`> http://localhost:${port}`);
});
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
This diff is collapsed.
{
"name": "ves",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"axios": "^1.5.0",
"cookie-parser": "~1.4.4",
"cors": "^2.8.5",
"debug": "~2.6.9",
"dotenv": "^16.3.1",
"ejs": "~2.6.1",
"express": "~4.16.1",
"http-errors": "~1.6.3",
"morgan": "~1.9.1",
"multer": "^1.4.5-lts.1",
"node-schedule": "^2.1.1",
"xml2json": "^0.12.0"
}
}
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
color: #00B7FF;
}
var express = require('express');
var router = express.Router();
const axios = require('axios')
const FormData = require('form-data')
const host = 'www.allteaching.biz'
const origin = 'https://' + host
const referer = host + '/lms/plugin/player/ecom_player.php'
const contentType = 'application/x-www-form-urlencoded; charset=UTF-8'
const updateUrl = origin + '/lms/plugin/player/ecom_player_update.php'
const cookie = 'PHPSESSID=w5~23diso4fplt1feldogvbi02iv0; f33d2ed86bd82d4c22123c9da444d8ab=MTcwMTQxNjI1OA%3D%3D; 96b28b766b7e0699aa91c9ff3d890663=aHR0cHM6Ly92YXppbC5hbGx0ZWFjaGluZy5iaXov; 2a0d2363701f23f8a75028924a3af643=NTkuMjEuMzQuMjE0; _fwb=199OMLbBRwg0Gxxo5nlnYar.1701907345571; _gcl_au=1.1.1965615246.1701907346; _gid=GA1.2.2096362701.1701907346; wcs_bt=s_53d0704a39a1:1701907366; _ga=GA1.1.9905246.1701907346; _ga_3LZR51WJST=GS1.1.1701907346.1.1.1701907369.0.0.0; _ga_YTEBTSNC3S=GS1.1.1701907346.1.1.1701907369.37.0.0; play=%7B%22wr_id%22%3A%221831672%22%2C%22p_id%22%3A%228d19cbcda62e5e77773cff0596e474f3%22%2C%22s_id%22%3A%22aasc%22%2C%22wr_order%22%3A%221%22%2C%22sample_mode%22%3Afalse%7D; move_prev=false; page_time=%7B%22key%22%3A%2265711364e299a%22%2C%22time%22%3A'
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Vazil Eduline Skipper' });
});
router.post('/skip', async (req, res, next) => {
try {
const { p_id, s_id, wr_id} = req.body
let responses = []
for(let i = 0; i < 14; i++) {
let response = {
start: false,
end: false
}
const formData = new FormData()
formData.append('p_id', p_id)
formData.append('s_id', s_id)
formData.append('wr_order', 22)
formData.append('wr_page', (i+1))
formData.append('wr_id', wr_id)
let rand = parseInt((Math.random() * 10000) + 1000000)
let add = parseInt(Math.random() * 100000)
let startTimestamp = ((parseInt(Date.now()) - rand) + '').substring(0, 10)
let endTimestamp = ((parseInt(Date.now()) - (rand - add)) + '').substring(0, 10)
console.log(i + ' 번째 요청 ', startTimestamp, endTimestamp)
const config = {
headers: {
'Origin': origin,
'Host': host,
'Referer': referer,
'Content-Type': contentType
}
}
config.headers['Cookie'] = cookie + startTimestamp + '%7D'
await axios.post(updateUrl, formData, config)
.then(res=>{
console.log('start clear', res.data)
response = res.data
})
.catch(err=>{
console.log('start error', err)
})
responses.push(response)
}
res.status(200).json(responses)
} catch (err) {
console.error(err);
next(err)
}
})
// health
router.get('/health', function(req, res, next) {
res.status(200).json('ok')
})
module.exports = router;
sudo git pull
sudo docker build -t ves .
sudo docker stop ves
sudo docker rm ves
sudo docker run -d --restart=always --name ves -p 5100:5100 -it ves
\ No newline at end of file
<h1><%= message %></h1>
<h2><%= error.status %></h2>
<pre><%= error.stack %></pre>
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<h1><%= title %></h1>
<p>Welcome to <%= title %></p>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment