Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use constants for API names #5693

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

ChunkyProgrammer
Copy link
Member

Use constants for API names

Pull Request Type

  • Other

Related issue

Since we reuse 'local' and 'invidious' a lot in our code, I thought it'd be a good idea to use constants for those instead

Description

  • Update code so we use constants
  • Fixes a bug for Hashtag page where it wouldn't use invidious if you have backend fallback enabled (this is leftover from when we only supported hashtags for local api)

Desktop

  • OS: Linux Mint
  • OS Version: 22
  • FreeTube version: latest nightly

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) September 12, 2024 04:26
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Sep 12, 2024
this.pageNumber = 1
},

getHashtag: async function() {
const hashtag = decodeURIComponent(this.$route.params.hashtag)
if (this.backendFallback || this.backendPreference === 'local') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaky fix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's something i noticed while switching to the constants (i included it in the description)

Comment on lines +111 to +113
export const API_DATA_SOURCES = {
LOCAL_API: 'local',
INVIDIOUS_API: 'invidious'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you named it as API_DATA_SOURCES, why include API in constants names too?

@@ -384,7 +385,7 @@ export function filterInvidiousFormats(formats) {
})
}

export async function getHashtagInvidious(hashtag, page) {
export async function getHashtagInvidious(hashtag, page = 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaky but fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: waiting for review For PRs that are complete, tested, and ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants