Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit 9bc31f6

Browse files
committed
x
1 parent f214037 commit 9bc31f6

File tree

6 files changed

+314
-51
lines changed

6 files changed

+314
-51
lines changed

src/main/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,19 @@ app.on("activate", () => {
5959

6060
app.updateDownloaded = false;
6161

62-
app.reloadApp = () => {
63-
autoUpdater.quitAndInstall();
64-
};
65-
6662
autoUpdater.on("update-available", info => {
63+
app.updateDownloading = true;
6764
autoUpdater.downloadUpdate();
6865
});
6966

7067
autoUpdater.on("update-downloaded", info => {
71-
app.updateDownloaded = info.version;
68+
app.updateDownloaded = true;
7269
});
7370

71+
app.reloadApp = () => {
72+
autoUpdater.quitAndInstall();
73+
};
74+
7475
// app.getPath('temp')
7576

7677
/**

src/renderer/App.vue

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<div>
3+
<Alerts/>
34
<Sidebar/>
45
<div class="topbar">
56
<WindowsButtons v-if="isWindows"/>
@@ -17,6 +18,7 @@
1718
import Panel from "./components/SlidePanel";
1819
import TrafficLights from "./components/TrafficLights";
1920
import WindowsButtons from "./components/WindowsButtons";
21+
import Alerts from "./components/Alerts";
2022
import Sidebar from "./components/Sidebar/Sidebar";
2123
import { mapGetters, mapState } from "vuex";
2224
import drivelist from "drivelist";
@@ -44,7 +46,8 @@ export default {
4446
Panel,
4547
Modal,
4648
TrafficLights,
47-
WindowsButtons
49+
WindowsButtons,
50+
Alerts
4851
},
4952
data() {
5053
return {
@@ -75,12 +78,12 @@ export default {
7578
7679
this.picsDir = localStorage.getItem("picsDir") || `${userDir}/Pictures`;
7780
78-
let discordCacheDir = `${userDir}/AppData/Roaming/discord/Cache`;
79-
if (os.platform() === "darwin") {
80-
discordCacheDir = `${userDir}/Library/Application Support/discord/Cache`;
81-
}
81+
// let discordCacheDir = `${userDir}/AppData/Roaming/discord/Cache`;
82+
// if (os.platform() === "darwin") {
83+
// discordCacheDir = `${userDir}/Library/Application Support/discord/Cache`;
84+
// }
8285
let ready = true;
83-
console.log(discordCacheDir);
86+
// console.log(discordCacheDir);
8487
8588
const dumpExists = await fs.existsSync(dumpDir);
8689
@@ -101,17 +104,17 @@ export default {
101104
});
102105
}
103106
104-
const discordCacheExists = await fs.existsSync(discordCacheDir);
107+
// const discordCacheExists = await fs.existsSync(discordCacheDir);
105108
106-
if (discordCacheExists) {
107-
this.watchDirectories.push({
108-
name: "discord",
109-
dir: discordCacheDir
110-
});
111-
} else {
112-
this.currentTask = "Could not find Discord cache, please add manually.";
113-
ready = false;
114-
}
109+
// if (discordCacheExists) {
110+
// this.watchDirectories.push({
111+
// name: "discord",
112+
// dir: discordCacheDir
113+
// });
114+
// } else {
115+
// this.currentTask = "Could not find Discord cache, please add manually.";
116+
// ready = false;
117+
// }
115118
116119
if (ready) {
117120
if (localStorage.getItem("fileIndex")) {
@@ -125,6 +128,16 @@ export default {
125128
}
126129
},
127130
watch: {
131+
// watchDirectories() {
132+
// let check = []
133+
// for (let directory of this.watchDirectories) {
134+
// if (check.includes(this.watchDirectories[directory].dir)) {
135+
// this.watchDirectories.splice(directory)
136+
// } else {
137+
// check.push(this.watchDirectories[directory].dir)
138+
// }
139+
// }
140+
// },
128141
dumpDirectory() {
129142
// if changed, mark scan as incomplete
130143
this.dumpScanComplete = false;
@@ -145,20 +158,25 @@ export default {
145158
initWatchers() {
146159
if (this.watcherRunning) return;
147160
setTimeout(() => (this.watchBlocker = false), 15000);
148-
for (let dir of this.watchDirectories) {
149-
const watcher = chokidar.watch(dir.dir, { persistent: true });
150-
this.watcherRunning = true;
151-
watcher.on("add", async path => {
152-
if (!this.watchBlocker && !this.processing && this.dumpScanComplete) {
153-
console.log("File", path, "has been added");
154-
let arr = path.split("/");
155-
await this.processItem(dir.dir, path, arr[arr.length - 1]);
156-
this.fileIndex = Object.assign({}, this.fileIndex);
157-
this.currentTask = "Waiting for changes...";
158-
}
159-
});
160-
this.currentTask = "Waiting for changes...";
161-
}
161+
if (process.env.NODE_ENV !== "development")
162+
for (let dir of this.watchDirectories) {
163+
const watcher = chokidar.watch(dir.dir, { persistent: true });
164+
this.watcherRunning = true;
165+
watcher.on("add", async path => {
166+
if (
167+
!this.watchBlocker &&
168+
!this.processing &&
169+
this.dumpScanComplete
170+
) {
171+
console.log("File", path, "has been added");
172+
let arr = path.split("/");
173+
await this.processItem(dir.dir, path, arr[arr.length - 1]);
174+
this.fileIndex = Object.assign({}, this.fileIndex);
175+
this.currentTask = "Waiting for changes...";
176+
}
177+
});
178+
this.currentTask = "Waiting for changes...";
179+
}
162180
},
163181
evaluateFileIndex() {
164182
for (let i of Object.keys(this.fileIndex)) {
@@ -269,7 +287,7 @@ export default {
269287
const buffer = readChunk.sync(location, 0, fileType.minimumBytes);
270288
const _type = fileType(buffer);
271289
272-
let extention = _type.mime.split("/")[1];
290+
let extention = _type && _type.mime ? _type.mime.split("/")[1] : null;
273291
if (extention && !this.foundFiletypes.includes(extention))
274292
this.foundFiletypes.push(extention);
275293
@@ -559,7 +577,7 @@ body {
559577
margin-top: 25px;
560578
display: flex;
561579
flex-direction: column;
562-
background: var(--background2);
580+
background: var(--main);
563581
border-radius: 15px 0 0 0;
564582
min-height: calc(100vh - 29px);
565583
}

src/renderer/components/Alerts.vue

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<template>
2+
<div class="alerts_container">
3+
<div v-for="a in alerts" :key="a.id">
4+
<div :class="a.theme" class="alert">{{ a.message }}</div>
5+
</div>
6+
7+
<!-- <div v-bind:class="{ 'show-alert': alert, 'text-danger': hasError }" class="alert">
8+
{{ message }}
9+
</div>-->
10+
</div>
11+
</template>
12+
13+
14+
<script>
15+
export default {
16+
name: "Alerts",
17+
data() {
18+
return {
19+
alerts: []
20+
};
21+
},
22+
mounted() {
23+
this.$root.$on("alert", (type, message) => {
24+
this[type](message);
25+
});
26+
},
27+
methods: {
28+
createAlert: function(theme, message) {
29+
var alertObject = {
30+
id: Math.random(),
31+
message: message,
32+
theme: theme
33+
};
34+
this.alerts.push(alertObject);
35+
var vm = this;
36+
setTimeout(function(e) {
37+
vm.alerts.shift();
38+
}, 4000);
39+
},
40+
success: function(message) {
41+
this.createAlert("success fadeout", message);
42+
},
43+
error: function(message) {
44+
this.createAlert("error fadeout", message);
45+
},
46+
info: function(message) {
47+
this.createAlert("info fadeout", message);
48+
}
49+
}
50+
};
51+
</script>
52+
53+
<style scoped>
54+
.alerts_container {
55+
position: absolute;
56+
bottom: 0px;
57+
right: 10px;
58+
width: 100%;
59+
z-index: 900991;
60+
}
61+
62+
.alert {
63+
border-radius: 5px;
64+
padding: 10px;
65+
margin: 10px;
66+
animation: fade 4s;
67+
text-align: center;
68+
margin: 0 20px;
69+
}
70+
71+
/* @keyframes fadein {
72+
from { opacity: 0; margin-top: -15px; }
73+
to { opacity: 1; margin-top: 10px;}
74+
} */
75+
@keyframes fade {
76+
0% {
77+
opacity: 0;
78+
margin-bottom: -15px;
79+
}
80+
5% {
81+
opacity: 1;
82+
margin-bottom: 10px;
83+
}
84+
95% {
85+
opacity: 1;
86+
margin-bottom: 10px;
87+
}
88+
100% {
89+
opacity: 0;
90+
margin-bottom: -15px;
91+
}
92+
}
93+
94+
.success {
95+
color: #3c763d;
96+
background-color: #dff0d8;
97+
border-color: #d6e9c6;
98+
}
99+
100+
.error {
101+
color: #a94442;
102+
background-color: #f2dede;
103+
border-color: #ebccd1;
104+
}
105+
106+
.info {
107+
color: #31708f;
108+
background-color: #d9edf7;
109+
border-color: #bce8f1;
110+
}
111+
112+
.dark .success {
113+
color: #7ae77a;
114+
background-color: #263b1f;
115+
border-color: #afc0a200;
116+
}
117+
118+
.dark .error {
119+
color: #a94442;
120+
background-color: #f2dede;
121+
border-color: #ebccd1;
122+
}
123+
124+
.dark .info {
125+
color: #45abdd;
126+
background-color: #1f3d4b;
127+
border-color: #4093a800;
128+
}
129+
</style>

src/renderer/components/LandingPage.vue

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
<div id="wrapper">
33
<!-- <img id="logo" src="~@/assets/logo.png" alt="electron-vue"> -->
44
<div class="heading-area">
5-
<div @click="reload" v-if="updateReady" class="update-box">New update downloaded!
5+
<div v-if="updateDownloading && !updateReady" class="update-box grey">New update available!
6+
<br>
7+
<small>Updating in background...</small>
8+
</div>
9+
<div @click="reload" v-else-if="updateReady" class="update-box">New update downloaded!
610
<br>
711
<small>Click here to reload.</small>
812
</div>
@@ -91,8 +95,10 @@
9195
@click="$parent.purgeBoth"
9296
>Purge Cache & Dump</button>
9397
<br>
94-
<div style="opacity:0.3;">Content Loaded:</div>
95-
<b>{{content.length}}</b>
98+
<div>
99+
<span style="opacity:0.3;">Content Loaded:</span>
100+
<b>{{content.length}}</b>
101+
</div>
96102
</div>
97103
<div class="content">
98104
<div
@@ -143,11 +149,19 @@ export default {
143149
data() {
144150
return {
145151
monkey: 1,
146-
currentFilter: false
152+
currentFilter: false,
153+
updateDownloading: false
147154
};
148155
},
149156
mounted() {
157+
setTimeout(
158+
() => (this.updateDownloading = remote.app.updateDownloading),
159+
2000
160+
);
150161
const interval = setInterval(() => {
162+
if (remote.app.updateDownloading) {
163+
this.updateDownloading = remote.app.updateDownloading;
164+
}
151165
if (remote.app.updateDownloaded) {
152166
this.updateReady = remote.app.updateDownloaded;
153167
clearInterval(interval);
@@ -328,7 +342,7 @@ body {
328342
width: 100px;
329343
height: 100px;
330344
margin: 1px;
331-
background: #303030;
345+
background: var(--background);
332346
float: left;
333347
background-size: cover;
334348
cursor: pointer;
@@ -349,6 +363,7 @@ body {
349363
font-weight: bold;
350364
position: absolute;
351365
margin: 4px;
366+
color: #fff;
352367
}
353368
.update-box {
354369
font-size: 13px;
@@ -363,6 +378,9 @@ body {
363378
&:hover {
364379
background: #318a3e;
365380
}
381+
&.grey {
382+
background: var(--boxLight);
383+
}
366384
}
367385
.blob2 {
368386
display: none;
@@ -402,7 +420,7 @@ body {
402420
display: flex;
403421
margin-left: 70px;
404422
flex-direction: column;
405-
background: var(--background2);
423+
background: var(--main);
406424
height: 100vh;
407425
border-radius: 15px 0 0 0;
408426
margin-top: 25px;

0 commit comments

Comments
 (0)