Skip to content

Commit

Permalink
Merge branch 'release-v0.0.5' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jurelik committed Jan 7, 2022
2 parents 35c4462 + ebbbd28 commit 6f053b8
Show file tree
Hide file tree
Showing 33 changed files with 432 additions and 231 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

## build ohm
```
npm run build_osx
npm run build_linux
npm run build_win
npm run build:osx
npm run build:linux
npm run build:win
```

## contributing
Expand Down
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ ipcMain.handle('load-file', async (event) => {
try {
const res = await dialog.showOpenDialog({
filters: [
{ name: 'ohm_upload_state', extensions: [ 'ous' ] }
{ name: 'ohm_upload_state', extensions: [ 'ous', 'ohm' ] }
]
});
return res;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ohm",
"version": "0.0.4",
"version": "0.0.5",
"description": "platform for open source music",
"main": "main.js",
"scripts": {
Expand Down
23 changes: 14 additions & 9 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

const { ipcRenderer } = require('electron');
const { create } = require('ipfs-http-client');
const fs = require('fs');
const path = require('path');
const log = require('./utils/log');
const helpers = require('./utils/helpers');
const { loadingIcon } = require('./utils/svgs');
Expand Down Expand Up @@ -77,11 +79,14 @@ function App() {
this.settingsStore = new Store({ name: 'settings' });
this.settingsStore.init();

//Load theme
helpers.loadTheme();

login = new LoginView();
await login.init(); //Attempt login with credentials
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);

this.root.innerHTML = '' //Draw login screen
login.render();
Expand All @@ -107,7 +112,7 @@ function App() {
login.render();
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
}
}

Expand Down Expand Up @@ -153,7 +158,7 @@ function App() {
this.header.backButton.disabled = true;
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
}
});

Expand Down Expand Up @@ -252,7 +257,7 @@ function App() {
this.triggerLoading(false); //Stop loading indicator
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
if (err.message === 'User not authenticated') await this.logout(true);
}
}
Expand Down Expand Up @@ -299,7 +304,7 @@ function App() {
}
catch (err) {
if (err.message === 'The user aborted a request.') return;
log.error(err.message);
log.error(err);
}
}

Expand Down Expand Up @@ -331,7 +336,7 @@ function App() {
this.logout(true);
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
}
}

Expand All @@ -353,7 +358,7 @@ function App() {
log.success('Location successfully changed.');
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
}
}

Expand All @@ -375,7 +380,7 @@ function App() {
log.success('Bio successfully changed.');
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
}
}

Expand All @@ -398,7 +403,7 @@ function App() {
log.success('Successfully created artist.');
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/components/actionBarAlbum.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function ActionBarAlbum(data) {
else await ipfs.startTransfer(this.data);
}
catch (err) {
if (err.message !== 'The user aborted a request.') log.error(err.message); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
if (err.message !== 'The user aborted a request.') log.error(err); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
}
}

Expand All @@ -38,7 +38,7 @@ function ActionBarAlbum(data) {
await ipfs.startTransfer(this.data, { download: true });
}
catch (err) {
if (err.message !== 'The user aborted a request.') log.error(err.message); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
if (err.message !== 'The user aborted a request.') log.error(err); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
}
}

Expand Down Expand Up @@ -93,7 +93,7 @@ function ActionBarAlbum(data) {
}
}
catch (err) {
log.error(err.message);
log.error(err);
}
}

Expand Down Expand Up @@ -172,7 +172,7 @@ function ActionBarAlbum(data) {
return this.el;
}
catch (err) {
log.error(err.message);
log.error(err);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/actionBarSong.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function ActionBarSong(data) {
else await ipfs.startTransfer(this.data);
}
catch (err) {
if (err.message !== 'The user aborted a request.') log.error(err.message); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
if (err.message !== 'The user aborted a request.') log.error(err); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
}
}

Expand All @@ -57,7 +57,7 @@ function ActionBarSong(data) {
await ipfs.startTransfer(this.data, { download: true });
}
catch (err) {
if (err.message !== 'The user aborted a request.') log.error(err.message); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
if (err.message !== 'The user aborted a request.') log.error(err); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
}
}

Expand Down Expand Up @@ -112,7 +112,7 @@ function ActionBarSong(data) {
}
}
catch (err) {
log.error(err.message);
log.error(err);
}
}

Expand Down Expand Up @@ -194,7 +194,7 @@ function ActionBarSong(data) {
return this.el;
}
catch (err) {
log.error(err.message);
log.error(err);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/album.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Album(data, view) {
e.stopPropagation();
const position = this.getPosition();

if (this.view === 'explore' || this.view === 'feed' || this.view === 'pinned') app.player.queueFeed(this.data.songs[position])
if (this.view === 'explore' || this.view === 'feed' || this.view === 'pinned' || this.view === 'artist') app.player.queueFeed(this.data.songs[position])
else app.player.queueAlbum(this.data, position);
}

Expand Down Expand Up @@ -124,7 +124,7 @@ function Album(data, view) {
return this.el;
}
catch (err) {
log.error(err.message);
log.error(err);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/artist.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Artist(data, view) {
else button.classList.add('following');
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/components/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Comments(data) {
this.el.querySelector('textarea').value = ''; //Reset comment field to empty
}
catch (err) {
if (err.message !== 'FETCH_ERR') log.error(err.message);
if (err.message !== 'FETCH_ERR') log.error(err);
}
}

Expand All @@ -68,7 +68,6 @@ function Comments(data) {
submit.textContent = 'submit';
submit.setAttribute('type', 'submit');
textarea.setAttribute('rows', '1');
textarea.setAttribute('autofocus', true);
textarea.setAttribute('placeholder', 'send comment..');
marker.textContent = '> '

Expand Down
2 changes: 1 addition & 1 deletion src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Header() {
app.triggerLoading(false); //Trigger loading indicator
}
catch (err) {
log.error(err.message);
log.error(err);
if (err.message === 'User not authenticated') await app.logout(true);
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/components/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,14 @@ function Player() {
}

this.deconstructFeed = () => { //Goes over the feed and turns deconstructs albums into songs
const feed = app.current === 'pinned' ? app.views[app.current].data.items : app.views[app.current].data;
const currentView = app.views[app.current];
let formatted = [];
let feed;

//Get feed depending on view
if (app.current === 'pinned') feed = currentView.data.items;
else if (app.current === 'artist') feed = currentView.artist.albums.concat(currentView.artist.songs);
else feed = app.views[app.current].data;

for (let item of feed) {
if (item.type === 'album') {
Expand Down Expand Up @@ -303,7 +309,7 @@ function Player() {
this.updateSeekStyle = (seek) => { //Updates background property
const el = seek || this.el.querySelector('.seek');
const value = (el.value-el.min)/(el.max-el.min)*100
el.style.background = 'linear-gradient(to right, #888 0%, #888 ' + value + '%, #444 ' + value + '%, #444 100%)'
el.style.background = 'linear-gradient(to right, var(--f-mid) 0%, var(--f-mid) ' + value + '%, var(--b-high) ' + value + '%, var(--b-high) 100%)'
}

this.getVolumeValue = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/song.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Song(data, view) {
e.stopPropagation();

if (this.view === 'album') app.player.queueAlbum(app.views.album.data, this.getPosition());
else if (this.view === 'explore' || this.view === 'feed' || this.view === 'pinned') app.player.queueFeed(this.data);
else if (this.view === 'explore' || this.view === 'feed' || this.view === 'pinned' || this.view === 'artist') app.player.queueFeed(this.data);
else app.player.queueItem(this.data);
}

Expand Down Expand Up @@ -110,7 +110,7 @@ function Song(data, view) {
return this.el;
}
catch (err) {
log.error(err.message);
log.error(err);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Transfer(data, unique) {
await ipfs.resumeTransfer(this.unique);
}
catch (err) {
if (err.message !== 'The user aborted a request.') log.error(err.message); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
if (err.message !== 'The user aborted a request.') log.error(err); //If request was aborted this means it was either cleared or paused, which is logged accordingly already
}
}

Expand All @@ -51,7 +51,7 @@ function Transfer(data, unique) {
log.success('Transfer cleared.');
}
catch (err) {
log.error(err.message);
log.error(err);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/uploadFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function UploadFile(data) {
if ((file.type === 'original' || file.type === 'external') && !shallow) {
if (file.name === '') throw new Error('File name is missing.');
if (!helpers.allowedFormat(file.name)) throw new Error('File name can only include letters, numbers and underscores.'); //Check name for bad characters
if (file.path === '') throw new Error('File is missing.');
if (!file.path || file.path === '') throw new Error('File is missing.');
if (file.tags.length === 0) throw new Error('File tags are missing.');
for (let tag of file.tags) { //Check tags for bad characters
if (!helpers.allowedFormat(tag)) throw new Error('Tags can only include letters, numbers and underscores.');
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="styles.css">
<script type="text/javascript" src="./app.js"></script>
</head>
<body style="background: white;">
<body>
<div class="root">
</div>
<script>
Expand Down
Loading

0 comments on commit 6f053b8

Please sign in to comment.