Skip to content

Commit

Permalink
Merge branch 'feature/better-new-window' into custom-builds/current
Browse files Browse the repository at this point in the history
* feature/better-new-window:
  * Update top nav to move query text to new window instead of remaining in old window
  Revert "Bump the babel group with 2 updates (FreeTubeApp#5526)"
  Bump electron from 31.3.0 to 31.3.1 (FreeTubeApp#5529)
  Bump eslint-plugin-n from 17.10.1 to 17.10.2 in the eslint group (FreeTubeApp#5527)
  Bump the babel group with 2 updates (FreeTubeApp#5526)
  Bump mikefarah/yq from 4.44.2 to 4.44.3 (FreeTubeApp#5525)
  Bump stylelint from 16.7.0 to 16.8.1 in the stylelint group (FreeTubeApp#5528)
  Bump swiper from 11.1.8 to 11.1.9 (FreeTubeApp#5530)
  Various performance improvements to the store (FreeTubeApp#5522)
  Small cleanup after the YouTube.js update (FreeTubeApp#5520)
  Translated using Weblate (Finnish)
  • Loading branch information
PikachuEXE committed Aug 6, 2024
2 parents f098263 + f0b8fe3 commit 1d77658
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 99 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,22 @@ jobs:
date +"%Y-%m-%d" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Update x64 File Location in yml File
uses: mikefarah/[email protected].2
uses: mikefarah/[email protected].3
with:
# The Command which should be run
cmd: yq -i '.modules[0].sources[0].url = "https://github.com/FreeTubeApp/FreeTube/releases/download/v${{ steps.sub.outputs.result }}-beta/freetube-${{ steps.sub.outputs.result }}-linux-portable-x64.zip"' io.freetubeapp.FreeTube.yml
- name: Update x64 Hash in yml File
uses: mikefarah/[email protected].2
uses: mikefarah/[email protected].3
with:
# The Command which should be run
cmd: yq -i '.modules[0].sources[0].sha256 = "${{ env.HASH_X64 }}"' io.freetubeapp.FreeTube.yml
- name: Update ARM File Location in yml File
uses: mikefarah/[email protected].2
uses: mikefarah/[email protected].3
with:
# The Command which should be run
cmd: yq -i '.modules[0].sources[1].url = "https://github.com/FreeTubeApp/FreeTube/releases/download/v${{ steps.sub.outputs.result }}-beta/freetube-${{ steps.sub.outputs.result }}-linux-portable-arm64.zip"' io.freetubeapp.FreeTube.yml
- name: Update ARM Hash in yml File
uses: mikefarah/[email protected].2
uses: mikefarah/[email protected].3
with:
# The Command which should be run
cmd: yq -i '.modules[0].sources[1].sha256 = "${{ env.HASH_ARM64 }}"' io.freetubeapp.FreeTube.yml
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"path-browserify": "^1.0.1",
"portal-vue": "^2.1.7",
"process": "^0.11.10",
"swiper": "^11.1.8",
"swiper": "^11.1.9",
"video.js": "7.21.5",
"videojs-contrib-quality-levels": "^3.0.0",
"videojs-http-source-selector": "^1.1.6",
Expand All @@ -92,14 +92,14 @@
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"electron": "^31.3.0",
"electron": "^31.3.1",
"electron-builder": "^24.13.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-n": "^17.10.1",
"eslint-plugin-n": "^17.10.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.0.0",
"eslint-plugin-unicorn": "^55.0.0",
Expand All @@ -118,7 +118,7 @@
"rimraf": "^6.0.1",
"sass": "^1.77.8",
"sass-loader": "^16.0.0",
"stylelint": "^16.7.0",
"stylelint": "^16.8.1",
"stylelint-config-sass-guidelines": "^12.0.0",
"stylelint-config-standard": "^36.0.1",
"stylelint-high-performance-animation": "^1.10.0",
Expand Down
6 changes: 0 additions & 6 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -994,12 +994,6 @@ function runApp() {
try {
const contents = await asyncFs.readFile(filePath)

// Probably a corrupted/broken cache entry, pretend it's absent
// A valid entry should be a few KB large
if (contents.byteLength < 500) {
return undefined
}

return contents.buffer
} catch (e) {
console.error(e)
Expand Down
29 changes: 19 additions & 10 deletions src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default defineComponent({
this.debounceSearchResults = debounce(this.getSearchSuggestions, 200)
},
methods: {
goToSearch: async function (query, { event }) {
goToSearch: async function (queryText, { event }) {
const doCreateNewWindow = event && event.shiftKey

if (window.innerWidth <= MOBILE_WIDTH_THRESHOLD) {
Expand All @@ -148,7 +148,7 @@ export default defineComponent({

clearLocalSearchSuggestionsSession()

this.getYoutubeUrlInfo(query).then((result) => {
this.getYoutubeUrlInfo(queryText).then((result) => {
switch (result.urlType) {
case 'video': {
const { videoId, timestamp, playlistId } = result
Expand All @@ -164,7 +164,8 @@ export default defineComponent({
openInternalPath({
path: `/watch/${videoId}`,
query,
doCreateNewWindow
doCreateNewWindow,
searchQueryText: queryText,
})
break
}
Expand All @@ -175,7 +176,8 @@ export default defineComponent({
openInternalPath({
path: `/playlist/${playlistId}`,
query,
doCreateNewWindow
doCreateNewWindow,
searchQueryText: queryText,
})
break
}
Expand All @@ -187,7 +189,7 @@ export default defineComponent({
path: `/search/${encodeURIComponent(searchQuery)}`,
query,
doCreateNewWindow,
searchQueryText: searchQuery
searchQueryText: searchQuery,
})
break
}
Expand All @@ -196,7 +198,8 @@ export default defineComponent({
const { hashtag } = result
openInternalPath({
path: `/hashtag/${encodeURIComponent(hashtag)}`,
doCreateNewWindow
doCreateNewWindow,
searchQueryText: `#${hashtag}`,
})

break
Expand All @@ -209,16 +212,17 @@ export default defineComponent({
path: `/channel/${channelId}/${subPath}`,
doCreateNewWindow,
query: {
url
}
url,
},
searchQueryText: queryText,
})
break
}

case 'invalid_url':
default: {
openInternalPath({
path: `/search/${encodeURIComponent(query)}`,
path: `/search/${encodeURIComponent(queryText)}`,
query: {
sortBy: this.searchSettings.sortBy,
time: this.searchSettings.time,
Expand All @@ -227,10 +231,15 @@ export default defineComponent({
features: this.searchSettings.features,
},
doCreateNewWindow,
searchQueryText: query
searchQueryText: queryText,
})
}
}

if (doCreateNewWindow) {
// Query text copied to new window = can be removed from current window
this.updateSearchInputText('')
}
})
},

Expand Down
4 changes: 0 additions & 4 deletions src/renderer/helpers/api/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,8 @@ async function createInnertube({ withPlayer = false, location = undefined, safet
const client = bodyJson.context.client

client.clientVersion = clientVersion
client.deviceMake = 'Apple'
client.deviceModel = 'iPhone16,2' // iPhone 15 Pro Max
client.osName = 'iOS'
client.osVersion = iosVersion
delete client.browserName
delete client.browserVersion

init.body = JSON.stringify(bodyJson)
}
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/store/modules/profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ const actions = {
commit('setProfileList', profiles)
},

async batchUpdateSubscriptionDetails({ getters, dispatch }, channels) {
async batchUpdateSubscriptionDetails({ dispatch, state }, channels) {
if (channels.length === 0) { return }

const profileList = getters.getProfileList
const profileList = state.profileList

for (const profile of profileList) {
const currentProfileCopy = deepCopy(profile)
Expand Down Expand Up @@ -135,9 +135,9 @@ const actions = {
}
},

async updateSubscriptionDetails({ getters, dispatch }, { channelThumbnailUrl, channelName, channelId }) {
async updateSubscriptionDetails({ dispatch, state }, { channelThumbnailUrl, channelName, channelId }) {
const thumbnail = channelThumbnailUrl?.replace(/=s\d*/, '=s176') ?? null // change thumbnail size if different
const profileList = getters.getProfileList
const profileList = state.profileList
for (const profile of profileList) {
const currentProfileCopy = deepCopy(profile)
const channel = currentProfileCopy.subscriptions.find((channel) => {
Expand Down
44 changes: 12 additions & 32 deletions src/renderer/store/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,14 @@ const stateWithSideEffects = {
await Promise.allSettled(loadPromises)

i18n.locale = targetLocale
await dispatch('getRegionData', {
locale: targetLocale
})
await dispatch('getRegionData', targetLocale)
}
},

defaultInvidiousInstance: {
defaultValue: '',
sideEffectsHandler: ({ commit, getters }, value) => {
if (value !== '' && getters.getCurrentInvidiousInstance !== value) {
sideEffectsHandler: ({ commit, rootState }, value) => {
if (value !== '' && rootState.invidious.currentInvidiousInstance !== value) {
commit('setCurrentInvidiousInstance', value)
}
}
Expand All @@ -420,6 +418,8 @@ const stateWithSideEffects = {
}
}

const settingsWithSideEffects = Object.keys(stateWithSideEffects)

const customState = {
}

Expand All @@ -428,28 +428,8 @@ const customGetters = {

const customMutations = {}

/**********/
/*
* DO NOT TOUCH THIS SECTION
* If you wanna add to custom data or logic to the module,
* do so in the aproppriate `custom_` variable
*
* Some of the custom actions below use these properties, so I'll be
* adding them here instead of further down for clarity's sake
*/
Object.assign(customState, {
settingsWithSideEffects: Object.keys(stateWithSideEffects)
})

Object.assign(customGetters, {
settingHasSideEffects: (state) => {
return (id) => state.settingsWithSideEffects.includes(id)
}
})
/**********/

const customActions = {
grabUserSettings: async ({ commit, dispatch, getters }) => {
grabUserSettings: async ({ commit, dispatch }) => {
try {
// Assigning default settings for settings that have side effects
const userSettings = Object.entries(Object.assign({},
Expand All @@ -459,7 +439,7 @@ const customActions = {

for (const setting of userSettings) {
const [_id, value] = setting
if (getters.settingHasSideEffects(_id)) {
if (settingsWithSideEffects.includes(_id)) {
dispatch(defaultSideEffectsTriggerId(_id), value)
}

Expand All @@ -473,14 +453,14 @@ const customActions = {
},

// Should be a root action, but we'll tolerate
setupListenersToSyncWindows: ({ commit, dispatch, getters }) => {
setupListenersToSyncWindows: ({ commit, dispatch }) => {
if (process.env.IS_ELECTRON) {
const { ipcRenderer } = require('electron')

ipcRenderer.on(IpcChannels.SYNC_SETTINGS, (_, { event, data }) => {
switch (event) {
case SyncEvents.GENERAL.UPSERT:
if (getters.settingHasSideEffects(data._id)) {
if (settingsWithSideEffects.includes(data._id)) {
dispatch(defaultSideEffectsTriggerId(data._id), data.value)
}

Expand Down Expand Up @@ -650,15 +630,15 @@ for (const settingId of Object.keys(state)) {
mutations[mutationId] = (state, value) => { state[settingId] = value }

// If setting has side effects, generate action to handle them
if (Object.keys(stateWithSideEffects).includes(settingId)) {
if (settingsWithSideEffects.includes(settingId)) {
actions[triggerId] = stateWithSideEffects[settingId].sideEffectsHandler
}

actions[updaterId] = async ({ commit, dispatch, getters }, value) => {
actions[updaterId] = async ({ commit, dispatch }, value) => {
try {
await DBSettingHandlers.upsert(settingId, value)

if (getters.settingHasSideEffects(settingId)) {
if (settingsWithSideEffects.includes(settingId)) {
dispatch(triggerId, value)
}

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ const actions = {
commit('setShowProgressBar', value)
},

async getRegionData ({ commit }, { locale }) {
async getRegionData ({ commit }, locale) {
const localePathExists = process.env.GEOLOCATION_NAMES.includes(locale)

const url = createWebURL(`/static/geolocations/${localePathExists ? locale : 'en-US'}.json`)
Expand Down
6 changes: 5 additions & 1 deletion static/locales/fi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ User Playlists:
ole tallentanut videoita. Paina "Tallenna"-painiketta videon kulmassa tallentaaksesi
sen tänne
Search bar placeholder: Etsi soittolistoja
Empty Search Message: Tällä soittolistalla ei ole videoita, jotka vastaavat hakuasi
Empty Search Message: Tällä soittolistalla ei ole hakuasi vastaavia videoita
Sort By:
NameAscending: A-Ö
NameDescending: Ö-A
Expand Down Expand Up @@ -586,6 +586,7 @@ Settings:
Set Password: Aseta salasana
Remove Password: Poista salasana
Expand All Settings Sections: Laajenna asetusten kaikki osiot
Sort Settings Sections (A-Z): Järjestä asetusosio (A-Ö)
About:
#On About page
About: 'Tietoja'
Expand Down Expand Up @@ -640,6 +641,8 @@ About:
Donate: Lahjoita
Source code: Lähdekoodi
Discussions: Keskustelut
Licensed under the: Lisenssi
AGPLv3: AGPLv3
Channel:
Subscribe: 'Tilaa'
Unsubscribe: 'Peruuta tilaus'
Expand Down Expand Up @@ -1127,6 +1130,7 @@ Search Listing:
Subtitles: Teksitykset
Feed:
Refresh Feed: Päivitä {subscriptionName}
Feed Last Updated: 'Syöte {feedName} päivitetty viimeksi: {date}'
Yes, Delete: Kyllä, poista
checkmark:
Cancel: Peruuta
Expand Down
Loading

0 comments on commit 1d77658

Please sign in to comment.