Browse Source

Fix settings error and improvements to the error logger.

tags/v1.4.4
Ivan Bravo Bravo 10 months ago
parent
commit
0075345269

+ 7
- 1
src/components/Nudity/Upload.vue View File

@@ -240,7 +240,13 @@ export default {
throw new AppError('Please enter a valid Instagram photo.', { title: 'Upload failed.', level: 'warning' })
}

const post = await instagram.getPost(this.instagramPhoto)
let post

try {
post = await instagram.getPost(this.instagramPhoto)
} catch (error) {
throw new AppError('Unable to download the photo, please verify that the address is correct and that you are connected to the Internet.', { title: 'Upload failed.', error, level: 'warning' })
}

if (post.isVideo) {
throw new AppError('The videos are not supported yet.', { title: 'Upload failed.', level: 'warning' })

+ 1
- 1
src/electron/src/index.js View File

@@ -71,7 +71,7 @@ class DreamApp {
// user settings.
await settings.initialSetup()

if (settings.app.disableHardwareAcceleration) {
if (settings.app?.disableHardwareAcceleration) {
logger.info('Disabling hardware acceleration.')
app.disableHardwareAcceleration()
}

+ 2
- 2
src/electron/src/modules/app-error.js View File

@@ -126,12 +126,12 @@ export class AppError extends Error {
if (isError(error)) {
reportError = error
} else if (isObject(error) || isArray(error)) {
reportError = JSON.stringify(error)
reportError = new Error(JSON.stringify(error))
} else {
reportError = new Error(error)
}

appError = new AppError(`The application has encountered an unexpected error:\n<code>${reportError ?.message}</code>`,
appError = new AppError(`The application has encountered an unexpected error:\n<code>${reportError?.message}</code>`,
{
error: reportError,
title: 'Unexpected error!',

+ 6
- 3
src/electron/src/modules/services/nucleus.js View File

@@ -78,9 +78,12 @@ export class NucleusService extends BaseService {
return
}

this.payload = (await axios.get(
`https://nucleus.sh/app/${this.appId}/customdata`,
)).data
try {
this.payload = (await axios.get(
`https://nucleus.sh/app/${this.appId}/customdata`,
)).data
// eslint-disable-next-line no-empty
} catch (error) { }
}
}


+ 3
- 1
src/electron/src/modules/services/rollbar.js View File

@@ -7,7 +7,9 @@
//
// Written by Ivan Bravo Bravo <ivan@dreamnet.tech>, 2019.

import { isNil, isString, get } from 'lodash'
import {
isNil, isString, get,
} from 'lodash'
import { execSync } from 'child_process'
import Rollbar from 'rollbar'
import { BaseService } from './base'

+ 20
- 24
src/electron/src/modules/services/settings.js View File

@@ -155,23 +155,19 @@ class SettingsService extends BaseService {
* legacy code :WutFaceW:
*/
async _upgrade() {
const currentVersion = this.payload.version || 1
const newVersion = this._default.version

if (newVersion === currentVersion) {
if (this.payload?.version === this._default.version) {
return
}

logger.debug(`Upgrading settings file to v${newVersion}`)
logger.debug(`Upgrading settings file to v${this._default.version}`)

const currentSettings = this.payload
const newSettings = cloneDeep(currentSettings)
const currentSettings = cloneDeep(this.payload)

// Upgrade 1 -> 2
if (currentVersion === 1 && newVersion === 2) {
newSettings.version = 2
newSettings.preferences = this._default.preferences
newSettings.notifications = this._default.notifications
if (this.payload?.version === 1 && this._default.version >= 2) {
this.payload.version = 2
this.payload.preferences = this._default.preferences
this.payload.notifications = this._default.notifications

const {
boobsSize,
@@ -181,26 +177,26 @@ class SettingsService extends BaseService {
pubicHairSize,
} = this.payload.preferences

newSettings.preferences.boobs.size = boobsSize
newSettings.preferences.areola.size = areolaSize
newSettings.preferences.nipple.size = nippleSize
newSettings.preferences.vagina.size = vaginaSize
newSettings.preferences.pubicHair.size = pubicHairSize
this.payload.preferences.boobs.size = boobsSize
this.payload.preferences.areola.size = areolaSize
this.payload.preferences.nipple.size = nippleSize
this.payload.preferences.vagina.size = vaginaSize
this.payload.preferences.pubicHair.size = pubicHairSize
}

// Upgrade 2 -> 3
if (currentVersion === 2 && newVersion === 3) {
if (this.payload?.version === 2 && this._default.version >= 3) {
const { processing, preferences } = currentSettings

newSettings.version = 3
this.payload.version = 3

newSettings.processing = {
this.payload.processing = {
...processing,
cores: 4,
disablePersistentGan: false,
}

newSettings.preferences = {
this.payload.preferences = {
body: {
executions: preferences.executions,
randomize: preferences.randomizePreferences,
@@ -226,15 +222,15 @@ class SettingsService extends BaseService {
}

// Upgrade 3 -> 4
if (currentVersion === 3 && newVersion === 4) {
newSettings.version = 4
newSettings.app = {
if (this.payload?.version === 3 && this._default.version >= 4) {
this.payload.version = 4
this.payload.app = {
disableHardwareAcceleration: false,
uploadMode: 'add-queue',
}
}

this.set(newSettings)
this.save()
}
}


+ 10
- 4
src/modules/app-error.js View File

@@ -8,7 +8,7 @@
// Written by Ivan Bravo Bravo <ivan@dreamnet.tech>, 2019.

import {
isError, isString, isObject, isArray,
isError, isString, isObject, isArray, pick,
} from 'lodash'
import Swal from 'sweetalert2'

@@ -72,10 +72,12 @@ export class AppError extends Error {
}

report() {
/*
if (process.env.NODE_ENV === 'development') {
this.reportUrl = `https://rollbar.com/occurrence/uuid/?uuid={EXAMPLE}`
return
}
*/

const { level } = this.options

@@ -86,7 +88,11 @@ export class AppError extends Error {
try {
const error = this.options.error || this

const response = rollbar[level](this.message, error, this.options)
const response = rollbar[level](error.message, {
...this.options,
message: this.message,
error: pick(error, 'message', 'name', 'filename', 'line', 'column', 'stack'),
})

if (response.uuid) {
this.reportUrl = `https://rollbar.com/occurrence/uuid/?uuid=${response.uuid}`
@@ -145,12 +151,12 @@ export class AppError extends Error {
if (isError(error)) {
reportError = error
} else if (isObject(error) || isArray(error)) {
reportError = JSON.stringify(error)
reportError = new Error(JSON.stringify(error))
} else {
reportError = new Error(error)
}

appError = new AppError(`The application has encountered an unexpected error:\n<pre>${reportError ?.message}</pre>`,
appError = new AppError(`The application has encountered an unexpected error:\n<pre>${reportError?.message}</pre>`,
{
error: reportError,
title: 'Unexpected error!',

+ 2
- 1
src/modules/nudify/photo-run.js View File

@@ -278,9 +278,10 @@ export class PhotoRun {
}
}

return new AppError('DreamPower has been interrupted by an unknown error, this may be caused by a corrupt installation, please check the console for more information.', {
return new AppError(`DreamPower has been interrupted by an unknown error, this may be caused by a corrupt installation, please check the console for more information.\n<pre>${message}</pre>`, {
title: `Run ${this.id} has failed.`,
error: new Error(message),
terminal: this.cli.lines,
})
}


Loading…
Cancel
Save