Skip to content

Commit

Permalink
Merge branch 'development' into feature/subscription-cache
Browse files Browse the repository at this point in the history
* development: (102 commits)
  Update version number to v0.21.0
  Remove limited donation methods (FreeTubeApp#5290)
  Translated using Weblate (Portuguese)
  Translated using Weblate (Portuguese (Portugal))
  Avoid cloning all profiles when subscribing and unsubscribing (FreeTubeApp#5289)
  Fix arrow keys not working in the Create New Playlist prompt (FreeTubeApp#5243)
  Bump ws from 8.16.0 to 8.17.1 (FreeTubeApp#5291)
  Remove a few bits of unused code (FreeTubeApp#5287)
  Update About page to display correct Freetube logo based on currently set theme (FreeTubeApp#5126)
  Translated using Weblate (Croatian)
  * Update playlist page titles (FreeTubeApp#5271)
  Update Invidious instances list (FreeTubeApp#5288)
  Translated using Weblate (Polish)
  Bump the eslint group with 2 updates (FreeTubeApp#5275)
  Bump marked from 12.0.2 to 13.0.0 (FreeTubeApp#5276)
  Bump sass from 1.77.4 to 1.77.5 (FreeTubeApp#5277)
  Bump lefthook from 1.6.15 to 1.6.16 (FreeTubeApp#5279)
  Bump webpack from 5.91.0 to 5.92.0 (FreeTubeApp#5278)
  Update Flatpak PR Workflow to work with updated module (FreeTubeApp#5270)
  Translated using Weblate (Portuguese)
  ...
  • Loading branch information
PikachuEXE committed Jun 20, 2024
2 parents 80c322b + f40876c commit 5a08fd0
Show file tree
Hide file tree
Showing 75 changed files with 2,473 additions and 1,525 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ module.exports = {
ignoreText: ['-', '•', '/', 'YouTube', 'Invidious', 'FreeTube']
}
],
// Only applicable when we upgrade to Vue 3 and vue-i18n 9+
'@intlify/vue-i18n/no-deprecated-tc': 'off',

'vue/require-explicit-emits': 'error',
'vue/no-unused-emit-declarations': 'error',
},
Expand Down
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

16 changes: 8 additions & 8 deletions .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,25 @@ jobs:
date +"%Y-%m-%d" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Update x64 File Location in yml File
uses: mikefarah/yq@4.0.0-beta1
uses: mikefarah/yq@v4.44.2
with:
# The Command which should be run
cmd: yq w -i io.freetubeapp.FreeTube.yml 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'
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/yq@4.0.0-beta1
uses: mikefarah/yq@v4.44.2
with:
# The Command which should be run
cmd: yq w -i io.freetubeapp.FreeTube.yml modules[0].sources[0].sha256 ${{ env.HASH_X64 }}
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/yq@4.0.0-beta1
uses: mikefarah/yq@v4.44.2
with:
# The Command which should be run
cmd: yq w -i io.freetubeapp.FreeTube.yml 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'
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/yq@4.0.0-beta1
uses: mikefarah/yq@v4.44.2
with:
# The Command which should be run
cmd: yq w -i io.freetubeapp.FreeTube.yml modules[0].sources[1].sha256 ${{ env.HASH_ARM64 }}
cmd: yq -i '.modules[0].sources[1].sha256 = "${{ env.HASH_ARM64 }}"' io.freetubeapp.FreeTube.yml
- name: Add Patch Notes to XML File
run: xmlstarlet ed -L -i /application/releases/release[1] -t elem -n releaseTMP -v "" -i //releaseTMP -t attr -n version -v "${{ steps.sub.outputs.result }} Beta" -i //releaseTMP -t attr -n date -v "${{ env.CURRENT_DATE }}" -s //releaseTMP -t elem -n url -v "" -s //releaseTMP/url -t text -n "" -v "https://github.com/FreeTubeApp/FreeTube/releases/tag/v${{ steps.sub.outputs.result }}-beta" -r //releaseTMP -v "release" io.freetubeapp.FreeTube.metainfo.xml
- name: Remove Release Files
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,10 @@ If you ever have any questions, feel free to ask it on our [Discussions](https:/
> Don't forget to check out the [rules](https://docs.freetubeapp.io/community/matrix/) before joining.
## Donate
If you enjoy using FreeTube, you're welcome to leave a donation using the following methods.

* [FreeTube on Liberapay](https://liberapay.com/FreeTube)
If you enjoy using FreeTube, you're welcome to leave a donation using the following method.

* Bitcoin Address: `1Lih7Ho5gnxb1CwPD4o59ss78pwo2T91eS`

* Monero Address: `48WyAPdjwc6VokeXACxSZCFeKEXBiYPV6GjfvBsfg4CrUJ95LLCQSfpM9pvNKy5GE5H4hNaw99P8RZyzmaU9kb1pD7kzhCB`

While your donations are much appreciated, only donate if you really want to. Donations are used for keeping the website up and running and eventual code signing costs.

> [!TIP]
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "freetube",
"productName": "FreeTube",
"description": "A private YouTube client",
"version": "0.20.0",
"version": "0.21.0",
"license": "AGPL-3.0-or-later",
"main": "./dist/main.js",
"private": true,
Expand Down Expand Up @@ -63,7 +63,7 @@
"autolinker": "^4.0.0",
"electron-context-menu": "^4.0.0",
"lodash.debounce": "^4.0.8",
"marked": "^12.0.2",
"marked": "^13.0.0",
"path-browserify": "^1.0.1",
"portal-vue": "^2.1.7",
"process": "^0.11.10",
Expand All @@ -79,44 +79,44 @@
"vue-observe-visibility": "^1.0.0",
"vue-router": "^3.6.5",
"vuex": "^3.6.2",
"youtubei.js": "^9.4.0"
"youtubei.js": "^10.0.0"
},
"devDependencies": {
"@babel/core": "^7.24.6",
"@babel/eslint-parser": "^7.24.6",
"@babel/core": "^7.24.7",
"@babel/eslint-parser": "^7.24.7",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.24.6",
"@babel/preset-env": "^7.24.7",
"@double-great/stylelint-a11y": "^3.0.2",
"@intlify/eslint-plugin-vue-i18n": "^2.0.0",
"@intlify/eslint-plugin-vue-i18n": "^3.0.0",
"babel-loader": "^9.1.3",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"electron": "^30.0.9",
"electron": "^31.0.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.7.0",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.2.0",
"eslint-plugin-unicorn": "^53.0.0",
"eslint-plugin-unicorn": "^54.0.0",
"eslint-plugin-vue": "^9.26.0",
"eslint-plugin-vuejs-accessibility": "^2.3.0",
"eslint-plugin-yml": "^1.14.0",
"html-webpack-plugin": "^5.6.0",
"js-yaml": "^4.1.0",
"json-minimizer-webpack-plugin": "^5.0.0",
"lefthook": "^1.6.15",
"lefthook": "^1.6.16",
"mini-css-extract-plugin": "^2.9.0",
"npm-run-all2": "^6.2.0",
"postcss": "^8.4.38",
"postcss-scss": "^4.0.9",
"prettier": "^2.8.8",
"rimraf": "^5.0.7",
"sass": "^1.77.4",
"sass": "^1.77.5",
"sass-loader": "^14.2.1",
"stylelint": "^16.6.1",
"stylelint-config-sass-guidelines": "^11.1.0",
Expand All @@ -127,7 +127,7 @@
"vue-devtools": "^5.1.4",
"vue-eslint-parser": "^9.4.3",
"vue-loader": "^15.10.0",
"webpack": "^5.91.0",
"webpack": "^5.92.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"yaml-eslint-parser": "^1.2.3"
Expand Down
19 changes: 15 additions & 4 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ const IpcChannels = {
OPEN_URL: 'open-url',
CHANGE_VIEW: 'change-view',

HISTORY_BACK: 'history-back',
HISTORY_FORWARD: 'history-forward',

DB_SETTINGS: 'db-settings',
DB_HISTORY: 'db-history',
DB_PROFILES: 'db-profiles',
Expand Down Expand Up @@ -60,6 +57,11 @@ const DBActions = {
UPDATE_PLAYLIST: 'db-action-history-update-playlist',
},

PROFILES: {
ADD_CHANNEL: 'db-action-profiles-add-channel',
REMOVE_CHANNEL: 'db-action-profiles-remove-channel'
},

PLAYLISTS: {
UPSERT_VIDEO: 'db-action-playlists-upsert-video-by-playlist-name',
UPSERT_VIDEOS: 'db-action-playlists-upsert-videos-by-playlist-name',
Expand Down Expand Up @@ -90,6 +92,11 @@ const SyncEvents = {
UPDATE_PLAYLIST: 'sync-history-update-playlist',
},

PROFILES: {
ADD_CHANNEL: 'sync-profiles-add-channel',
REMOVE_CHANNEL: 'sync-profiles-remove-channel'
},

PLAYLISTS: {
UPSERT_VIDEO: 'sync-playlists-upsert-video',
DELETE_VIDEO: 'sync-playlists-delete-video',
Expand All @@ -116,12 +123,16 @@ const PLAYLIST_HEIGHT_FORCE_LIST_THRESHOLD = 500
// YouTube search character limit is 100 characters
const SEARCH_CHAR_LIMIT = 100

// Displayed on the about page and used in the main.js file to only allow bitcoin URLs with this wallet address to be opened
const ABOUT_BITCOIN_ADDRESS = '1Lih7Ho5gnxb1CwPD4o59ss78pwo2T91eS'

export {
IpcChannels,
DBActions,
SyncEvents,
MAIN_PROFILE_ID,
MOBILE_WIDTH_THRESHOLD,
PLAYLIST_HEIGHT_FORCE_LIST_THRESHOLD,
SEARCH_CHAR_LIMIT
SEARCH_CHAR_LIMIT,
ABOUT_BITCOIN_ADDRESS,
}
30 changes: 30 additions & 0 deletions src/datastores/handlers/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,36 @@ class Profiles {
return db.profiles.updateAsync({ _id: profile._id }, profile, { upsert: true })
}

static addChannelToProfiles(channel, profileIds) {
if (profileIds.length === 1) {
return db.profiles.updateAsync(
{ _id: profileIds[0] },
{ $push: { subscriptions: channel } }
)
} else {
return db.profiles.updateAsync(
{ _id: { $in: profileIds } },
{ $push: { subscriptions: channel } },
{ multi: true }
)
}
}

static removeChannelFromProfiles(channelId, profileIds) {
if (profileIds.length === 1) {
return db.profiles.updateAsync(
{ _id: profileIds[0] },
{ $pull: { subscriptions: { id: channelId } } }
)
} else {
return db.profiles.updateAsync(
{ _id: { $in: profileIds } },
{ $pull: { subscriptions: { id: channelId } } },
{ multi: true }
)
}
}

static delete(id) {
return db.profiles.removeAsync({ _id: id })
}
Expand Down
20 changes: 20 additions & 0 deletions src/datastores/handlers/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ class Profiles {
)
}

static addChannelToProfiles(channel, profileIds) {
return ipcRenderer.invoke(
IpcChannels.DB_PROFILES,
{
action: DBActions.PROFILES.ADD_CHANNEL,
data: { channel, profileIds }
}
)
}

static removeChannelFromProfiles(channelId, profileIds) {
return ipcRenderer.invoke(
IpcChannels.DB_PROFILES,
{
action: DBActions.PROFILES.REMOVE_CHANNEL,
data: { channelId, profileIds }
}
)
}

static delete(id) {
return ipcRenderer.invoke(
IpcChannels.DB_PROFILES,
Expand Down
8 changes: 8 additions & 0 deletions src/datastores/handlers/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ class Profiles {
return baseHandlers.profiles.upsert(profile)
}

static addChannelToProfiles(channel, profileIds) {
return baseHandlers.profiles.addChannelToProfiles(channel, profileIds)
}

static removeChannelFromProfiles(channelId, profileIds) {
return baseHandlers.profiles.removeChannelFromProfiles(channelId, profileIds)
}

static delete(id) {
return baseHandlers.profiles.delete(id)
}
Expand Down
64 changes: 55 additions & 9 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import {
import path from 'path'
import cp from 'child_process'

import { IpcChannels, DBActions, SyncEvents } from '../constants'
import {
IpcChannels,
DBActions,
SyncEvents,
ABOUT_BITCOIN_ADDRESS,
} from '../constants'
import * as baseHandlers from '../datastores/handlers/base'
import { extractExpiryTimestamp, ImageCache } from './ImageCache'
import { existsSync } from 'fs'
Expand Down Expand Up @@ -855,8 +860,35 @@ function runApp() {
session.defaultSession.closeAllConnections()
})

ipcMain.on(IpcChannels.OPEN_EXTERNAL_LINK, (_, url) => {
if (typeof url === 'string') shell.openExternal(url)
ipcMain.handle(IpcChannels.OPEN_EXTERNAL_LINK, (_, url) => {
if (typeof url === 'string') {
let parsedURL

try {
parsedURL = new URL(url)
} catch {
// If it's not a valid URL don't open it
return false
}

if (
parsedURL.protocol === 'http:' || parsedURL.protocol === 'https:' ||

// Email address on the about page and Autolinker detects and links email addresses
parsedURL.protocol === 'mailto:' ||

// Autolinker detects and links phone numbers
parsedURL.protocol === 'tel:' ||

// Donation links on the about page
(parsedURL.protocol === 'bitcoin:' && parsedURL.pathname === ABOUT_BITCOIN_ADDRESS)
) {
shell.openExternal(url)
return true
}
}

return false
})

ipcMain.handle(IpcChannels.GET_SYSTEM_LOCALE, () => {
Expand Down Expand Up @@ -1090,6 +1122,24 @@ function runApp() {
)
return null

case DBActions.PROFILES.ADD_CHANNEL:
await baseHandlers.profiles.addChannelToProfiles(data.channel, data.profileIds)
syncOtherWindows(
IpcChannels.SYNC_PROFILES,
event,
{ event: SyncEvents.PROFILES.ADD_CHANNEL, data }
)
return null

case DBActions.PROFILES.REMOVE_CHANNEL:
await baseHandlers.profiles.removeChannelFromProfiles(data.channelId, data.profileIds)
syncOtherWindows(
IpcChannels.SYNC_PROFILES,
event,
{ event: SyncEvents.PROFILES.REMOVE_CHANNEL, data }
)
return null

case DBActions.GENERAL.DELETE:
await baseHandlers.profiles.delete(data)
syncOtherWindows(
Expand Down Expand Up @@ -1543,9 +1593,7 @@ function runApp() {
click: (_menuItem, browserWindow, _event) => {
if (browserWindow == null) { return }

browserWindow.webContents.send(
IpcChannels.HISTORY_BACK
)
browserWindow.webContents.goBack()
},
type: 'normal',
},
Expand All @@ -1555,9 +1603,7 @@ function runApp() {
click: (_menuItem, browserWindow, _event) => {
if (browserWindow == null) { return }

browserWindow.webContents.send(
IpcChannels.HISTORY_FORWARD
)
browserWindow.webContents.goForward()
},
type: 'normal',
},
Expand Down
Loading

0 comments on commit 5a08fd0

Please sign in to comment.