[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;
|
||||
Reference in New Issue
Block a user