Skip to content

[Existing Repo] Cloning repo takes a very long time #66

@lasersPew

Description

@lasersPew

I have tried running the project in my local machine, running cors-proxy before running npm run serve. It did come to select the repository and tried to clone it, but to no luck.

src/CorsProxy.js

export default class CorsProxy {
  static URL = "http://127.0.0.1:9999";
  static DEV_URL = "http://127.0.0.1:9999";

  static get(url, headers) {
    if (window.isElectron) {
      return fetch(url, {
        headers: headers,
      });
    }
    if (url.startsWith("https://")) {
      url = url.replace("https://", "");
    }
    return fetch(CorsProxy.getProxyUrl() + "/" + url, {
      headers: headers,
    });
  }

  static getProxyUrl() {
    if (window.isElectron) {
      return undefined;
    }
    if (process.env.NODE_ENV === "development") {
      return CorsProxy.DEV_URL;
    }
    return CorsProxy.URL;
  }

  static isAvailable() {
    if (window.isElectron || process.env.NODE_ENV !== "development") {
      return new Promise((resolve) => resolve(true));
    }
    return this.get("https://github.com/")
      .then(() => true)
      .catch(() => false);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions