Skip to content

Commit

Permalink
Fixed final bugs before release
Browse files Browse the repository at this point in the history
  • Loading branch information
YomoSK committed Aug 10, 2024
1 parent 3098b26 commit 5ea6c89
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function createWindow() {
const win = new BrowserWindow({
width: winSize.width,
height: winSize.height,
title: 'Yomea Preview Build',
title: 'Yomea',
frame: false,
center: true,
movable: false,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yomea",
"version": "0.1.0",
"version": "0.1.1",
"description": "Chromium-based, Electron-powered private web browser",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions preload.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { contextBridge, ipcRenderer } = require('electron/renderer');
const superagent = require('superagent');
const cheerio = require('cheerio');
const { resolve } = require('path');

contextBridge.exposeInMainWorld('electron', {
loadPage: url => ipcRenderer.send('load-page', url),
Expand All @@ -13,6 +14,7 @@ contextBridge.exposeInMainWorld('electron', {

contextBridge.exposeInMainWorld('webSupplier', {
getTitle: url => {
if(url.length == 0) return new Promise((resolve, reject) => resolve(null));
return new Promise((resolve, reject) => {
superagent.get(url).then(html => {
resolve(cheerio.load(html.text)('head>title').text());
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
</nav>

<p v-if="opened[openedIndex].url == 'about:blank' && notice.length > 0" v-html="notice.join('<br>')" id="notice"></p>
<p v-if="opened[openedIndex].url == 'about:blank' && notice.length > 0" v-html="notice.replace(/\n/g, '<br>')" id="notice"></p>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script src="https://unpkg.com/@popperjs/core@2"></script>
Expand Down
19 changes: 13 additions & 6 deletions public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ const app = Vue.createApp({

if(this.url.includes('about:blank')) {
window.electron.loadPage(this.url);
this.url = '';
this.opened[this.openedIndex].title = null;
this.opened[this.openedIndex].url = 'about:blank';
this.setURL('');
target.blur();
return;
}
Expand All @@ -40,6 +38,10 @@ const app = Vue.createApp({
window.electron.loadPage(this.url);
this.opened[this.openedIndex] = { title: await window.webSupplier.getTitle(this.url), url: this.url };
},
async setURL(url) {
this.url = url;
this.opened[this.openedIndex] = { title: await window.webSupplier.getTitle(this.url), url: this.url || 'about:blank' };
},
newTab() {
if(this.isEmptyURL()) return;
window.electron.loadPage('about:blank');
Expand Down Expand Up @@ -78,9 +80,14 @@ const app = Vue.createApp({
}
},
mounted() {
window.emitter.recieve('navigate', async url => {
this.url = url;
this.opened[this.openedIndex] = { title: await window.webSupplier.getTitle(this.url), url: this.url };
window.emitter.recieve('navigate', async url => this.setURL(url));

document.addEventListener('click', async click => {
if(click.target.parentNode.id == 'notice') {
click.preventDefault();
this.setURL(click.target.getAttribute('href'));
window.electron.loadPage(this.url);
}
});

function updateCheckerTippy(text) {
Expand Down
1 change: 0 additions & 1 deletion public/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ nav > #controls > div {
p#notice {
margin-top: calc(2rem + 57px);
font-family: 'Palanquin Dark', sans-serif;
font-size: 1.2rem;
font-weight: 700;
letter-spacing: 2px;
text-align: center;
Expand Down

0 comments on commit 5ea6c89

Please sign in to comment.