首页 > 解决方案 > linux/ubuntu 上的 chrome flash EOL

问题描述

对于在 EOL 之前无法迁移的站点或固件控制台,有多个博客介绍了如何在 EOL 后使闪存工作。

在这个程度上,我想在虚拟机(VirtualBox 6.1.6 上的 Ubuntu 20.4.1)中运行这个补丁,以确保我的实际机器是最新的并且完全打了补丁。但是我发现补丁在我的 MacOS 主机上有效,但在 Ubuntu VM 上无效。运行一次按钮从不出现,网页中的 flash 组件显示下载失败

为了消除拼写错误的可能性 - 我使用 YaML 配置文件在 python 中进行了编码。 为什么这在 Ubuntu 上的 google-chrome 中不起作用?

铬.py

import re, shutil, subprocess, yaml, click
from pathlib import Path
import platform

def cmd(cmd:str="ls -al", assertfail=True) :
    up = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
    str = [o.rstrip().decode() for o in up.stdout]
    exitcode = up.wait()
    if assertfail: assert exitcode == 0, f"[{exitcode}] {cmd} {str}"
    return exitcode,  str

@click.command()
@click.option("--uninstall", default=False, is_flag=True, help="uninstall google chrome")
def main(uninstall):
    click.secho(f"{platform.system()}")
    with open(Path.cwd().joinpath("chrome.yaml")) as f: config = yaml.safe_load(f)

    if platform.system()=="Linux":
        if uninstall:
            e, out = cmd("sudo apt-get purge -y google-chrome-stable")
            print(out)

        cdeb = Path.cwd().joinpath(f"chrome-{config['version']}.deb")
        # download required version of chrome if it has not already been downloaded
        if not cdeb.exists():
            e, out = cmd(f"wget --no-verbose -O {cdeb} http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_{config['version']}_amd64.deb")
            print(out)

        # check wanted version of chrome is installed
        e, iv = cmd("google-chrome --version", assertfail=False)
        iv = iv[0] if e==0 else "0.0.0.0"
        vre = re.compile("[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
        iv = re.search(vre, iv)[0]
        wv = re.search(vre, config["version"])[0]
        click.secho(f"installed: {iv} wanted: {wv} same: {iv==wv}",bg="cyan")
        if iv!=wv:
            e, out = cmd(f"sudo apt install -y {cdeb}")
            print(out)

        # make sure required locations of adobe config files exist
        p2 = Path.home().joinpath(".config/google-chrome/Default/Pepper Data/Shockwave Flash/System/")
    elif platform.system()=="Darwin":
        p2 = Path.home().joinpath("Library/Application Support/Google/Chrome/Default/Pepper Data/Shockwave Flash/System/")

    else:
        click.secho(f"unknow operating system {platform.system}")
        exit(1)
    if not p2.exists():
        p2.mkdir(parents=True)
    
    # build adobe flash config file
    mmsf = Path.cwd().joinpath("mms.cfg")
    with open(mmsf, "w") as f:
        for l in config["base"]: f.write(f"{l}\n")
        for u in config["urls"]:
            for l in [f"{k}={v}{u}\n" for p in config["urlkeys"] for k,v in p.items()]: f.write(l)

    # distribute adobe flash config file
    shutil.copy(mmsf, p2)
    click.secho(str(p2.joinpath("mms.cfg")), bg="blue", bold=True, reverse=True)
    with open(p2.joinpath("mms.cfg")) as f:
        click.secho(f.read(), bg="blue")

if __name__ == '__main__':
    main()    

铬.yaml

base:
  - EnableAllowList=1
  - EOLUninstallDisable=1
  - ErrorReportingEnable=1
  # - TraceOutputFileEnable=1
  # - PolicyFileLog=1
  - AllowListPreview=1
  - TraceOutputEcho=1
urls:
  - codegeek.net
  - ultrasounds.com
  - photobox.co.uk
  - secure.photobox.com
  - serving.photos.photobox.com
urlkeys:
  - AllowListUrlPattern: "*://*."
  - WhitelistUrlPattern: "*://*."
  - AllowListUrlPattern: "*://"
  - WhitelistUrlPattern: "*://"
 # https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable
 # 87 - last version  with flash bundled
version: 87.0.4280.141-1

标签: google-chromeubuntuflash

解决方案


推荐阅读