Skip to content

Commit cbc9206

Browse files
committed
Merge branch 'main' of https://github.com/OpenNBS/NoteBlockWorld into develop
2 parents 9e5e0f1 + e12be94 commit cbc9206

File tree

20 files changed

+194
-57
lines changed

20 files changed

+194
-57
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Hello! We're glad to have you interested in contributing to Note Block World. This document will guide you through the process of setting up the project and submitting your contributions.
44

5-
This page is a work-in-progress and will be updated as the project evolves. If you have any questions or need help, feel free to reach out to us on our [Discord server](https://discord.gg/open-note-block-studio-608692895179997252).
5+
This page is a work-in-progress and will be updated as the project evolves. If you have any questions or need help, feel free to reach out to us on our [Discord server](https://discord.gg/note-block-world-608692895179997252).
66

77
## Stack
88

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<p align="center">
2-
<img src="img/header.png" alt="Note Block World header" />
2+
<a href="https://noteblock.world">
3+
<img src="img/header.png" alt="Note Block World header" />
4+
</a>
35
</p>
46

57
<p align="center">
@@ -9,15 +11,15 @@
911
</p>
1012

1113
<p align="center">
12-
👥 <a href="https://discord.gg/open-note-block-studio-608692895179997252">Discord</a> •
14+
👥 <a href="https://discord.gg/note-block-world-608692895179997252">Discord</a> •
1315
📆 <a href="https://github.com/orgs/OpenNBS/projects/4">Roadmap</a> •
1416
🗨 <a href="https://github.com/OpenNBS/NoteBlockWorld/issues/new/choose">Feedback</a> •
1517
☕ <a href="https://opencollective.com/opennbs/donate">Buy us a coffee!</a>
1618
</p>
1719

1820
## ℹ About the project
1921

20-
**Note Block World** is a collaborative, social website where users can share their note block songs made with [Note Block Studio](https://noteblock.studio/). Our goal is to give the NBS community a platform to share their creations with the world, discover new music and connect with other creators!
22+
[**Note Block World**](https://noteblock.world/) is a collaborative, social website where users can share their note block songs made with [Note Block Studio](https://noteblock.studio/). Our goal is to give the NBS community a platform to share their creations with the world, discover new music and connect with other creators!
2123

2224
## 💬 Issues/Feedback
2325

@@ -27,7 +29,7 @@ If you have found an issue or would like to suggest a feature, please open a [ne
2729

2830
We welcome contributions to the project! Read our [contributor guide](CONTRIBUTING.md) to set up the project and get started.
2931

30-
Please [open an issue](/issues/new/choose) discussing the changes you would like to make before submitting a pull request. Alternatively, you can join our [Discord server](https://discord.gg/open-note-block-studio-608692895179997252) to discuss the changes with our development team!
32+
Please [open an issue](/issues/new/choose) discussing the changes you would like to make before submitting a pull request. Alternatively, you can join our [Discord server](https://discord.gg/note-block-world-608692895179997252) to discuss the changes with our development team!
3133

3234
## ❤ Donate
3335

@@ -38,6 +40,7 @@ Thanks to all our current and past sponsors for helping us keep Note Block World
3840
###### Supporters
3941

4042
<img src="https://opencollective.com/opennbs/backers.svg" height="48px"/>
43+
<img src="https://opencollective.com/opennbs/sponsors.svg" height="48px"/>
4144

4245
---
4346

server/src/auth/auth.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class AuthService {
220220

221221
const frontEndURL = this.FRONTEND_URL;
222222
const domain = this.APP_DOMAIN;
223-
const maxAge = parseInt(this.COOKIE_EXPIRES_IN);
223+
const maxAge = parseInt(this.COOKIE_EXPIRES_IN) * 1000;
224224

225225
res.cookie('token', token.access_token, {
226226
domain: domain,

server/src/song/song.controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ export class SongController {
122122
@GetRequestToken() user: UserDocument | null,
123123
@Res() res: Response,
124124
): Promise<void> {
125+
user = validateUser(user);
126+
125127
// TODO: no longer used
126128
res.set({
127129
'Content-Disposition': 'attachment; filename="song.nbs"',

shared/features/song/obfuscate.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,21 @@ export class SongObfuscator {
119119

120120
const resolveKeyAndPitch = (note: Note) => {
121121
const factoredPitch = note.key * 100 + note.pitch;
122-
const key = Math.floor((factoredPitch + 50) / 100);
123-
const pitch = ((factoredPitch + 50) % 100) - 50;
122+
123+
let key, pitch;
124+
125+
if (factoredPitch < 0) {
126+
// Below A0
127+
key = 0;
128+
pitch = factoredPitch;
129+
} else if (factoredPitch >= 87 * 100) {
130+
// Above C8
131+
key = 87;
132+
pitch = factoredPitch - 87 * 100;
133+
} else {
134+
key = Math.floor((factoredPitch + 50) / 100);
135+
pitch = ((factoredPitch + 50) % 100) - 50;
136+
}
124137

125138
return { key, pitch };
126139
};

shared/validation/song/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ export const MY_SONGS = deepFreeze({
128128
});
129129

130130
export const BROWSER_SONGS = deepFreeze({
131-
max_recent_songs: 100,
132131
featuredPageSize: 10,
133132
paddedFeaturedPageSize: 5,
134133
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Have you got any question, suggestion or feedback? We'd love to hear from you!
22

3-
To report an issue or suggest a new feature, please [open a new issue](https://github.com/issues/new/choose) in our GitHub repository. Make sure to search the existing issues to see if your suggestion has already been made. Also, check our [project roadmap](https://github.com/orgs/OpenNBS/projects/4) to see if the feature you want is already planned!
3+
To report an issue or suggest a new feature, please [open a new issue](https://github.com/OpenNBS/NoteBlockWorld/issues/new/choose) in our GitHub repository. Make sure to search the existing issues to see if your suggestion has already been made. Also, check our [project roadmap](https://github.com/orgs/OpenNBS/projects/4) to see if the feature you want is already planned!
44

5-
For general support, or if you'd just like to have a chat, the fastest way to get in touch with us is by joining our public community on [Discord](https://discord.gg/open-note-block-studio-608692895179997252). We're always happy to help!
5+
For general support, or if you'd just like to have a chat, the fastest way to get in touch with us is by joining our public community on [Discord](https://discord.gg/note-block-world-608692895179997252). We're always happy to help!
66

77
For business inquiries, or if you need to reach out to us privately, you can send us an email at [[email protected]]([email protected]).

web/src/app/(content)/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ export const metadata: Metadata = {
5252
};
5353

5454
async function Home() {
55-
const recentSongs = await fetchRecentSongs();
55+
//const recentSongs = await fetchRecentSongs();
5656
const featuredSongs = await fetchFeaturedSongs();
5757

5858
return (
5959
<HomePageProvider
60-
initialRecentSongs={recentSongs}
60+
initialRecentSongs={[]}
6161
initialFeaturedSongs={featuredSongs}
6262
>
6363
<HomePageComponent />

web/src/modules/browse/WelcomeBanner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const WelcomeBanner = () => {
4040
</Link>
4141
{' • '}
4242
<Link
43-
href='https://github.com/OpenNBS/NoteBlockWorld/issues/new/choose'
43+
href='https://discord.gg/note-block-world-608692895179997252'
4444
className='text-blue-400 hover:text-blue-300'
4545
>
4646
Discord Server

web/src/modules/browse/components/client/context/RecentSongs.context.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client';
22

3-
import { BROWSER_SONGS } from '@shared/validation/song/constants';
43
import { SongPreviewDtoType } from '@shared/validation/song/dto/types';
54
import {
65
createContext,
@@ -39,7 +38,7 @@ export function RecentSongsProvider({
3938
useState<SongPreviewDtoType[]>(initialRecentSongs);
4039

4140
const [recentError, setRecentError] = useState<string>('');
42-
const [page, setPage] = useState<number>(3);
41+
const [page, setPage] = useState<number>(0);
4342
const [loading, setLoading] = useState(false);
4443
const [hasMore, setHasMore] = useState(true);
4544
const [categories, setCategories] = useState<Record<string, number>>({});
@@ -56,7 +55,7 @@ export function RecentSongsProvider({
5655
{
5756
params: {
5857
page,
59-
limit: 8, // TODO: fix constants
58+
limit: 12, // TODO: fix constants
6059
order: false,
6160
},
6261
},
@@ -67,7 +66,7 @@ export function RecentSongsProvider({
6766
...response.data,
6867
]);
6968

70-
if (response.data.length < 8) {
69+
if (response.data.length < 12) {
7170
setHasMore(false);
7271
}
7372
} catch (error) {
@@ -114,18 +113,13 @@ export function RecentSongsProvider({
114113
setEndpoint(newEndpoint);
115114
}, [selectedCategory]);
116115

117-
// Fetch recent songs when the page or endpoint changes
118116
useEffect(() => {
117+
if (page === 0) return;
119118
fetchRecentSongs();
120-
}, [page, endpoint]);
119+
}, [page, endpoint, fetchRecentSongs]);
121120

122121
async function increasePageRecent() {
123-
if (
124-
BROWSER_SONGS.max_recent_songs <= recentSongs.length ||
125-
loading ||
126-
recentError ||
127-
!hasMore
128-
) {
122+
if (loading || recentError || !hasMore) {
129123
return;
130124
}
131125

0 commit comments

Comments
 (0)