mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
add p2p support for HLS https://github.com/Novage/p2p-media-loader
This commit is contained in:
parent
64c36d9f4e
commit
0d0338876d
1197 changed files with 121461 additions and 179724 deletions
69
node_modules/videojs-font/lib/grunt.js
generated
vendored
69
node_modules/videojs-font/lib/grunt.js
generated
vendored
|
@ -1,11 +1,11 @@
|
|||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var _ = require('lodash');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const sass = require('node-sass');
|
||||
|
||||
let iconsIndex = [];
|
||||
|
||||
// Merge a `source` object to a `target` recursively
|
||||
function merge(target, source) {
|
||||
const merge = (target, source) => {
|
||||
// Check if font name is changed
|
||||
if (source['font-name']) {
|
||||
target['font-name'] = source['font-name'];
|
||||
|
@ -39,6 +39,9 @@ function merge(target, source) {
|
|||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
sass: {
|
||||
options: {
|
||||
implementation: sass
|
||||
},
|
||||
dist: {
|
||||
files: {
|
||||
'css/videojs-icons.css': 'scss/videojs-icons.scss'
|
||||
|
@ -54,33 +57,31 @@ module.exports = function(grunt) {
|
|||
});
|
||||
|
||||
grunt.registerTask('generate-font', function() {
|
||||
var done = this.async();
|
||||
|
||||
const done = this.async();
|
||||
let webfontsGenerator = require('webfonts-generator');
|
||||
let iconConfig = grunt.file.readJSON(path.join(__dirname, '..', 'icons.json'));
|
||||
|
||||
let svgRootDir = iconConfig['root-dir'];
|
||||
|
||||
if (grunt.option('exclude-default')) {
|
||||
// Exclude default video.js icons
|
||||
iconConfig.icons = [];
|
||||
}
|
||||
|
||||
let icons = iconConfig.icons;
|
||||
|
||||
// Index default icons
|
||||
for (let i = 0; i < icons.length; i++) {
|
||||
iconsIndex.push(icons[i].name);
|
||||
}
|
||||
icons.forEach(icon => iconsIndex.push(icon.name));
|
||||
|
||||
// Merge custom icons
|
||||
const paths = (grunt.option('custom-json') || '').split(',').filter(Boolean);
|
||||
for (let i = 0; i < paths.length; i++) {
|
||||
let customConfig = grunt.file.readJSON(path.resolve(process.cwd(), paths[i]));
|
||||
const customPaths = (grunt.option('custom-json') || '').split(',').filter(Boolean);
|
||||
customPaths.forEach(customPath => {
|
||||
const customConfig = grunt.file.readJSON(path.resolve(process.cwd(), customPath));
|
||||
iconConfig = merge(iconConfig, customConfig);
|
||||
}
|
||||
});
|
||||
|
||||
icons = iconConfig.icons;
|
||||
|
||||
let iconFiles = icons.map(function(icon) {
|
||||
let iconFiles = icons.map(icon => {
|
||||
// If root-dir is specified for a specific icon, use that.
|
||||
if (icon['root-dir']) {
|
||||
return icon['root-dir'] + icon.svg;
|
||||
|
@ -99,19 +100,14 @@ module.exports = function(grunt) {
|
|||
htmlDest: 'index.html',
|
||||
htmlTemplate: './templates/html.hbs',
|
||||
html: true,
|
||||
rename: function(iconPath) {
|
||||
let fileName = path.basename(iconPath);
|
||||
|
||||
let iconName = _.result(_.find(icons, function(icon) {
|
||||
let svgName = path.basename(icon.svg);
|
||||
|
||||
return svgName === fileName;
|
||||
}), 'name');
|
||||
rename: iconPath => {
|
||||
const fileName = path.basename(iconPath);
|
||||
const iconName = icons.find(icon => path.basename(icon.svg) === fileName).name;
|
||||
|
||||
return iconName;
|
||||
},
|
||||
types: ['svg', 'woff', 'ttf']
|
||||
}, function(error) {
|
||||
}, error => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
done(false);
|
||||
|
@ -119,29 +115,24 @@ module.exports = function(grunt) {
|
|||
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
grunt.registerTask('update-base64', function() {
|
||||
let iconScssFile = './scss/_icons.scss';
|
||||
let iconConfig;
|
||||
if (grunt.option('custom-json')) {
|
||||
iconConfig = grunt.file.readJSON(path.resolve(process.cwd(), grunt.option('custom-json')));
|
||||
} else {
|
||||
iconConfig = grunt.file.readJSON(path.join(__dirname, '..', 'icons.json'));
|
||||
}
|
||||
let fontName = iconConfig['font-name'];
|
||||
let fontFiles = {
|
||||
const iconScssFile = './scss/_icons.scss';
|
||||
const iconConfig = grunt.option('custom-json') ?
|
||||
grunt.file.readJSON(path.resolve(process.cwd(), grunt.option('custom-json'))) :
|
||||
grunt.file.readJSON(path.join(__dirname, '..', 'icons.json'));
|
||||
const fontName = iconConfig['font-name'];
|
||||
const fontFiles = {
|
||||
woff: './fonts/' + fontName + '.woff'
|
||||
};
|
||||
|
||||
let scssContents = fs.readFileSync(iconScssFile).toString();
|
||||
|
||||
Object.keys(fontFiles).forEach(function(font) {
|
||||
let fontFile = fontFiles[font];
|
||||
let fontContent = fs.readFileSync(fontFile);
|
||||
|
||||
let regex = new RegExp(`(url.*font-${font}.*base64,)([^\\s]+)(\\).*)`);
|
||||
Object.keys(fontFiles).forEach(font => {
|
||||
const fontFile = fontFiles[font];
|
||||
const fontContent = fs.readFileSync(fontFile);
|
||||
const regex = new RegExp(`(url.*font-${font}.*base64,)([^\\s]+)(\\).*)`);
|
||||
|
||||
scssContents = scssContents.replace(regex, `$1${fontContent.toString('base64')}$3`);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue