[flashplayer] update download link
This commit is contained in:
@@ -8,65 +8,46 @@ const exec = require('./exec');
|
||||
const PluginError = require('plugin-error');
|
||||
const colors = require('ansi-colors');
|
||||
const log = require('fancy-log');
|
||||
const tar = require('tar');
|
||||
const Vinyl = require('vinyl');
|
||||
|
||||
|
||||
class FlashPlayer extends Sdk {
|
||||
|
||||
constructor(version) {
|
||||
constructor(debug, version) {
|
||||
super(FlashPlayer.ID, version || FlashPlayer.VERSION);
|
||||
}
|
||||
|
||||
playerPath(debug) {
|
||||
return this.path;
|
||||
this.debug = debug;
|
||||
}
|
||||
|
||||
prepare() {
|
||||
let p = super.prepare();
|
||||
if (!this.prepared && os.type() === 'Linux') {
|
||||
p = p.then(() => {
|
||||
let arch = null;
|
||||
if (os.arch() === 'ia32') { arch = 'i386'}
|
||||
if (os.arch() === 'x64') { arch = 'x86_64'}
|
||||
|
||||
const extract = (debug) => {
|
||||
const v = this.version.split('.');
|
||||
const playerPath = this.playerPath(debug);
|
||||
const archive = `${playerPath}/flashplayer${v[0]}_${v[1]}r${v[2]}_${v[3]}_linux_sa${debug ? '_debug' : ''}.${arch}.tar.gz`;
|
||||
return fs.createReadStream(archive).pipe(tar.x({C: this.path}));
|
||||
};
|
||||
|
||||
// ToDo:
|
||||
return new Promise((success, fail) => {
|
||||
extract().on('end', () => {
|
||||
extract(true).on('end', success).on('error', fail)
|
||||
}).on('error', fail);
|
||||
})
|
||||
})
|
||||
}
|
||||
return p;
|
||||
return super.prepare(0)
|
||||
}
|
||||
|
||||
get prepared() {
|
||||
try {
|
||||
return fs.existsSync(`${this.flashPlayerBin()}`);
|
||||
return fs.existsSync(this.flashPlayerBin);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
get link() {
|
||||
return `https://fpdownload.macromedia.com/pub/flashplayer/installers/archive/fp_${this.version}_archive.zip`;
|
||||
const baseUrl = `https://fpdownload.macromedia.com/pub/flashplayer/updaters/${this.version}/`;
|
||||
if (Sdk.System.isWindows) {
|
||||
return baseUrl + `flashplayer_${this.version}_sa${this.debug ? '_debug' : ''}.exe`;
|
||||
} else if (Sdk.System.isLinux) {
|
||||
return baseUrl + `flash_player_sa_linux${this.debug ? '_debug' : ''}.x86_64.tar.gz`;
|
||||
} else {
|
||||
throw `Unsupported os '${os.type()}'`;
|
||||
}
|
||||
}
|
||||
|
||||
flashPlayerBin(debug) {
|
||||
get flashPlayerBin() {
|
||||
if (os.type() === 'Windows_NT') {
|
||||
const v = this.version.split('.');
|
||||
const playerName = `flashplayer${v[0]}_${v[1]}r${v[2]}_${v[3]}_win_sa${debug ? '_debug' : ''}.exe`;
|
||||
return `${this.playerPath(debug)}/${playerName}`;
|
||||
const playerName = `flashplayer_${this.version}_sa${this.debug ? '_debug' : ''}.exe`;
|
||||
return path.join(this.path, playerName);
|
||||
} else if (os.type() === 'Linux') {
|
||||
const binPath = `${this.playerPath(debug)}/${debug ? 'flashplayerdebugger': 'flashplayer'}`;
|
||||
const binPath = path.join(this.path, `flashplayer${this.debug ? 'debugger' : ''}`);
|
||||
fs.chmodSync(binPath, 0o755);
|
||||
return binPath;
|
||||
} else {
|
||||
@@ -76,18 +57,18 @@ class FlashPlayer extends Sdk {
|
||||
|
||||
static get flashPlayerDir() {
|
||||
if (os.type() === 'Windows_NT') {
|
||||
return `${process.env.APPDATA}/Macromedia/Flash Player`;
|
||||
return path.join(process.env.APPDATA, 'Macromedia', 'Flash Player');
|
||||
} else if (os.type() === 'Linux') {
|
||||
return `${os.homedir()}/.macromedia/Flash_Player`;
|
||||
return path.join(os.homedir(), '.macromedia', 'Flash_Player');
|
||||
}
|
||||
}
|
||||
|
||||
static get log() {
|
||||
return `${this.flashPlayerDir}/Logs/flashlog.txt`;
|
||||
return path.join(this.flashPlayerDir, 'Logs', 'flashlog.txt');
|
||||
}
|
||||
|
||||
static enableLog() {
|
||||
const filename = `${os.homedir()}/mm.cfg`;
|
||||
const filename = path.join(os.homedir(), 'mm.cfg');
|
||||
const value = 'TraceOutputFileEnable=1';
|
||||
if (fs.exists(filename)) {
|
||||
const data = fs.readFileSync(filename);
|
||||
@@ -100,7 +81,7 @@ class FlashPlayer extends Sdk {
|
||||
}
|
||||
|
||||
static trust(value) {
|
||||
const filename = `${this.flashPlayerDir}/#Security/FlashPlayerTrust/gulp.cfg`;
|
||||
const filename = path.join(this.flashPlayerDir, '#Security', 'FlashPlayerTrust', 'gulp.cfg');
|
||||
if (fs.exists(filename)) {
|
||||
const data = fs.readFileSync(filename);
|
||||
if (data.indexOf(value) === -1) {
|
||||
@@ -114,13 +95,13 @@ class FlashPlayer extends Sdk {
|
||||
}
|
||||
}
|
||||
|
||||
run(debug) {
|
||||
run() {
|
||||
let stream = null;
|
||||
const bufferContents = (file, enc, callback) => {
|
||||
log(this.tag, colors.cyan("run"), colors.magenta(file.path));
|
||||
FlashPlayer.trust(file.path);
|
||||
FlashPlayer.enableLog();
|
||||
exec('.', [this.flashPlayerBin(debug), file.path].join(' ')).then(() => {
|
||||
exec('.', [this.flashPlayerBin, file.path].join(' ')).then(() => {
|
||||
stream.emit('end');
|
||||
callback();
|
||||
}).catch((error) => {
|
||||
@@ -140,29 +121,14 @@ class FlashPlayer extends Sdk {
|
||||
}
|
||||
}
|
||||
|
||||
FlashPlayer.ID = "flashplayer";
|
||||
FlashPlayer.ID = 'flashplayer';
|
||||
|
||||
FlashPlayer.VERSION_11_2_202_644 = '11.2.202.644';
|
||||
FlashPlayer.VERSION_11 = FlashPlayer.VERSION_11_2_202_644;
|
||||
FlashPlayer.VERSION_24 = '24';
|
||||
FlashPlayer.VERSION_25 = '25';
|
||||
FlashPlayer.VERSION_26 = '26';
|
||||
FlashPlayer.VERSION_27 = '27';
|
||||
FlashPlayer.VERSION_29 = '29';
|
||||
|
||||
FlashPlayer.VERSION_24_0_0_186 = '24.0.0.186';
|
||||
FlashPlayer.VERSION_24_0_0_194 = '24.0.0.194';
|
||||
FlashPlayer.VERSION_24_0_0_221 = '24.0.0.221';
|
||||
FlashPlayer.VERSION_24 = FlashPlayer.VERSION_24_0_0_221;
|
||||
|
||||
FlashPlayer.VERSION_25_0_0_127 = '25.0.0.127';
|
||||
FlashPlayer.VERSION_25_0_0_148 = '25.0.0.148';
|
||||
FlashPlayer.VERSION_25_0_0_163 = '25.0.0.163';
|
||||
FlashPlayer.VERSION_25_0_0_117 = '25.0.0.171';
|
||||
FlashPlayer.VERSION_25 = FlashPlayer.VERSION_25_0_0_117;
|
||||
|
||||
FlashPlayer.VERSION_26_0_0_131 = '26.0.0.131';
|
||||
FlashPlayer.VERSION_26 = FlashPlayer.VERSION_26_0_0_131;
|
||||
|
||||
if (os.type() === 'Linux' && os.arch() === 'ia32') { //Linux i386
|
||||
FlashPlayer.VERSION = FlashPlayer.VERSION_11;
|
||||
} else {
|
||||
FlashPlayer.VERSION = FlashPlayer.VERSION_26;
|
||||
}
|
||||
FlashPlayer.VERSION = FlashPlayer.VERSION_29;
|
||||
|
||||
module.exports = FlashPlayer;
|
||||
@@ -58,11 +58,9 @@ class Haxe extends Sdk {
|
||||
process.env.HAXE_VERSION = this.version;
|
||||
process.env.HAXE_STD_PATH = path.join(this.binPath, 'std');
|
||||
process.env.HAXE_HOME = this.binPath;
|
||||
console.log('process.env.PATH A', process.env.PATH);
|
||||
if (process.env.PATH.split(path.delimiter).indexOf(this.binPath) === -1) {
|
||||
process.env.PATH = [process.env.PATH, this.binPath].join(path.delimiter);
|
||||
}
|
||||
console.log('process.env.PATH B', process.env.PATH);
|
||||
}
|
||||
|
||||
prepare() {
|
||||
|
||||
@@ -3,10 +3,6 @@ const path = require('path');
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const fse = require('fs-extra');
|
||||
//const concat = require('gulp-concat');
|
||||
//const uglify = require('gulp-uglify');
|
||||
//const babel = require('gulp-babel');
|
||||
//const template = require('gulp-template');
|
||||
const Haxe = require('./haxe');
|
||||
const FlashPlayer = require('./flashplayer');
|
||||
const debug = require('./debug');
|
||||
@@ -19,6 +15,8 @@ const vfs = require('vinyl-fs');
|
||||
const rename = require('gulp-rename');
|
||||
const template = require('lodash.template');
|
||||
const mkdirp = require('mkdirp');
|
||||
const through = require('through2');
|
||||
const Vinyl = require('vinyl');
|
||||
|
||||
|
||||
const streamToPromise = (stream) => {
|
||||
@@ -217,7 +215,7 @@ class Runner extends Target {
|
||||
}
|
||||
|
||||
log(stream) {
|
||||
stream
|
||||
return stream
|
||||
.pipe(tail(debug.log))
|
||||
.pipe(rename('out.log'))
|
||||
.pipe(gulp.dest(this.targetPath));
|
||||
@@ -241,7 +239,7 @@ class FlashRunner extends Runner {
|
||||
|
||||
constructor(config, debug) {
|
||||
super(config, Platform.FLASH, debug);
|
||||
this.player = new FlashPlayer();
|
||||
this.player = new FlashPlayer(debug);
|
||||
}
|
||||
|
||||
prepare() {
|
||||
@@ -251,11 +249,16 @@ class FlashRunner extends Runner {
|
||||
call() {
|
||||
const target = this.targetPath;
|
||||
const filename = path.resolve(target, this.config.meta.filename+'.swf');
|
||||
const player = this.player.flashPlayerBin(this.debug);
|
||||
const player = this.player.flashPlayerBin;
|
||||
FlashPlayer.trust(filename);
|
||||
fs.writeFileSync(FlashPlayer.log, '');
|
||||
const result = gulp.src(filename).pipe(run(player + " <%=file.basename%>", {cwd: target}));
|
||||
return this.log(gulp.src(FlashPlayer.log));
|
||||
let result = gulp.src(filename)
|
||||
.pipe(run(player + " <%=file.basename%>", {cwd: target, verbosity: 0}))
|
||||
.pipe(through.obj(function (file, enc, callback) {
|
||||
this.push(new Vinyl({path: FlashPlayer.log}));
|
||||
callback();
|
||||
}));
|
||||
return this.log(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +297,7 @@ class LinuxRunner extends Runner {
|
||||
call() {
|
||||
const target = this.targetPath;
|
||||
const filename = path.resolve(target, this.config.meta.filename);
|
||||
const result = gulp.src(filename).pipe(run("./<%=file.basename%>", {cwd: target}));
|
||||
const result = gulp.src(filename).pipe(run("./<%=file.basename%>", {cwd: target, verbosity: 0}));
|
||||
return this.log(result);
|
||||
}
|
||||
}
|
||||
@@ -327,29 +330,27 @@ Runner.register(Platform.NEKO, NekoRunner);
|
||||
*/
|
||||
class Project {
|
||||
|
||||
constructor(buildSystem, platforms, config) {
|
||||
constructor(buildSystem, platforms, config, prepare) {
|
||||
this.buildSystem = buildSystem;
|
||||
this.platforms = Array.isArray(platforms) ? platforms : [platforms];
|
||||
this.config = config;
|
||||
this.prepare = prepare;
|
||||
}
|
||||
|
||||
build(platform) {
|
||||
const builder = Builder.new(this.config, platform, this.buildSystem, false);
|
||||
return [
|
||||
builder.prepare.bind(builder),
|
||||
builder.call.bind(builder),
|
||||
];
|
||||
build(platform, debug) {
|
||||
const builder = Builder.new(this.config, platform, this.buildSystem, debug);
|
||||
const tasks = [builder.prepare.bind(builder)];
|
||||
if (this.prepare) tasks.push(this.prepare);
|
||||
tasks.push(builder.call.bind(builder));
|
||||
return tasks;
|
||||
}
|
||||
|
||||
run(platform) {
|
||||
const builder = Builder.new(this.config, platform, this.buildSystem, debug);
|
||||
const runner = Runner.new(this.config, platform, debug);
|
||||
return [
|
||||
builder.prepare.bind(builder),
|
||||
builder.call.bind(builder),
|
||||
return this.build(platform, debug).concat([
|
||||
runner.prepare.bind(runner),
|
||||
runner.call.bind(runner),
|
||||
];
|
||||
]);
|
||||
}
|
||||
|
||||
pack(platform) {
|
||||
|
||||
@@ -75,7 +75,7 @@ class Sdk {
|
||||
throw "Not implemented";
|
||||
}
|
||||
|
||||
prepare() {
|
||||
prepare(strip=1) {
|
||||
log(this.tag, `version: ${colors.magenta(this.version)}`);
|
||||
|
||||
if (this.prepared) {
|
||||
@@ -99,7 +99,7 @@ class Sdk {
|
||||
}
|
||||
});
|
||||
} else if (this.link.endsWith('tar.gz')) {
|
||||
stream = stream.pipe(tar.x({C: this.path, strip: 1}));
|
||||
stream = stream.pipe(tar.x({C: this.path, strip: strip}));
|
||||
} else {
|
||||
stream = stream.pipe(fs.createWriteStream(this.path));
|
||||
}
|
||||
|
||||
@@ -38,8 +38,9 @@ module.exports = (handler) => {
|
||||
file.contents.pipe(new StringWritable(handler));
|
||||
} else {
|
||||
const tail = new Tail(file.path);
|
||||
tail.on("line", data => handler(data));
|
||||
tail.on("error", error => handler('[ERROR]: ', error));
|
||||
tail.on('line', data => handler(data));
|
||||
tail.on('error', error => handler('[ERROR]: ', error));
|
||||
this.on('end', () => tail.unwatch());
|
||||
}
|
||||
this.push(file);
|
||||
callback();
|
||||
|
||||
Reference in New Issue
Block a user