Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f21182c authored by Raj Khemani's avatar Raj Khemani
Browse files

Merge branch '38-allow-local-zip-files' into 'main'

Add support for local zip files

Closes #38

See merge request e/devices/eos-installer!63
parents 269c0263 607e31da
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -31,6 +31,18 @@ Install /e/OS on a device from a chromium-based browser.
    ```
3. The app is available at http://localhost:3000

## Local ZIP mode (debug)

To test installation from a local ZIP file instead of direct download:

1. Open the installer with `debug=1`, for example: `http://localhost:3000/?debug=1`
2. Continue until the **Downloading /e/OS** step
3. Choose one of:
   - **Download build**: default online flow
   - **Use local ZIP**: pick a local `.zip` file

Without `debug=1`, the installer keeps the default auto-download behavior.

## Acknowledgments

Using:
+18 −4
Original line number Diff line number Diff line
@@ -376,11 +376,25 @@
          ></p>
        </div>
      </div>
      <div id="downloading" class="card inactive">
      <div id="downloading" class="card inactive flashing">
        <div class="card-header" data-translate="download-eos"></div>
        <div class="card-body">
          <p data-translate="this-might-take-some-time-please-be-patient"></p>
          <div class="text-center large-padding">
          <div class="download-actions text-center">
            <div class="download-buttons">
              <button class="next download-build-button">
                Download build
                <span class="btn-loader"></span>
              </button>
              <button class="next use-local-zip-button">
                Use local ZIP
                <span class="btn-loader"></span>
              </button>
            </div>
            <input class="local-zip-input" type="file" accept=".zip" hidden />
            <p class="local-zip-error" style="display: none; color: red"></p>
          </div>
          <div class="download-progress-area text-center large-padding">
            <p class="downloading-progress"></p>
            <progress class="downloading-progress-bar" max="100"></progress>
            <p
@@ -658,7 +672,7 @@
        <div class="card-header" data-translate="installing"></div>
        <div class="card-body">
          <p data-translate="this-might-take-some-time-please-be-patient"></p>
          <div class="text-center large-padding">
          <div class="install-progress-area text-center large-padding">
            <p class="installing-progress"></p>
            <progress class="installing-progress-bar" max="100"></progress>
          </div>
@@ -740,7 +754,7 @@
        <div class="card-header" data-translate="sideload"></div>
        <div class="card-body">
          <p data-translate="this-might-take-some-time-please-be-patient"></p>
          <div class="text-center large-padding">
          <div class="install-progress-area text-center large-padding">
            <p class="installing-progress"></p>
            <progress class="installing-progress-bar" max="100"></progress>
          </div>
+2 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ button.next:disabled {
  top: 0;
  position: fixed;
  width: 100%;
  z-index: 1200;
}
#top-banner {
  background: var(--top-banner-color);
@@ -113,7 +114,7 @@ button.next:disabled {
/* <header> */
/* <card> */
.card {
  scroll-margin-top: 65px;
  scroll-margin-top: 140px;
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
+15 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ export class Controller {
      new Step("device-detection", "connect adb", true),
    ];
    this.currentIndex = 0;
    this.downloadChoiceEnabled = false;
  }

  async init(view) {
@@ -26,6 +27,10 @@ export class Controller {
    this.view = view;
  }

  setDownloadChoiceEnabled(enabled) {
    this.downloadChoiceEnabled = enabled;
  }

  async next() {
    let current = this.steps[this.currentIndex];
    let next = this.steps[this.currentIndex + 1];
@@ -413,7 +418,8 @@ export class Controller {
  setResources(resources) {
    this.resources = resources;
    if (this.resources.steps) {
      this.steps.push(new Step("downloading", "download", false));
      const needsUserGesture = this.downloadChoiceEnabled;
      this.steps.push(new Step("downloading", "download", needsUserGesture));
      this.steps.push(
        ...this.resources.steps.map((step) => {
          return new Step(
@@ -428,4 +434,12 @@ export class Controller {
    }
    this.deviceManager.setResources(this.resources.folder, this.steps);
  }

  setLocalZip(file) {
    this.deviceManager.setLocalZipFile(file);
  }

  clearLocalZip() {
    this.deviceManager.clearLocalZipFile();
  }
}
+29 −7
Original line number Diff line number Diff line
@@ -27,6 +27,18 @@ export class DeviceManager {
    this.wasConnected = false;
  }

  setLocalZipFile(file) {
    this.downloader.setLocalZip(file);
  }

  clearLocalZipFile() {
    this.downloader.clearLocalZip();
  }

  hasLocalZipFile() {
    return this.downloader.hasLocalZip();
  }

  async init() {
    await this.bootloader.init();
    await this.adb.init();
@@ -187,6 +199,15 @@ export class DeviceManager {

  async downloadAll(onProgress, onUnzip, onVerify) {
    try {
      if (this.downloader.hasLocalZip()) {
        await this.downloader.ingestLocalZip(
          this.files,
          this.folder,
          onProgress,
          onUnzip,
          onVerify,
        );
      } else {
        await this.downloader.downloadAndUnzipFolder(
          this.files,
          this.folder,
@@ -194,6 +215,7 @@ export class DeviceManager {
          onUnzip,
          onVerify,
        );
      }
    } catch (e) {
      throw new Error(`downloadAll error ${e.message || e}`);
    }
Loading