Browse Source

Some code quality improvements

tags/v1.4.4
Ivan Bravo Bravo 11 months ago
parent
commit
b8b763a5b1

+ 1
- 1
.github/ISSUE_TEMPLATE/bug_report.md View File

@@ -1,6 +1,6 @@
---
name: Bug report
about: Something has not worked? Use this template.
about: Help us improve by reporting any problem.
title: ''
labels: bug
assignees: ''

+ 16
- 16
README.md View File

@@ -55,11 +55,11 @@ If you want to share or modify this Software please do it for the same purpose a

## Requirements

- 64 bits OS
- Windows 7 SP1/Windows 8/Windows 10 1803+
- Ubuntu 16.04+
- 🧪 macOS
- **8 GB** of RAM or more.
- 64 bits OS
- Windows 7 SP1/Windows 8/Windows 10 1803+
- Ubuntu 16.04+
- 🧪 macOS
- **8 GB** of RAM or more.

> ⚠ **N versions of Windows 10** require installing the [Media Feature Pack](https://www.microsoft.com/en-us/software-download/mediafeaturepack).

@@ -67,8 +67,8 @@ If you want to share or modify this Software please do it for the same purpose a

## GPU Processing Requirements

- NVIDIA Graphics card with minimum [3.5 CUDA compute capability](https://developer.nvidia.com/cuda-gpus)
- [Latest NVIDIA drivers](https://www.nvidia.com/Download/index.aspx)
- NVIDIA Graphics card with minimum [3.5 CUDA compute capability](https://developer.nvidia.com/cuda-gpus)
- [Latest NVIDIA drivers](https://www.nvidia.com/Download/index.aspx)

> 👉 If you do not have an NVIDIA or compatible graphics card you can use CPU processing.

@@ -99,18 +99,18 @@ We do not store any personal information or photos that have been processed with

## Requirements

- [CUDA 10.0](https://developer.nvidia.com/cuda-10.0-download-archive)
- [Python 3.6.2+](https://www.python.org/downloads/release/python-368/)
- [NodeJS 10+](https://nodejs.org/en/)
- [Yarn](https://yarnpkg.com/en/docs/install)
- [CUDA 10.0](https://developer.nvidia.com/cuda-10.0-download-archive)
- [Python 3.6.2+](https://www.python.org/downloads/release/python-368/)
- [NodeJS 10+](https://nodejs.org/en/)
- [Yarn](https://yarnpkg.com/en/docs/install)

## What should I know?

- [HTML, CSS](https://www.codecademy.com/catalog/language/html-css), [JavaScript](https://www.codecademy.com/catalog/language/javascript): For website development (DreamTime is a website 😮)
- [SCSS](https://sass-lang.com/): CSS Preprocessor
- [TailwindCSS](https://tailwindcss.com/): CSS Framework
- [VueJS](https://vuejs.org/), [NuxtJS](https://nuxtjs.org/): The JavaScript frameworks. _(VueJS is the best #changemymind)_
- [Electron](https://electronjs.org/): The software used to "transform" DreamTime from a website to a desktop program.
- [HTML, CSS](https://www.codecademy.com/catalog/language/html-css), [JavaScript](https://www.codecademy.com/catalog/language/javascript): For website development (DreamTime is a website 😮)
- [SCSS](https://sass-lang.com/): CSS Preprocessor
- [TailwindCSS](https://tailwindcss.com/): CSS Framework
- [VueJS](https://vuejs.org/), [NuxtJS](https://nuxtjs.org/): The JavaScript frameworks. _(VueJS is the best #changemymind)_
- [Electron](https://electronjs.org/): The software used to "transform" DreamTime from a website to a desktop program.

## Setup


+ 22
- 0
src/.codeclimate.yml View File

@@ -0,0 +1,22 @@
version: '2'

plugins:
eslint:
enabled: true
config:
extensions:
- .js
- .vue
fixme:
enabled: true
config:
strings:
- TODO
- FIXME
- BUG

editorconfig:
enabled: true

nodesecurity:
enabled: true

+ 0
- 43
src/assets/etc/ABOUT.md View File

@@ -1,43 +0,0 @@
![](https://i.imgur.com/juhuGPt.png)

DreamTime allows you to use the power of your CPU or GPU to transform photos that give you free entertainment, something that in the past you could only dream...

## Community

Join the community of people who use the project either for entertainment or development purposes, you can get valuable help or create interesting discussions to improve the future of DreamTime:

- [Discord](https://discord.gg/RjBSaND)

## Support

Developing an application like DreamTime takes time! Any help is welcome:

- **If you have extra \$\$\$:** Consider 💖[Become a patron](https://www.patreon.com/deepmanyy). Support economically the project monthly and obtain exclusive benefits.
- **If you are a developer:** Consider making a fork of the project and make PR of any improvement you can do, also join our server in [Discord](https://discord.gg/RjBSaND) where we have channels exclusively for development.

## Credits

- **[DeepManYY](https://github.com/deep-man-yy):** I am a web developer who found this application interesting and I could not resist making it as accessible as possible to the world.
- **[1337Roy](https://github.com/1337Roy):** For their contributions to the source code, adding new features such as activating or deactivating pubic hair.
- **[wisp101](https://github.com/wisp101):** Be active in the development and provide help to other developers.
- **[PommeDroid](https://github.com/PommeDroid):** For their contributions to the source code, such as adding support for Windows 7, 8 and gifs processing.

- **[deeppppp](https://github.com/deeppppp):** Be a follower of PepeNude since its beginning, help the community and be active in the research and development of a new transformation algorithm.
- **d3pn3p:** Be active in the research and development of a new transformation algorithm.
- **Invader21:** Be active in the research and development of a new transformation algorithm.

## 💖 Patreons

Thank you so much everyone! Your financial help helps the project to move forward more quickly and to make it open and free forever.

- YG

## Source Code

The source code of DreamTime will always remain open and you can always download it for free!

- [GitHub](https://github.com/private-dreamnet/dreamtime)
- [NotABug](https://notabug.org/DreamNet/DreamTime)
- [GitGud](https://gitgud.io/dreamnet/dreamtime)

Remember that you can follow the project or make a fork and create your own version! Read the [LICENSE](https://github.com/private-dreamnet/dreamtime/blob/master/LICENSE.md) for more information.

+ 29
- 15
src/electron/modules/rollbar.js View File

@@ -10,12 +10,31 @@ const instance = {

_rollbar: undefined,

/**
*
*/
init() {
if (!this.can()) {
return
}

const config = {
const config = this.getConfig()

try {
this._rollbar = new Rollbar(config)
this.isEnabled = true

debug('Rollbar initialized!', config)
} catch (err) {
console.warn('Error at connecting to Rollbar', err)
}
},

/**
*
*/
getConfig() {
return {
accessToken: this.getAccessToken(),
captureUncaught: true,
captureUnhandledRejections: true,
@@ -26,31 +45,23 @@ const instance = {
payload: {
environment:
process.env.NODE_ENV !== 'development' ? 'production' : 'development',
settings: settings._settings,
person: {
id: settings.user
},
client: {
javascript: {
source_map_enabled: true,
code_version: process.env.APP_VERSION,
guess_uncaught_frames: true
code_version: process.env.APP_VERSION
}
}
},
settings: settings._settings
}
}

try {
this._rollbar = new Rollbar(config)

this.isEnabled = true

debug('Rollbar initialized!', config)
} catch (err) {
console.warn('Error at connecting to Rollbar', err)
}
},

/**
*
*/
getAccessToken() {
return (
process.env.ROLLBAR_ACCESS_TOKEN ||
@@ -58,6 +69,9 @@ const instance = {
)
},

/**
*
*/
can() {
return settings.telemetry.enabled && this.getAccessToken()
}

+ 47
- 0
src/modules/config/cli-errors.json View File

@@ -0,0 +1,47 @@
[
{
"error": "Found no NVIDIA driver on your system",
"message": "Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from [here](http://www.nvidia.com/Download/index.aspx). If you don't have an NVIDIA GPU please change the Device option in **Settings** to **CPU**.",
"type": "debug"
},
{
"error": "The NVIDIA driver on your system is too old",
"message": "The NVIDIA driver installed on your system is too old! Please update the drivers [here](http://www.nvidia.com/Download/index.aspx), if the drivers are up to date then your GPU may not be compatible. You can also change the Device option in **Settings** to **CPU**.",
"type": "debug"
},
{
"error": "no longer supports this GPU",
"message": "Your GPU is not powerful enough to run this program. Please change the Device option in **Settings** to **CPU**.",
"type": "debug"
},
{
"error": "Buy new RAM!",
"message": "You have run out of RAM on your system! Try a photo of smaller size or free all possible memory.",
"type": "debug"
},
{
"error": "CUDA out of memory",
"message": "You have run out of RAM on your GPU! Try a photo of smaller size or free all possible GPU use.",
"type": "debug"
},
{
"error": "codec can't decode byte",
"message": "The algorithm had a problem decoding some characters. This is usually caused by being installed in a location with special characters (accents, spaces, etc.). Please reinstall the program in another location.",
"type": "debug"
},
{
"error": "invalid device ordinal",
"message": "A valid GPU device was not found in the indicated GPU option, please try another. You can also change the Device option in **Settings** to **CPU**.",
"type": "debug"
},
{
"error": "image is not 512 x 512",
"message": "The photo is not 512x512, please make sure you have uploaded the correct photo or enable and use the cropper.",
"type": "debug"
},
{
"error": "loading Python",
"message": "There was a problem loading a necessary DreamPower file. It is possible that your installation is corrupt, download the program again and reinstall.",
"type": "debug"
}
]

+ 26
- 0
src/modules/config/preferences.json View File

@@ -0,0 +1,26 @@
{
"boobs": {
"min": 0.3,
"max": 2.0
},

"areola": {
"min": 0.3,
"max": 2.0
},

"nipple": {
"min": 0.3,
"max": 2.0
},

"vagina": {
"min": 0.3,
"max": 1.5
},

"pubicHair": {
"min": 0,
"max": 2.0
}
}

+ 30
- 147
src/modules/models/photo-job.js View File

@@ -7,6 +7,9 @@ import Timer from '../timer'
import { rand } from '../helpers'
import WebError from '~/modules/web-error'

import cliErrors from '../config/cli-errors'
import preferencesConfig from '../config/preferences'

const debug = require('debug').default('app:modules:models:photo-job')

export default class PhotoJob {
@@ -147,81 +150,18 @@ export default class PhotoJob {
*
*/
getCliError() {
if (_.isNil(this.cli.error) || this.cli.error.length === 0) {
return { type: 'debug', message: '' }
}

const message = this.cli.error

if (message.includes('Found no NVIDIA driver on your system')) {
return {
type: 'debug',
message:
"Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from [here](http://www.nvidia.com/Download/index.aspx). If you don't have an NVIDIA GPU please change the Device option in **Settings** to **CPU**."
}
}

if (message.includes('The NVIDIA driver on your system is too old')) {
return {
type: 'debug',
message:
'The NVIDIA driver installed on your system is too old! Please update the drivers [here](http://www.nvidia.com/Download/index.aspx), if the drivers are up to date then your GPU may not be compatible. You can also change the Device option in **Settings** to **CPU**.'
}
}

if (message.includes('no longer supports this GPU')) {
return {
type: 'debug',
message:
'Your GPU is not powerful enough to run this program. Please change the Device option in **Settings** to **CPU**.'
}
}

if (message.includes('Buy new RAM!')) {
return {
type: 'debug',
message:
'Apparently you have run out of RAM on your system! Try a photo of smaller size or free all possible memory.'
}
}

if (message.includes('CUDA out of memory')) {
return {
type: 'debug',
message:
'Apparently you have run out of RAM on your GPU! Try a photo of smaller size or free all possible GPU use.'
}
}

if (message.includes("codec can't decode byte")) {
return {
type: 'debug',
message:
'The algorithm had a problem decoding some characters. This is usually caused by being installed in a location with special characters (accents, spaces, etc.). Please reinstall the program in another location.'
}
}

if (message.includes('invalid device ordinal')) {
return {
type: 'debug',
message:
'A valid GPU device was not found in the indicated GPU option, please try another. You can also change the Device option in **Settings** to **CPU**.'
}
}

if (message.includes('image is not 512 x 512')) {
return {
type: 'debug',
message:
'The photo is not 512x512, please make sure you have uploaded the correct photo or enable and use the cropper.'
}
if (!_.isString(message) || message.length === 0) {
return { type: 'debug', message: '' }
}

if (message.includes('loading Python')) {
return {
type: 'debug',
message:
'There was a problem loading a necessary DreamPower file. It is possible that your installation is corrupt, download the program again and reinstall.'
for (const payload of cliErrors) {
if (message.includes(payload.error)) {
return {
type: payload.type,
message: payload.message
}
}
}

@@ -255,80 +195,23 @@ export default class PhotoJob {
customizePreferences() {
if (this.preferences.randomizePreferences) {
// Randomize
if (this.preferences.boobs.randomize) {
this.preferences.boobs.size = rand(0.3, 2.0)
}

if (this.preferences.areola.randomize) {
this.preferences.areola.size = rand(0.3, 2.0)
}

if (this.preferences.nipple.randomize) {
this.preferences.nipple.size = rand(0.3, 2.0)
}

if (this.preferences.vagina.randomize) {
this.preferences.vagina.size = rand(0.3, 1.5)
}

if (this.preferences.pubicHair.randomize) {
this.preferences.pubicHair.size = rand(0, 2.0)
}
_.forIn(preferencesConfig, (payload, key) => {
if (this.preferences[key].randomize) {
this.preferences[key].size = rand(payload.min, payload.max)
}
})
} else if (this.preferences.progressivePreferences) {
// Progressive
const add = 0.2 * (this.id - 1)
const add = 0.1 * (this.id - 1)

if (this.preferences.boobs.progressive) {
this.preferences.boobs.size = Number.parseFloat(
this.preferences.boobs.size
)
this.preferences.boobs.size += add
this.preferences.boobs.size = Math.min(this.preferences.boobs.size, 2.0)
}
_.forIn(preferencesConfig, (payload, key) => {
if (this.preferences[key].progressive) {
let value = Number.parseFloat(this.preferences[key].size)
value = Math.min(value + add, payload.max)

if (this.preferences.areola.progressive) {
this.preferences.areola.size = Number.parseFloat(
this.preferences.areola.size
)
this.preferences.areola.size += add
this.preferences.areola.size = Math.min(
this.preferences.areola.size,
2.0
)
}

if (this.preferences.nipple.progressive) {
this.preferences.nipple.size = Number.parseFloat(
this.preferences.nipple.size
)
this.preferences.nipple.size += add
this.preferences.nipple.size = Math.min(
this.preferences.nipple.size,
2.0
)
}

if (this.preferences.vagina.progressive) {
this.preferences.vagina.size = Number.parseFloat(
this.preferences.vagina.size
)
this.preferences.vagina.size += add
this.preferences.vagina.size = Math.min(
this.preferences.vagina.size,
1.5
)
}

if (this.preferences.pubicHair.progressive) {
this.preferences.pubicHair.size = Number.parseFloat(
this.preferences.pubicHair.size
)
this.preferences.pubicHair.size += add
this.preferences.pubicHair.size = Math.min(
this.preferences.pubicHair.size,
2.0
)
}
this.preferences[key].size = value
}
})
}
}

@@ -338,7 +221,7 @@ export default class PhotoJob {
start() {
const deferred = Deferred()

const onSpawnError = error => {
const onSpawnError = (error) => {
deferred.reject(
new WebError(
'Unable to start DreamPower!',
@@ -362,19 +245,19 @@ export default class PhotoJob {
return deferred.promise
}

this.process.on('error', error => {
this.process.on('error', (error) => {
// Error before starting
onSpawnError(error)
})

this.process.on('stdout', output => {
this.process.on('stdout', (output) => {
// Output generated by the CLI
output = output
.toString()
.trim()
.split('\n')

output.forEach(text => {
output.forEach((text) => {
this.cli.lines.unshift({
text,
css: {}
@@ -382,7 +265,7 @@ export default class PhotoJob {
})
})

this.process.on('stderr', output => {
this.process.on('stderr', (output) => {
// CLI error
this.cli.lines.unshift({
text: output,
@@ -394,7 +277,7 @@ export default class PhotoJob {
this.cli.error += `${output}\n`
})

this.process.on('ready', code => {
this.process.on('ready', (code) => {
this.process = undefined

if (code === 0 || _.isNil(code)) {

+ 11
- 1
src/modules/update/base.js View File

@@ -222,7 +222,11 @@ export default class {
this.current = _.find(releases, { tag_name: `v${currentVersion}` })
this.available = compareVersions(this.latest.tag_name, currentVersion) === 1

// this.available = true // TODO: DEBUG
// this.available = true

if ($settings.notifications.update && this.available) {
this.sendNotification()
}
}

/**
@@ -330,10 +334,16 @@ export default class {

/**
* Install the downloaded update
*
* @param {string} filePath
*/
/* eslint-disable-next-line */
async install(filePath) {
// Custom
}

/**
* Send a notification indicating update available
*/
sendNotification() {}
}

+ 48
- 3
src/modules/update/checkpoints.js View File

@@ -15,6 +15,9 @@ import Base from './base'
import platform from '../platform'

export default class extends Base {
/**
* Returns if this provider is activated
*/
can() {
if (!$nucleus.isEnabled) {
return false
@@ -35,14 +38,24 @@ export default class extends Base {
return true
}

/**
* Returns the code name of the project.
* It is usually the lowercase name
*/
getName() {
return $nucleus.about.checkpoints.name
}

/**
* Returns the name of the project.
*/
getTitle() {
return $nucleus.about.checkpoints.name
}

/**
* Returns the current version of the project
*/
getCurrentVersion() {
if (!platform.requirements.checkpoints || !platform.requirements.cli) {
return '0.0.0'
@@ -60,14 +73,24 @@ export default class extends Base {
return version
}

/**
* Returns the domain and repository of the project in Github.
* Example: private-dreamnet/dreamtime
*/
getGithubRepository() {
return $nucleus.about.checkpoints.github
}

/**
* Returns the file name of the latest version
*/
getUpdateFileName() {
return `v${this.latest.tag_name}.zip`
}

/**
* Returns the URLs where the latest version can be downloaded
*/
getUpdateDownloadURLs() {
const urls = [
// CDN
@@ -109,14 +132,19 @@ export default class extends Base {
return super.download()
}

/**
* Install the downloaded update
*
* @param {string} filePath
*/
async install(filePath) {
const bus = $tools.fs.extract(filePath, $tools.paths.getCli())

bus.on('progress', value => {
bus.on('progress', (value) => {
this.updating.progress = value
})

bus.on('end', value => {
bus.on('end', (value) => {
this.updating.progress = value
this._resetUpdating()

@@ -124,8 +152,25 @@ export default class extends Base {
$tools.utils.api.app.exit()
})

bus.on('error', err => {
bus.on('error', (err) => {
throw err
})
}

/**
* Send a notification indicating update available
*/
sendNotification() {
const notification = new Notification(
`✨ Checkpoints ${this.latest.tag_name} available!`,
{
body: 'A new version of the Checkpoints is available for download.'
}
)

notification.onclick = () => {
window.$redirect('/system/about')
$tools.utils.activeWindow().focus()
}
}
}

+ 38
- 0
src/modules/update/dreamtime.js View File

@@ -15,6 +15,9 @@ import Base from './base'
import dream from '../dream'

export default class extends Base {
/**
* Returns if this provider is activated
*/
can() {
if (!$nucleus.isEnabled) {
return false
@@ -35,22 +38,40 @@ export default class extends Base {
return true
}

/**
* Returns the code name of the project.
* It is usually the lowercase name
*/
getName() {
return $nucleus.about.dreamtime.name
}

/**
* Returns the name of the project.
*/
getTitle() {
return $nucleus.about.dreamtime.title
}

/**
* Returns the domain and repository of the project in Github.
* Example: private-dreamnet/dreamtime
*/
getGithubRepository() {
return $nucleus.about.dreamtime.github
}

/**
* Returns the current version of the project
*/
getCurrentVersion() {
return dream.version
}

/**
* Install the downloaded update
* @param {string} filePath
*/
async install(filePath) {
try {
$tools.shell.openItem(filePath)
@@ -58,4 +79,21 @@ export default class extends Base {
$tools.shell.openItem(path.dirname(filePath))
}
}

/**
* Send a notification indicating update available
*/
sendNotification() {
const notification = new Notification(
`🎉 DreamTime ${this.latest.tag_name} available!`,
{
body: 'A new version of DreamTime is available for download.'
}
)

notification.onclick = () => {
window.$redirect('/system/about')
$tools.utils.activeWindow().focus()
}
}
}

+ 0
- 31
src/modules/updater.js View File

@@ -12,7 +12,6 @@
// eslint-disable-next-line
import _ from 'lodash'

import platform from './platform'
import DreamTime from './update/dreamtime'
import Checkpoints from './update/checkpoints'

@@ -35,36 +34,6 @@ export default {
await this.dreamtime.fetch()
await this.checkpoints.fetch()

if ($settings.notifications.update) {
if (this.dreamtime.available) {
const dreamtimeNotification = new Notification(
`🎉 DreamTime ${this.dreamtime.latest.tag_name} available!`,
{
body: 'A new version of DreamTime is available for download.'
}
)

dreamtimeNotification.onclick = () => {
window.$redirect('/system/about')
$tools.utils.activeWindow().focus()
}
}

if (platform.requirements.checkpoints && this.checkpoints.available) {
const checkpointsNotification = new Notification(
`✨ Checkpoints ${this.checkpoints.latest.tag_name} available!`,
{
body: 'A new version of the Checkpoints is available for download.'
}
)

checkpointsNotification.onclick = () => {
window.$redirect('/system/about')
$tools.utils.activeWindow().focus()
}
}
}

debug('Updater initialized!', {
dreamtime: this.dreamtime,
checkpoints: this.checkpoints

Loading…
Cancel
Save