mirror of
https://github.com/anatolykopyl/status.git
synced 2026-03-26 21:04:48 +00:00
Made file reading sync
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import Express from "express";
|
import Express from "express";
|
||||||
import Cors from "cors";
|
import Cors from "cors";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import fs from "fs";
|
||||||
const __dirname = path.resolve();
|
const __dirname = path.resolve();
|
||||||
|
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
@@ -17,17 +18,12 @@ app.use(Cors());
|
|||||||
|
|
||||||
app.get('/update', (req, res) => {
|
app.get('/update', (req, res) => {
|
||||||
var id = statusIds[Math.floor(Math.random() * statusIds.length)];
|
var id = statusIds[Math.floor(Math.random() * statusIds.length)];
|
||||||
let token;
|
let token = fs.readFileSync('../../get-vk-token/token.txt', 'utf8');
|
||||||
fs.readFile('../get-vk-token/token.txt', 'utf8', function(error, data) {
|
console.log(token);
|
||||||
if (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
token = data;
|
|
||||||
});
|
|
||||||
let url = `https://api.vk.com/method/status.setImage?access_token=${token}&status_id=${id}&v=5.103`;
|
let url = `https://api.vk.com/method/status.setImage?access_token=${token}&status_id=${id}&v=5.103`;
|
||||||
httpsReq(url).then((response) => {
|
httpsReq(url).then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
//res.redirect("https://status.anatolykopyl.ru");
|
res.redirect("https://status.anatolykopyl.ru");
|
||||||
res.send();
|
res.send();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user