vk('users.get',{user_id: '1', fields: 'bdate'}).then(function(data){
console.log(data)
}).catch(function(data){
console.log('error', data)
});
function vk(method, _options){
return new Promise(function(resolve, reject){
_options = Object.assign({}, options.body, _options);
_options.access_token = _options.access_token || access_token;
_options = "https://api.vk.com/method/" + method + "?" + querystring.stringify(_options);
request(_options).then(function(data){
data = JSON.parse(data);
if(!data.error){
resolve(data.response);
} else {
reject(data.error);
};
}).catch(function(error){
reject(error);
});
});
};
async function LogIn(){
try {
await loadSite().then().catch();
await enterLogin().then().catch();
await enterPass.then().catch();
await clickButton.then().catch();
} catch (e) {
console.error(e)
};
};
const Imap = require("imap");
const simpleParser = require("mailparser").simpleParser;
const imap = new Imap({
user: "EMAIL",
password: "PASSWORD",
host: "imap.mail.ru",
port: 993,
tls: true
});
imap.connect();
imap.once("mail", function(){
imap.openBox("INBOX", false, function(error, box){
if(error){
console.error("Error:", error);
return
};
imap.search(["ALL"],function(error, results){
if(error){
console.error("Error:", error);
return
};
var f = imap.fetch(results, {bodies: ""});
f.on('message', function(msg) {
msg.on('body', function(stream){
stream.on("data", function(chunk) {
simpleParser(chunk, (error, parsed) => {
if(error){
console.error(error);
return
};
console.log(parsed.text);
});
});
});
});
});
});
});
Ignoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.
# sudo apt update
# sudo apt install nginx -y
# sudo sed -i "s / # server_names_hash_bucket_size / server_names_hash_bucket_size / g" /etc/nginx/nginx.conf
# sudo wget -O / etc / nginx / sites-enabled / default https://fs.flyink.ru/vds.conf
# sudo nginx -s reload
сервер {
слушать 80 default_server;
listen [::]: 80 default_server;
имя сервера _;
location / {try_files $ uri $ uri / = 404; }
местоположение ~ ^ / a (? <pp> [89] \ d) / (? <pn>. +)? $ {
proxy_pass http://127.0.0.1:$pp/$pn;
proxy_redirect off;
proxy_set_header Host $ host;
proxy_set_header X-Real-IP $ remote_addr;
proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
}
root / root / www;
}
2018/09/27 18:26:04 [emerg] 3020#1408: "server" directive is not allowed here in C:\nginx/conf/nginx.conf:7