mirror of https://github.com/FreeTubeApp/FreeTube
Fix issues from Vue.js Merge
This commit is contained in:
parent
860d384fbd
commit
6ccb6de22e
18
package.json
18
package.json
|
@ -57,6 +57,24 @@
|
|||
"freetube"
|
||||
]
|
||||
}
|
||||
],
|
||||
"electronPackagerConfig": {
|
||||
"packageManager": "yarn",
|
||||
"icon": "./src/icons/iconColor.icns"
|
||||
},
|
||||
"electronWinstallerConfig": {
|
||||
"name": "freetube",
|
||||
"iconUrl": "https://raw.githubusercontent.com/FreeTubeApp/FreeTubeApp.github.io/master/images/iconColor.ico",
|
||||
"setupIcon": "./src/icons/iconColor.ico"
|
||||
},
|
||||
"electronInstallerDebian": {
|
||||
"icon": "src/icons/iconColor.png"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/FreeTubeApp/FreeTube"
|
||||
}
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron-forge": "^5.2.2",
|
||||
|
|
|
@ -20,11 +20,22 @@
|
|||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='confirmFunction'>
|
||||
<span id='confirmMessage'>Would you like to perform the function?</span>
|
||||
<div class='confirmButton' id='confirmYes'>Yes</div>
|
||||
<div class='confirmButton' id='confirmNo'>No</div>
|
||||
</div>
|
||||
<div id='toast'>
|
||||
<span id='toastMessage'></span>
|
||||
<i onclick='hideToast()' class="closeToast fas fa-times"></i>
|
||||
</div>
|
||||
<div class="topNav">
|
||||
<i onclick='toggleSideNavigation()' class="fas fa-bars" id='menuButton'></i>
|
||||
<div class="searchBar">
|
||||
<input id='search' class="search" type="text" placeholder="Search / Go to URL">
|
||||
<i onclick='parseSearchText()' class="fas fa-search searchButton" style='margin-right: -10px; cursor: pointer'></i>
|
||||
</div>
|
||||
<img src='icons/iconBlack.png' id='menuIcon' />
|
||||
<img src='icons/textBlack.png' id='menuText' />
|
||||
</div>
|
||||
|
@ -70,6 +81,7 @@
|
|||
</div>
|
||||
<div id='progressView'></div>
|
||||
</body>
|
||||
<script src="js/general.js"></script>
|
||||
<script src="js/youtubeApi.js"></script>
|
||||
<script src="js/updates.js"></script>
|
||||
<script src="js/db.js"></script>
|
||||
|
|
|
@ -62,7 +62,7 @@ function goToChannel(channelId) {
|
|||
maxResults: 50,
|
||||
order: 'date',
|
||||
}, function (data) {
|
||||
const channelData = data.items[0];
|
||||
let grabDuration = getDuration(data.items);
|
||||
|
||||
grabDuration.then((videoList) => {
|
||||
channelView.seen = true;
|
||||
|
@ -72,8 +72,6 @@ function goToChannel(channelId) {
|
|||
videoList.items.forEach((video) => {
|
||||
displayVideo(video, 'channel');
|
||||
});
|
||||
$('#main').html(rendered);
|
||||
stopLoadingAnimation();
|
||||
|
||||
// Grab the channel's latest uploads. API forces a max of 50.
|
||||
youtubeAPI('search', {
|
||||
|
@ -93,4 +91,6 @@ function goToChannel(channelId) {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,16 +1,13 @@
|
|||
/*
|
||||
This file is part of FreeTube.
|
||||
|
||||
FreeTube is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
FreeTube is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with FreeTube. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
@ -44,9 +41,7 @@ function addToHistory(videoId) {
|
|||
* @return {Void}
|
||||
*/
|
||||
function removeFromHistory(videoId){
|
||||
const data = {
|
||||
videoId: videoId
|
||||
};
|
||||
const data = {videoId: videoId};
|
||||
historyDb.remove(data, {}, (err, numRemoved) => {});
|
||||
}
|
||||
|
||||
|
@ -70,7 +65,8 @@ function showHistory(){
|
|||
for (let i = 0; i < 49; i++) {
|
||||
videoList = videoList + ',' + docs[i]['videoId'];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else{
|
||||
docs.forEach((video) => {
|
||||
videoList = videoList + ',' + video['videoId'];
|
||||
});
|
||||
|
@ -91,4 +87,5 @@ function showHistory(){
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -17,19 +17,17 @@
|
|||
|
||||
|
||||
|
||||
import {
|
||||
comment
|
||||
} from "./comment.model";
|
||||
import {comment} from "./comment.model";
|
||||
|
||||
/**
|
||||
* Entire Comment Threads for a Video
|
||||
*/
|
||||
export class commentThread {
|
||||
videoId;
|
||||
nextPageToken;
|
||||
pageInfo = {
|
||||
totalResults,
|
||||
resultsPerPage
|
||||
videoId: ?string;
|
||||
nextPageToken: ?string;
|
||||
pageInfo: {
|
||||
totalResults: number,
|
||||
resultsPerPage: number
|
||||
};
|
||||
items;
|
||||
items: comment[];
|
||||
}
|
|
@ -127,6 +127,9 @@ function playVideo(videoId) {
|
|||
if (typeof(info.player_response.captions.playerCaptionsTracklistRenderer.captionTracks) === 'object') {
|
||||
const videoSubtitles = info.player_response.captions.playerCaptionsTracklistRenderer.captionTracks;
|
||||
|
||||
videoSubtitles.forEach((subtitle) => {
|
||||
let subtitleUrl = 'https://www.youtube.com/api/timedtext?lang=' + subtitle.languageCode + '&fmt=vtt&name=&v=' + videoId;
|
||||
|
||||
if (subtitle.kind == 'asr') {
|
||||
//subtitleUrl = subtitle.baseUrl;
|
||||
return;
|
||||
|
@ -137,16 +140,11 @@ function playVideo(videoId) {
|
|||
}
|
||||
}
|
||||
|
||||
//videoHtml = videoHtml + '</video>';
|
||||
}
|
||||
|
||||
playerView.subtitleHtml = videoHtml;
|
||||
}
|
||||
|
||||
const checkSubscription = isSubscribed(playerView.channelId);
|
||||
|
||||
checkSubscription.then((results) => {
|
||||
const subscribeButton = document.getElementById('subscribeButton');
|
||||
const checkSubscription = isSubscribed(playerView.channelId);
|
||||
|
||||
checkSubscription.then((results) => {
|
||||
if (results === false) {
|
||||
|
@ -181,10 +179,7 @@ function playVideo(videoId) {
|
|||
});
|
||||
}
|
||||
|
||||
window.setTimeout(checkVideoUrls, 5000, video480p, video720p);
|
||||
|
||||
window.setTimeout(checkVideoUrls, 5000, playerView.video480p, playerView.video720p);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -225,6 +220,7 @@ function openMiniPlayer() {
|
|||
videoThumbnail: playerView.thumbnail,
|
||||
startTime: lastTime,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -152,4 +152,5 @@ function showSavedVideos(){
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,16 +1,13 @@
|
|||
/*
|
||||
This file is part of FreeTube.
|
||||
|
||||
FreeTube is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
FreeTube is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with FreeTube. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
@ -81,12 +78,10 @@ function checkDefaultSettings() {
|
|||
'useTor': false
|
||||
};
|
||||
|
||||
ft.log('Default Settings: ', settingDefaults);
|
||||
console.log(settingDefaults);
|
||||
|
||||
for (let key in settingDefaults){
|
||||
settingsDb.find({
|
||||
_id: key
|
||||
}, (err, docs) => {
|
||||
settingsDb.find({_id: key}, (err, docs) => {
|
||||
if (jQuery.isEmptyObject(docs)) {
|
||||
newSetting = {
|
||||
_id: key,
|
||||
|
@ -134,15 +129,20 @@ function updateSettings() {
|
|||
let key = document.getElementById('api-key').value;
|
||||
let theme = 'light';
|
||||
|
||||
if (apiKeyBank.indexOf(key) == -1 && key !== '') {
|
||||
settingsView.apiKey = key;
|
||||
}
|
||||
else{
|
||||
settingsView.apiKey = apiKeyBank[Math.floor(Math.random() * apiKeyBank.length)];
|
||||
}
|
||||
|
||||
ft.log('(Is the theme switch checked) themeSwitch: ', themeSwitch);
|
||||
console.log(themeSwitch);
|
||||
|
||||
if (themeSwitch === true) {
|
||||
theme = 'dark';
|
||||
}
|
||||
|
||||
ft.log('Theme: ', theme);
|
||||
console.log(theme);
|
||||
|
||||
// Update default theme
|
||||
settingsDb.update({
|
||||
|
@ -165,38 +165,12 @@ function updateSettings() {
|
|||
useTor = torSwitch;
|
||||
});
|
||||
|
||||
if (key !== '') {
|
||||
settingsDb.update({
|
||||
_id: 'theme'
|
||||
}, {
|
||||
value: theme
|
||||
}, {}, function (err, numReplaced) {
|
||||
ft.log('Error while updating theme: ', err);
|
||||
ft.log('Number replaced: ', numReplaced);
|
||||
});
|
||||
|
||||
// Update tor usage.
|
||||
settingsDb.update({
|
||||
_id: 'useTor'
|
||||
}, {
|
||||
value: settingsView.apiKey
|
||||
}, {});
|
||||
}
|
||||
|
||||
if (key != '') {
|
||||
settingsDb.update({
|
||||
_id: 'apiKey'
|
||||
}, {
|
||||
value: key
|
||||
}, {});
|
||||
} else {
|
||||
// To any third party devs that fork the project, please be ethical and change the API key.
|
||||
settingsDb.update({
|
||||
_id: 'apiKey'
|
||||
}, {
|
||||
value: apiKey
|
||||
value: settingsView.apiKey
|
||||
}, {});
|
||||
}
|
||||
|
||||
showToast('Settings have been saved.');
|
||||
}
|
||||
|
@ -293,19 +267,18 @@ function importSubscriptions() {
|
|||
// Open user's file browser. Only show .db files.
|
||||
dialog.showOpenDialog({
|
||||
properties: ['openFile'],
|
||||
filters: [{
|
||||
name: 'Database File',
|
||||
extensions: ['*']
|
||||
}, ]
|
||||
filters: [
|
||||
{name: 'Database File', extensions: ['*']},
|
||||
]
|
||||
}, function(fileLocation){
|
||||
if(typeof(fileLocation) === 'undefined'){
|
||||
ft.log('Import Aborted');
|
||||
console.log('Import Aborted');
|
||||
return;
|
||||
}
|
||||
ft.log('File Location: ', fileLocation);
|
||||
console.log(fileLocation);
|
||||
let i = fileLocation[0].lastIndexOf('.');
|
||||
let fileType = (i < 0) ? '' : fileLocation[0].substr(i);
|
||||
ft.log('File Type: ', fileType);
|
||||
console.log(fileType);
|
||||
|
||||
fs.readFile(fileLocation[0], function(readErr, data){
|
||||
if(readErr){
|
||||
|
@ -321,7 +294,8 @@ function importSubscriptions() {
|
|||
}
|
||||
});
|
||||
return;
|
||||
} else if (fileType !== '.db') {
|
||||
}
|
||||
else if (fileType !== '.db'){
|
||||
showToast('Incorrect file type. Import unsuccessful.');
|
||||
return;
|
||||
}
|
||||
|
@ -371,9 +345,9 @@ function exportSubscriptions() {
|
|||
extensions: ['db']
|
||||
}, ]
|
||||
}, function(fileLocation) {
|
||||
ft.log('File Location: ', fileLocation);
|
||||
console.log(fileLocation);
|
||||
if (typeof(fileLocation) === 'undefined') {
|
||||
ft.log('Export Aborted');
|
||||
console.log('Export Aborted');
|
||||
return;
|
||||
}
|
||||
fs.readFile(appDatabaseFile, function(readErr, data) {
|
||||
|
@ -396,7 +370,7 @@ function exportSubscriptions() {
|
|||
* @param {string} type - The type of file to be cleared.
|
||||
*/
|
||||
function clearFile(type, showMessage = true){
|
||||
ft.log('File Type: ', type);
|
||||
console.log(type);
|
||||
let dataBaseFile;
|
||||
|
||||
switch (type) {
|
||||
|
@ -420,4 +394,10 @@ function clearFile(type, showMessage = true) {
|
|||
throw err;
|
||||
}
|
||||
|
||||
if (showMessage){
|
||||
showToast('File has been cleared. Restart FreeTube to see the changes');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
checkDefaultSettings();
|
||||
|
|
|
@ -112,14 +112,6 @@ function loadSubscriptions() {
|
|||
maxResults: 15,
|
||||
order: 'date',
|
||||
}, (data) => {
|
||||
|
||||
youtubeAPI('search', {
|
||||
part: 'snippet',
|
||||
channelId: channelId,
|
||||
type: 'video',
|
||||
maxResults: 15,
|
||||
order: 'date',
|
||||
}, (data) => {
|
||||
console.log(data);
|
||||
videoList = videoList.concat(data.items);
|
||||
counter++;
|
||||
|
@ -151,13 +143,9 @@ function loadSubscriptions() {
|
|||
let finishedList = [];
|
||||
let firstBatchDuration = getDuration(videoList.slice(0, 49));
|
||||
|
||||
grabDuration.then((list) => {
|
||||
list.items.forEach((video) => {
|
||||
displayVideo(video);
|
||||
});
|
||||
stopLoadingAnimation();
|
||||
});
|
||||
} else {
|
||||
firstBatchDuration.then((list1) => {
|
||||
finishedList = finishedList.concat(list1.items);
|
||||
let secondBatchDuration = getDuration(videoList.slice(50, 99));
|
||||
|
||||
secondBatchDuration.then((list2) => {
|
||||
finishedList = finishedList.concat(list2.items);
|
||||
|
@ -177,6 +165,8 @@ function loadSubscriptions() {
|
|||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
|
|
@ -180,6 +180,11 @@ let popularView = new Vue({
|
|||
},
|
||||
toggleSave: (videoId) => {
|
||||
addSavedVideo(videoId);
|
||||
},
|
||||
copy: (site, videoId) => {
|
||||
const url = 'https://' + site + '/watch?v=' + videoId;
|
||||
clipboard.writeText(url);
|
||||
showToast('URL has been copied to the clipboard');
|
||||
}
|
||||
},
|
||||
template: videoListTemplate
|
||||
|
|
|
@ -220,7 +220,6 @@ function displayChannels(channels) {
|
|||
}, function (data) {
|
||||
ft.log('Channel Data: ', data);
|
||||
let items = data['items'].reverse();
|
||||
const videoListTemplate = require('./templates/channelList.html');
|
||||
|
||||
ft.log('Channel Items: ', items);
|
||||
|
||||
|
@ -240,6 +239,7 @@ function displayChannels(channels) {
|
|||
|
||||
searchView.videoList = searchView.videoList.concat(channelData);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function displayPlaylists(playlists) {
|
||||
|
@ -343,6 +343,7 @@ function showVideoRecommendations(videoId) {
|
|||
playerView.recommendedVideoList = playerView.recommendedVideoList.concat(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -404,7 +405,7 @@ function parseSearchText(url = '') {
|
|||
* @return {string} - The formated string. Ex: 12:34:56
|
||||
*/
|
||||
function parseVideoDuration(durationString) {
|
||||
let match = durationString.match(/PT(\d+H)?(\d+M)?(\d+S)?/);
|
||||
let match = durationString.match(/P.*T(\d+H)?(\d+M)?(\d+S)?/);
|
||||
let duration = '';
|
||||
|
||||
match = match.slice(1).map(function (x) {
|
||||
|
|
Loading…
Reference in New Issue