This commit is contained in:
Alexey Kasyanchuk
2018-11-11 23:59:38 +03:00
parent 6afe85798a
commit aa75d75448
13 changed files with 129 additions and 129 deletions

View File

@ -15,31 +15,31 @@ class PagesPie extends Component {
delete params.replace;
}
if (Array.isArray(pages)) {
for (let i in pages) {
this.pie.push({
Page: pages[i],
params: params
});
}
} else {
this.pie.push({
Page: pages,
params: params
});
}
if(this._mounted)
this.forceUpdate()
}
for (let i in pages) {
this.pie.push({
Page: pages[i],
params: params
});
}
} else {
this.pie.push({
Page: pages,
params: params
});
}
if(this._mounted)
this.forceUpdate()
}
componentWillMount()
{
this._mounted = true
}
componentWillMount()
{
this._mounted = true
}
componentWillUnmount()
{
this._mounted = false
}
componentWillUnmount()
{
this._mounted = false
}
close(count) {
if (count && typeof count === 'number') {
@ -59,7 +59,7 @@ class PagesPie extends Component {
}
// ОТРИСОВКА
render() {
if (this.pie.length > 0) {
if (this.pie.length > 0) {
return (
<div
className={'pie full-size ' + (this.props.className || '')}

View File

@ -104,19 +104,19 @@ const treeToTorrentFiles = (tree, torrent, toggles) => {
leftIcon={!tree[file].__fileBT ? <FileFolder /> : contentIcon(fileTypeDetect({path: file}))}
rightToggle={
newToggles.length > 0
?
<Toggle
toggled={newToggles.every( ({selected}) => selected )}
onToggle={(e, checked) => {
e.preventDefault()
e.stopPropagation()
let toggleValues = {}
newToggles.forEach(({downloadIndex}) => toggleValues[downloadIndex] = checked)
window.torrentSocket.emit('downloadSelectFiles', torrent, toggleValues)
}}
/>
:
null
?
<Toggle
toggled={newToggles.every( ({selected}) => selected )}
onToggle={(e, checked) => {
e.preventDefault()
e.stopPropagation()
let toggleValues = {}
newToggles.forEach(({downloadIndex}) => toggleValues[downloadIndex] = checked)
window.torrentSocket.emit('downloadSelectFiles', torrent, toggleValues)
}}
/>
:
null
}
/>);

View File

@ -302,13 +302,13 @@ export default class Torrent extends Component {
node.onclick = () => { return false }
}}>
<div className='column' style={{height: 'auto', whiteSpace: 'normal', paddingTop: '0.30em'}}>
{
torrent.info && torrent.info.name
&&
<div className='row w100p inline fs0-85' style={{color: 'grey', padding: '4px 0px 5px'}}>
{torrent.info.name}
</div>
}
{
torrent.info && torrent.info.name
&&
<div className='row w100p inline fs0-85' style={{color: 'grey', padding: '4px 0px 5px'}}>
{torrent.info.name}
</div>
}
<div className='row w100p inline'>
<div style={{color: torrent.contentCategory != 'xxx' ? (torrent.peer ? '#5252d1' : 'black') : (torrent.peer ? '#9083e2' : 'grey')}}>
{
@ -320,17 +320,17 @@ export default class Torrent extends Component {
torrent.path && torrent.path.length > 0
?
torrent.path.map((path, index) => {
const boldRe = /\<b\>(.+?)\<\/b\>/g;
let boldText;
let newPath = [];
let idx = 0;
while ((boldText = boldRe.exec(path)) !== null) {
newPath.push(<span>{path.substring(idx, boldText.index)}</span>);
newPath.push(<b>{boldText[1]}</b>);
idx = boldRe.lastIndex;
}
newPath.push(<span>{path.substring(idx, path.length)}</span>);
return <div key={index} className='break-word fs0-75' style={{paddingTop: '0.3em', marginLeft: '0.6em'}}>{newPath}</div>
const boldRe = /\<b\>(.+?)\<\/b\>/g;
let boldText;
let newPath = [];
let idx = 0;
while ((boldText = boldRe.exec(path)) !== null) {
newPath.push(<span>{path.substring(idx, boldText.index)}</span>);
newPath.push(<b>{boldText[1]}</b>);
idx = boldRe.lastIndex;
}
newPath.push(<span>{path.substring(idx, path.length)}</span>);
return <div key={index} className='break-word fs0-75' style={{paddingTop: '0.3em', marginLeft: '0.6em'}}>{newPath}</div>
})
:
null

View File

@ -30,7 +30,7 @@ export default (props) => {
{
info.trackers.includes('rutor')
&&
<a href={`http://www.rutor.is/torrent/${info.rutorThreadId}`}><img src={RutorIcon} style={{height: 32}} /></a>
<a href={`http://www.rutor.is/torrent/${info.rutorThreadId}`}><img src={RutorIcon} style={{height: 32}} /></a>
}
</div>
)

View File

@ -74,24 +74,24 @@ module.exports = async (callback, mainWindow, sphinxApp) => {
}
#one {
padding: 20px;
}
#long {
font-size: 0.8em;
padding: 10px;
}
#canBreak {
font-size: 0.8em;
padding: 10px;
}
#long {
font-size: 0.8em;
padding: 10px;
}
#canBreak {
font-size: 0.8em;
padding: 10px;
}
</style>
<script>
const {ipcRenderer} = require('electron')
ipcRenderer.on('reindex', (e, data) =>{
document.getElementById('one').innerHTML = \`Updating \${data.torrent ? 'torrent': 'file'} \${data.index} of \${data.all} [\${data.field} index]\`
if(data.longTime)
document.getElementById('long').innerHTML = 'This patch is very long, may be some hours. So you can take some cup of tea, while we perform db patch.'
if(data.canBreak)
document.getElementById('canBreak').innerHTML = 'You can break this patch, and continue when you will have time to patch, it will be resumed.'
document.getElementById('one').innerHTML = \`Updating \${data.torrent ? 'torrent': 'file'} \${data.index} of \${data.all} [\${data.field} index]\`
if(data.longTime)
document.getElementById('long').innerHTML = 'This patch is very long, may be some hours. So you can take some cup of tea, while we perform db patch.'
if(data.canBreak)
document.getElementById('canBreak').innerHTML = 'You can break this patch, and continue when you will have time to patch, it will be resumed.'
})
ipcRenderer.on('optimize', (e, data) =>{
document.getElementById('one').innerHTML = \`Optimization for \${data.field}...\`
@ -108,9 +108,9 @@ module.exports = async (callback, mainWindow, sphinxApp) => {
c4.416,0.15,17.979,1.621,17.683-4.273c-0.292-5.897-11.491-3.241-13.854-6.487c-2.359-3.234-10.023-15.504-7.366-21.104
c2.65-5.59,12.674-21.229,24.463-22.988c11.789-1.777,42.451,7.361,47.459,0c5.012-7.372-6.783-11.512-15.918-28.611
C243.779,80.572,238.768,71.728,220.195,71.427z"/>
<div id="one"></div>
<div id="long"></div>
<div id="canBreak"></div>
<div id="one"></div>
<div id="long"></div>
<div id="canBreak"></div>
</svg>
</body>
</html>

View File

@ -1,15 +1,15 @@
const fs = require('fs')
module.exports = function deleteFolderRecursive(path) {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function(file, index){
var curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function(file, index){
var curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
};

View File

@ -105,10 +105,10 @@ module.exports = class Feed {
const relativeTime = (maxTime - time) / maxTime
return (
relativeTime * relativeTime
+ good * 1.5 * relativeTime
+ comments * 4 * relativeTime
- bad * 0.6 * relativeTime
+ rating(good, bad)
+ good * 1.5 * relativeTime
+ comments * 4 * relativeTime
- bad * 0.6 * relativeTime
+ rating(good, bad)
)
}
}

View File

@ -551,7 +551,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
path,
pathIndex: path,
size
}, function(err, result) {
}, function(err, result) {
if(!result) {
console.error(err);
return

View File

@ -59,14 +59,14 @@ module.exports = class Rutor
if(!this.dataDirectory)
return
if(!this.rutorMap && fs.existsSync(this.dataDirectory + '/rutor/rutor.x.json'))
{
let data = JSON.parse(fs.readFileSync(this.dataDirectory + '/rutor/rutor.x.json'))
this.rutorMap = data.hashes
logT('rutor', 'add records to', Object.keys(this.rutorMap).length)
}
else if(!this.rutorMap)
this.rutorMap = {}
if(!this.rutorMap && fs.existsSync(this.dataDirectory + '/rutor/rutor.x.json'))
{
let data = JSON.parse(fs.readFileSync(this.dataDirectory + '/rutor/rutor.x.json'))
this.rutorMap = data.hashes
logT('rutor', 'add records to', Object.keys(this.rutorMap).length)
}
else if(!this.rutorMap)
this.rutorMap = {}
if(page > 10)
{
@ -87,18 +87,18 @@ module.exports = class Rutor
const rutorMap = this.rutorMap
$('#index tr').each(function(i, elem) {
const row = $(this)
const nameField = row.find('td').next()
if(!nameField)
const row = $(this)
const nameField = row.find('td').next()
if(!nameField)
return
let id = nameField.find('a').attr('href')
if(!id)
return
id = id.match(/download\/([0-9]+)/)[1]
id = parseInt(id)
const hash = magnetParse(nameField.find('a').next().attr('href'))
let id = nameField.find('a').attr('href')
if(!id)
return
id = id.match(/download\/([0-9]+)/)[1]
id = parseInt(id)
const hash = magnetParse(nameField.find('a').next().attr('href'))
rutorMap[hash] = id
rutorMap[hash] = id
});
await mkdirp(`${this.dataDirectory}/rutor`)
@ -130,12 +130,12 @@ module.exports = class Rutor
let contentCategory
$('#details tr').each(function(i, elem) {
const row = $(this)
const field = row.find('td.header').text()
if(field == 'Категория')
{
contentCategory = row.find('td').next().text().trim()
}
const row = $(this)
const field = row.find('td.header').text()
if(field == 'Категория')
{
contentCategory = row.find('td').next().text().trim()
}
});