#Good afternoon, I observe such an error

10 messages · Page 1 of 1 (latest)

lilac pendant
#

⨯ Get "https://objects.githubusercontent.com/github-production-release-asset-2e65be/9384267/6acd732d-745a-47db-9121-ea1fc27b7745?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231008%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231008T130327Z&X-Amz-Expires=300&X-Amz-Signature=a51731c260bbcf1c451c1b7972cf0a93b98693295ada2715d64a64ccd62fdcc5&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9384267&response-content-disposition=attachment%3B filename%3Delectron-v26.3.0-win32-x64.zip&response-content-type=application%2Foctet-stream": read tcp 192.168.203.76:50076->185.199.111.133:443: wsarecv: An existing connection was forcibly closed by the remote host.
github.com/develar/app-builder/pkg/download.(*Part).doRequest
/Volumes/data/Documents/app-builder/pkg/download/Part.go:108
github.com/develar/app-builder/pkg/download.(*Part).download
/Volumes/data/Documents/app-builder/pkg/download/Part.go:47
github.com/develar/app-builder/pkg/download.(*Downloader).DownloadResolved.func1.1
/Volumes/data/Documents/app-builder/pkg/download/downloader.go:155
github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2
/Volumes/data/Documents/app-builder/pkg/util/async.go:68
runtime.goexit
/usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581
⨯ D:\Users\Downloads\win\node_modules\app-builder-bin\win\x64\app-builder.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1 failedTask=build stackTrace=Error: D:\Users\Downloads\win\node_modules\app-builder-bin\win\x64\app-builder.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:

And also the backspace button does not work in an already created program

#

code main.js
const { app, BrowserWindow, Menu, screen, ipcMain } = require('electron');
const path = require('path');

let win;

function createWindow() {
const { width, height } = screen.getPrimaryDisplay().workAreaSize;

win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
        nodeIntegration: false,
        contextIsolation: true,
        preload: path.join(__dirname, 'preload.js')
    }
});

win.loadURL('https://login.rusbafet.com/');

const template = [{
        label: 'Назад',
        click: () => {
            console.log('Click Back');
            if (win && win instanceof BrowserWindow && win.webContents) {
                win.webContents.goBack();
            }
        }
    },
    {
        label: 'Выход',
        click: () => {
            win.close();
        }
    }
];

const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);

win.on('close', (e) => {
    e.preventDefault();
    win.destroy();
});

ipcMain.on('close-window', () => {
    win.close();
});

win.webContents.on("will-prevent-unload", (e) => {
    e.preventDefault();
});

}

app.whenReady().then(() => {
createWindow();

app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) {
        createWindow();
    }
});

ipcMain.on('goBackHomeBoi', (event, arg) => {
    console.log('Нажата кнопка "Назад"');
    if (win && win instanceof BrowserWindow && win.webContents) {
        win.webContents.goBack();
    }
    event.sender.send('WentBack', 'Done');
});

});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});

#

Code preload.js
const { contextBridge, ipcRenderer } = require('electron');

// Определите API, доступное в контексте страницы
const api = {
goBack: () => {
history.back();
},
closeWindow: () => {
ipcRenderer.send('close-window');
},
goHome: () => {
ipcRenderer.send('go-home');
},
};

// Экспортируйте API в контекст страницы
contextBridge.exposeInMainWorld('api', api);

// Функция для получения ширины документа
function getDocumentWidth() {
const documentWidth = Math.max(
document.documentElement.clientWidth,
document.body.scrollWidth,
document.documentElement.scrollWidth,
document.body.offsetWidth,
document.documentElement.offsetWidth
);
return documentWidth;
}

// Опционально: Добавьте обработку нажатия клавиши "Backspace" или "Esc"
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('keydown', (event) => {
if (event.code === 'Backspace' || event.code === 'Escape') {
event.preventDefault();
api.goBack();
}
});
});

Please help to fix the problem with the button and the problem with the build

rotund wedge
#

how it is related to electron?

lilac pendant
rotund wedge
#

so?

#

from where this error comes from?

lilac pendant
#

I don't understand myself, as well as when entering the npm start command, the program opens, but entering some data into the fields if I made a mistake by 1 letter or words and want to erase it using the backspace button, it doesn't work

rotund wedge
#

what tool it is?