Skip to content

Commit

Permalink
Clean Upload Without Electron Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
sipsuru committed Nov 11, 2024
1 parent 74f5d3d commit 186fb14
Show file tree
Hide file tree
Showing 63 changed files with 9,715 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
out
.gitignore
3 changes: 3 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint:recommended', '@electron-toolkit', '@electron-toolkit/eslint-config-prettier']
}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
electron_mirror=https://npmmirror.com/mirrors/electron/
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
out
dist
pnpm-lock.yaml
LICENSE.md
tsconfig.json
tsconfig.*.json
4 changes: 4 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
singleQuote: true
semi: false
printWidth: 100
trailingComma: none
1 change: 1 addition & 0 deletions .yarnrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: "node-modules"
Binary file added build/entitlements.mac.plist
Binary file not shown.
Binary file added build/icon.icns
Binary file not shown.
Binary file added build/icon.ico
Binary file not shown.
Binary file added build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
appId: com.electron.app
productName: wp-downloader-electron
directories:
buildResources: build
files:
- '!electron.vite.config.{js,ts,mjs,cjs}'
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
asarUnpack:
- './resources/**/*'

win:
executableName: wp-downloader-electron
nsis:
artifactName: ${name}-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always

mac:
entitlementsInherit: build/entitlements.mac.plist
extendInfo:
- NSCameraUsageDescription: Application requests access to the device's camera.
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
notarize: false

dmg:
artifactName: ${name}-${version}.${ext}

linux:
target:
- AppImage
- snap
- deb
maintainer: electronjs.org
category: Utility

appImage:
artifactName: ${name}-${version}.${ext}

npmRebuild: false

publish:
provider: generic
url: https://example.com/auto-updates

electronDownload:
mirror: https://npmmirror.com/mirrors/electron/
67 changes: 67 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const { app, shell, BrowserWindow, ipcMain } = require('electron/main')

const { join } = require('path')
const { electronApp, optimizer } = require('@electron-toolkit/utils')

require("./server"); // This runs the Express app in the same process

function createWindow() {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 1000,
height: 770,
show: false,
autoHideMenuBar: true,
webPreferences: {
sandbox: false
}
})

mainWindow.on('ready-to-show', () => {
mainWindow.show()
})

mainWindow.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url)
return { action: 'deny' }
})

mainWindow.setContentProtection(true);

mainWindow.loadURL("http://localhost:3000");
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
// Set app user model id for windows
electronApp.setAppUserModelId('com.electron')

// Default open or close DevTools by F12 in development
// and ignore CommandOrControl + R in production.
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
app.on('browser-window-created', (_, window) => {
optimizer.watchWindowShortcuts(window)
})

createWindow()

app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})

// In this file you can include the rest of your app"s specific main process
// code. You can also put them in separate files and require them here.
57 changes: 57 additions & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"title": "WP Downloader",
"url": "https://localhost",
"domain": "localhost",
"keywords": "Downloader, WP, Story Downloader",
"image": "static/icons/android-chrome-512x512.png",
"description": "Lade dir Geschichten für deinen E-Book-Reader, dein Smartphone oder deinen Desktop-PC und andere Plattformen kostenlos herunter!",
"titlebar": {
"home": "Startseite",
"help": "Hilfe"
},
"home": {
"text": "Lade Geschichten für<br/> E-Book-Reader, Smartphones, Desktop-PCs und weitere Plattformen kostenlos herunter!",
"placeholder": "Buch URL, Kapitel oder ID eingeben",
"submit": "Weiter"
},
"help": [
{
"title": "Wie kann ich eine Geschichte von WP herunterladen?",
"text": "Zuerst suchst du dir die Geschichte normal auf WP aus. Sobald du in einem Kapitel, oder auf der Informationsseite deiner Geschichte bist, kannst du die Adresse von ... zu deiner Domain bzw. <b>localhost:3000</b> ändern. Bitte ändere nur die Domain und lasse alles davor und danach exakt so, wie es ist. Nach dem du die Anfrage abgeschickt hast, landest du auf unserer Seite und kannst die Geschichte herunterladen. Alternativ kannst du auch die Adresse von Wattpad kopieren und in das Eingabefeld auf der Startseite einfügen."
},
{
"title": "Welches Format soll ich zum Herunterladen wählen?",
"text": "Wir bieten dir zwei verschiedene Formate an. Erstens das <b>EPUB</b>-Format und zweitens das <b>HTML</b>-Format.<br/>EPUB-Dateien eignen sich ideal für E-Book-Reader wie z.B. den Amazon Kindle oder den Tolino. Um die Geschichte auf deinen E-Book-Reader zu laden, kannst du z.B. die Software <a href=\"https://www.calibre-ebook.com/about\">Calibre</a> verwenden. Das EPUB-Format ist ebenfalls mit Apple Books kompatibel. Wenn du also ein iOS-Gerät hast, solltest du das EPUB-Format herunterladen.<br/> Falls du auf einer anderen Plattform wie einem PC oder einem Android-Smartphone lesen möchtest, sollten du das HTML-Format wählen. Diese Datei enthält einen kompletten Reader inklusive deiner Geschichte und kann mit jedem Webbrowser geöffnet werden. Der Reader gibt dir auch die Möglichkeit, die Schriftart, Schriftgröße und das Farbschema zu ändern."
},
{
"title": "Bedingungen",
"text": "Dieser Service ist auschließlich für den Privatgebraucht gedacht, man darf die Heruntergeladenen eBooks von <b>anderen</b> nicht Verkaufen!</br>Wir unterstützen oder Tolerieren solch eine Aktivität nicht!"
},
{
"title": "Hast du Fragen oder Probleme?",
"text": "Öffne ein Issue auf der Github-Seite.<br>Danke an Feuerhamster und BluemediaGER für den Source</br>"
}
],
"book": {
"download": {
"epub": "Download für E-Book-Reader (epub)",
"html": "Download für PC / Smartphone (html)",
"pdf": "Download als PDF (pdf)"
},
"author": "Autor",
"pubDate": "Veröffentlicht",
"lang": "Sprache",
"loading": {
"text": "Bitte warte einen Moment, während wir deinen Download vorbereiten..."
}
},
"parts": "Kapitel",
"overview": "Übersicht",
"next": "Nächstes Kapitel",
"startReading": "Jetzt lesen",
"errors": {
"bookNotFound": "Leider konnten wir diese Geschichte nicht finden.",
"invalidSearch": "Leider konnten wir deine Eingabe nicht verarbeiten.<br/>Bitte gebe einen Link oder die ID einer Geschichte an.",
"serverError": "Das Buch konnte aufgrund eines internen Fehlers nicht abgerufen/konvertiert werden."
}
}
59 changes: 59 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"title": "WP Downloader",
"url": "https://localhost",
"domain": "localhost",
"keywords": "Downloader, WP, Story Downloader",
"image": "static/icons/android-chrome-512x512.png",
"description": "Download stories for e-book readers, smartphones or desktop and more for free!",
"titlebar": {
"home": "Home",
"help": "Help",
"privacy": "Imprint & Privacy"
},
"home": {
"text": "Download stories for<br/> e-book readers, smartphones, desktop and more!",
"placeholder": "Enter URL to book, part or id",
"submit": "Next"
},
"help": [
{
"title": "How to download a story from WP?",
"text": "You can open the story that you want to download and simply change the domain to your domain or <b>localhost:3000</b>. Or you copy the URL of the book and paste it into the input field on our page."
},
{
"title": "Which format should I choose for download?",
"text": "We provide two different formats. First, the <b>EPUB</b> format and second the <b>HTML</b>.<br/>EPUB is for E-Book reader like Kindle. You can download this and load it on your E-Book reader with a software called Calibre. EPUB also works really well with Apple Books. So if you have an IPhone, you should download EPUB and you can read it with Apple Books.<br/>If you are on another platform like a PC or an android smartphone, you should download HTML. We provide a .html file that you can open with any browser. This contains a complete reader with the offline available story. The reader also gives you the option to change the font, font size and color scheme."
},
{
"title": "Terms",
"text": "This service is for private use only, do not sell <b>others</b>'s downloaded eBooks!</br>We do not endorse or condone such activity!"
},
{
"title": "Any questions or problems?",
"text": "Make an Issue on the Github repo<br>Thanks to Feuerhamster and BluemediaGER for the Source</br>"
}
],
"book": {
"download": {
"epub": "Download for E-Book reader (epub)",
"html": "Download PC / Smartphone (html)",
"pdf": "Download as PDF (pdf)"
},
"author": "Author",
"pubDate": "Published",
"lang": "Language",
"loading": {
"text": "Plese wait a few seconds while we prepare your download..."
}
},
"parts": "Parts",
"overview": "Overview",
"next": "Next part",
"startReading": "Start reading",
"errors": {
"bookNotFound": "Sorry but we can't find the book!",
"invalidSearch": "We can not parse your entered value.<br/> Please provide a link to a story or an ID.",
"tokenError": "Your Captcha-Token is invalid.",
"serverError": "The book could not be retrieved/converted due to an internal error."
}
}
Loading

0 comments on commit 186fb14

Please sign in to comment.