This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,4 +2,4 @@ node_modules
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.vscode
|
.vscode
|
||||||
.env
|
.env
|
||||||
public/index.html
|
public/*.html
|
||||||
|
|||||||
@@ -3,3 +3,5 @@
|
|||||||
Список Прайм предметов: https://warframe.fandom.com/wiki/Prime
|
Список Прайм предметов: https://warframe.fandom.com/wiki/Prime
|
||||||
|
|
||||||
Маркет: https://warframe.market
|
Маркет: https://warframe.market
|
||||||
|
|
||||||
|
Документация API маркета: https://warframe.market/api_docs
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module.exports = {
|
|||||||
name: 'warframe-market-bot',
|
name: 'warframe-market-bot',
|
||||||
script: './src/index.js',
|
script: './src/index.js',
|
||||||
watch: true,
|
watch: true,
|
||||||
ignore_watch: ['node_modules', 'index.html'],
|
ignore_watch: ['node_modules', 'public/*'],
|
||||||
restart_delay: 600000
|
restart_delay: 600000
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
public/assets/languages/de.png
Normal file
BIN
public/assets/languages/de.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
BIN
public/assets/languages/en.png
Normal file
BIN
public/assets/languages/en.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
public/assets/languages/fr.png
Normal file
BIN
public/assets/languages/fr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
BIN
public/assets/languages/ru.png
Normal file
BIN
public/assets/languages/ru.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
BIN
public/assets/languages/ua.png
Normal file
BIN
public/assets/languages/ua.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.0 KiB |
@@ -94,6 +94,24 @@ a {
|
|||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.languages {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.languages > a {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
margin: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.languages img {
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
margin: 32px auto;
|
margin: 32px auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module.exports = class OutputItem {
|
module.exports = class ListingSet {
|
||||||
constructor (name, parts, set) {
|
constructor (name, parts, set) {
|
||||||
this.name = name + ' prime'
|
this.name = name + ' prime'
|
||||||
this.parts = parts
|
this.parts = parts
|
||||||
22
src/output/i18n.json
Normal file
22
src/output/i18n.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"en": {
|
||||||
|
"title": "Market Gaps",
|
||||||
|
"description": "Find a profitable difference between the price of the set and the price of the sum of it's parts.",
|
||||||
|
"filter_by_difference": "Filter by difference:",
|
||||||
|
"name": "Name",
|
||||||
|
"parts_price": "Parts price",
|
||||||
|
"set_price": "Set price",
|
||||||
|
"difference": "Difference",
|
||||||
|
"generated_at": "Generated at"
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"title": "Market Gaps",
|
||||||
|
"description": "Находите выгоду между покупкой сета по отдельности и продажей его в собранном виде.",
|
||||||
|
"filter_by_difference": "Фильтровать по разнице:",
|
||||||
|
"name": "Название",
|
||||||
|
"parts_price": "Стоимость частей",
|
||||||
|
"set_price": "Стоимость сета",
|
||||||
|
"difference": "Разница",
|
||||||
|
"generated_at": "Сгенерировано в"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const Handlebars = require('handlebars')
|
const Handlebars = require('handlebars')
|
||||||
const OutputItem = require('./OutputItem')
|
const ListingSet = require('./ListingSet')
|
||||||
|
const i18n = require('./i18n.json')
|
||||||
|
|
||||||
class Output {
|
class Output {
|
||||||
constructor () {
|
constructor () {
|
||||||
@@ -9,18 +10,15 @@ class Output {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addItem (...p) {
|
addItem (...p) {
|
||||||
this.items.push(new OutputItem(...p))
|
this.items.push(new ListingSet(...p))
|
||||||
}
|
}
|
||||||
|
|
||||||
async compileTemplate () {
|
async _compileTemplate () {
|
||||||
const templateFile = await fs.readFileSync('./src/output/template.hbs', 'utf8')
|
const templateFile = await fs.readFileSync('./src/output/template.hbs', 'utf8')
|
||||||
const template = Handlebars.compile(templateFile)
|
return Handlebars.compile(templateFile)
|
||||||
return template(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async writeToFile (content) {
|
async _writeToFile (filename, content) {
|
||||||
const filename = './public/index.html'
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.unlinkSync(filename)
|
await fs.unlinkSync(filename)
|
||||||
} catch {
|
} catch {
|
||||||
@@ -31,8 +29,16 @@ class Output {
|
|||||||
|
|
||||||
async submit () {
|
async submit () {
|
||||||
this.timestamp = new Date()
|
this.timestamp = new Date()
|
||||||
const content = await this.compileTemplate()
|
const template = await this._compileTemplate()
|
||||||
await this.writeToFile(content)
|
|
||||||
|
Object.keys(i18n).forEach(locale => {
|
||||||
|
const filename = locale === 'en' ? 'index' : locale
|
||||||
|
this._writeToFile(`./public/${filename}.html`, template({
|
||||||
|
...this,
|
||||||
|
t: i18n[locale],
|
||||||
|
languages: Object.keys(i18n).filter(language => language !== locale)
|
||||||
|
}))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,16 +28,24 @@
|
|||||||
<div class="main">
|
<div class="main">
|
||||||
<img class="logo" src="./assets/warframe_logo.png">
|
<img class="logo" src="./assets/warframe_logo.png">
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<h1>Market Gaps</h1>
|
<h1>{{t.title}}</h1>
|
||||||
<p>Find a profitable difference between the price of the set and the price of the sum of it's parts.</p>
|
<p>{{t.description}}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<img id="gunner2" src="./assets/gunner2.png">
|
<img id="gunner2" src="./assets/gunner2.png">
|
||||||
|
|
||||||
|
<div class="languages">
|
||||||
|
{{#each languages}}
|
||||||
|
<a href="/{{this}}">
|
||||||
|
<img src="./assets/languages/{{this}}.png">
|
||||||
|
</a>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="main-column">
|
<div class="main-column">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label for="min-difference">Filter by difference:</label>
|
<label for="min-difference">{{t.filter_by_difference}}</label>
|
||||||
<input type="range" min="1" max="60" value="1" id="min-difference">
|
<input type="range" min="1" max="60" value="1" id="min-difference">
|
||||||
<span id="filter-value">1</span>
|
<span id="filter-value">1</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -45,10 +53,10 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>{{t.name}}</th>
|
||||||
<th>Parts price</th>
|
<th>{{t.parts_price}}</th>
|
||||||
<th>Set price</th>
|
<th>{{t.set_price}}</th>
|
||||||
<th>Difference</th>
|
<th>{{t.difference}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="items">
|
<tbody id="items">
|
||||||
@@ -69,7 +77,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="timestamp">
|
<div class="timestamp">
|
||||||
Generated at {{timestamp}}
|
{{t.generated_at}} {{timestamp}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="index.js"></script>
|
<script src="index.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user