Skip to content

Commit

Permalink
fix Download Window to allow downloading dedicated links
Browse files Browse the repository at this point in the history
  • Loading branch information
Gkiokan committed May 21, 2024
1 parent c77c5d5 commit 2bd4470
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 16 deletions.
24 changes: 20 additions & 4 deletions src/main/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default {
height: 600,
width: 900,
// frame: false,
title: 'PS4 Remote Package Sender',
title: 'PS4 Remote Package Sender v2',
icon: nativeImage.createFromDataURL(this.getAppIconPath()),
// titleBarStyle: 'hiddenInset',
webPreferences: {
Expand Down Expand Up @@ -107,17 +107,33 @@ export default {
// })

window.webContents.on('new-window', (event, url) => {
console.log("new window")
console.log("Open New Window with autoclose after download")
event.preventDefault()

var win = new BrowserWindow({ show: false, frame: false })
var win = new BrowserWindow({
show: true,
frame: false,
icon: nativeImage.createFromDataURL(this.getAppIconPath()),
webPreferences: {
allowRunningInsecureContent: false,
nodeIntegration: true,
enableRemoteModule: true,
webviewTag: true,
}
})

win.webContents.setUserAgent("StoreHAX")
win.once('ready-to-show', () => win.show())
win.loadURL(url)
// win.webContents.downloadURL(url)
// win.openDevTools()

console.log("Set New Window url to ", url)

win.webContents.session.on('will-download', (event, item, webContents) => {
// console.log("Download started for ", item)
item.once('done', (event, state) => {
console.log("item download done", state)
console.log("Item download state ", state)
win.destroy()
})
})
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ export default {
},
openWithAutoclose(url){
// window.open(url, 'Download', 'width=200,height=30,backgroundColor=black,frame=false,hide=true') // deprecated
console.log("Open with Autoclose ", url)
// straight open a new window with the url
// return window.open(url, 'Download', 'width=200,height=30,backgroundColor=black,frame=false,hide=true') // deprecated
// proxy though application view
if (isDevelopment) {
window.open(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}` + '#window.loader?q=' + url, 'Download', 'width=200,height=30,backgroundColor=black,frame=false,hide=true')
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/LatestVersionInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
this.item = item
this.version = version
this.current = this.$root.versions.app
this.current = "2.8.1" // this.$root.versions.app
this.version = this.$git.getVersion(item)
this.compare = this.$git.compareVersion(this.current, this.version) // -1 new version available
},
Expand Down
35 changes: 25 additions & 10 deletions src/renderer/pages/WindowLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
<div class="bg bg2"></div>
<div class="bg bg3"></div>
<div class="bg logo">
<img :src="$root.getImage('assets/rpsV2.png')" style="width: 180px; margin: 0 auto;" />
<br>
downloading...
<img :src="$root.getImage('assets/rpsV2.png')" style="width: 180px; margin: 0 auto; margin-top: 200px" />
</div>

<div class="header text-center">
<el-button round @click="close"> Close Downloading Window <i class="el-icon-close" /> </el-button>
<div class="url" v-if="false">{{ url }}</div>

<div class="url" style="text-align: left; margin-top: 30px;">
<div style="margin-bottom: 10px; display:block; font-weight:bold;">Downloading </div>
<div v-if="true">{{ url }}</div>
</div>
</div>

<webview :src="url" v-if="url" useragent="StoreHAX" style="position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 5; width: 100vw; height: 100vh;" />
Expand All @@ -36,6 +38,10 @@ export default {
init(){
if(this.$route.query.q)
this.url = this.$route.query.q
else {
alert("No Query parameter given.")
this.close()
}
},
close(){
Expand All @@ -47,24 +53,33 @@ export default {

<style lang="scss" scoped>
.WindowLoader {
position: relative;
position: relative;
height: calc(100vh - 60px);
padding: 0px;
top:0px; left: 0px; right: 0px; bottom: 0px;
border: 10px solid maroon;
overflow: hidden;
}
.inlineWebView {
position: relative;
height: 100vh;
width: 100vw;
height: auto;
width: auto;
}
.header {
position: relative; z-index: 10;
border: 0px solid red;
margin-top: 20px;
width: calc(100vw - 50px);
.url {
padding: 20px;
white-space: pre;
white-space: normal;
word-break: break-all;
text-align: left;
max-width: 600px;
}
}
Expand Down Expand Up @@ -101,10 +116,10 @@ export default {
@keyframes slide {
0% {
transform:translateX(-25%);
transform:translateX(3%);
}
100% {
transform:translateX(25%);
transform:translateX(30%);
}
}
</style>

0 comments on commit 2bd4470

Please sign in to comment.