Merge branch 'master' into development

This commit is contained in:
Preston 2018-03-07 20:19:21 -05:00
commit c4b112435e
2 changed files with 37 additions and 35 deletions

View File

@ -1,6 +1,8 @@
# FreeTube
FreeTube is an Open Source Desktop YouTube player built with privacy in mind. Watch your favorite YouTube videos ad free as well as prevent Google from tracking what you watch. Available for Windows / Mac / Linux
Please note that FreeTube is currently in Beta and using the proprietary and obfuscated [Google API script](https://apis.google.com/js/api.js) (bundled as `src/js/googleApi.js`), which is planned to be ditched in the future. Video URLs are resolved using the [HookTube](https://hooktube.com/) HTTP API.
<a href='https://github.com/FreeTubeApp/FreeTube/releases' >Download</a>
## Screenshots
@ -11,11 +13,11 @@ FreeTube is an Open Source Desktop YouTube player built with privacy in mind. W
<img src="https://freetubeapp.github.io/images/FreeTube5.png" width=200 >
# How Does It Work?
FreeTube uses the YouTube API to search for videos. It then uses the HookTube API to grab the raw video files and play them in a basic HTML5 video player, preventing YouTube from tracking that video. Subscriptions, history, and saved videos are stored locally on the user's computer and is never sent out to Google or anyone else. You own your data.
FreeTube uses the YouTube API to search for videos. It then uses the HookTube API to grab the raw video files and play them in a basic HTML5 video player, preventing YouTube from tracking you using cookies or JavaScript. Subscriptions, history, and saved videos are stored locally on the user's computer and is never sent out to Google or anyone else. You own your data.
## Features
* Watch videos free of ads
* Prevent Google from tracking what you watch
* Prevent Google from tracking what you watch using cookies or JavaScript
* Subscribe to channels without an account
* Store subscriptions, history, and saved videos locally
* Import / Backup subscriptions

View File

@ -233,14 +233,14 @@ function setTheme(option) {
}
/**
* Import Subscriptions from an OPML file.
*
* @param {string} subFile - The file location of the OPML file.
*
* @return {Void}
*/
function importOpmlSubs(json) {
if (json[0]['folder'] !== 'YouTube Subscriptions') {
* Import Subscriptions from an OPML file.
*
* @param {string} subFile - The file location of the OPML file.
*
* @return {Void}
*/
function importOpmlSubs(json){
if(json[0]['folder'] !== 'YouTube Subscriptions'){
showToast('Invalid OPML File. Import is unsuccessful.');
return;
}
@ -256,22 +256,21 @@ function importOpmlSubs(json) {
}
/**
* Import a subscriptions file that the user provides.
*
* @return {Void}
*/
function importSubscriptions() {
* Import a subscriptions file that the user provides.
*
* @return {Void}
*/
function importSubscriptions(){
const appDatabaseFile = localDataStorage + '/subscriptions.db';
// Open user's file browser. Only show .db files.
dialog.showOpenDialog({
properties: ['openFile'],
filters: [{
name: 'Database File',
extensions: ['*']
}, ]
}, function(fileLocation) {
if (typeof(fileLocation) === 'undefined') {
filters: [
{name: 'Database File', extensions: ['*']},
]
}, function(fileLocation){
if(typeof(fileLocation) === 'undefined'){
console.log('Import Aborted');
return;
}
@ -285,29 +284,30 @@ function importSubscriptions() {
return;
}*/
fs.readFile(fileLocation[0], function(readErr, data) {
if (readErr) {
fs.readFile(fileLocation[0], function(readErr, data){
if(readErr){
showToast('Unable to read file. File may be corrupt or have invalid permissions.');
throw readErr;
}
if (data.includes("<opml")) {
getOpml(data, function(error, json) {
if (!error) {
if (data.includes("<opml")){
getOpml(data, function (error, json){
if (!error){
clearFile('subscriptions', false);
importOpmlSubs(json['children'][0]['children']);
}
});
return;
} else if (fileType !== '.db') {
}
else if (fileType !== '.db'){
showToast('Incorrect file type. Import unsuccessful.');
return;
}
clearFile('subscriptions', false);
fs.writeFile(appDatabaseFile, data, function(writeErr) {
if (writeErr) {
fs.writeFile(appDatabaseFile, data, function(writeErr){
if(writeErr){
showToast('Unable to create file. Please check your permissions and try again.');
throw writeErr;
}
@ -352,11 +352,11 @@ function exportSubscriptions() {
}
/**
* Clear out the data in a file.
*
* @param {string} type - The type of file to be cleared.
*/
function clearFile(type, showMessage = true) {
* Clear out the data in a file.
*
* @param {string} type - The type of file to be cleared.
*/
function clearFile(type, showMessage = true){
console.log(type);
let dataBaseFile;
@ -381,7 +381,7 @@ function clearFile(type, showMessage = true) {
throw err;
}
if (showMessage) {
if (showMessage){
showToast('File has been cleared. Restart FreeTube to see the changes');
}
})