1.4.0 Release (#45)
* customizations for chooser, coll-index and appmain to support usage in archiveweb.page - chooser: support panel/message view - move apiPrefix to misc - make coll-index extensible, overridable styles, filtering * api changes: make configurable in coll-index, now using '/w/' instead of '/wabac/', '/c/' prefix for coll apis * lint pass! * bulma: update to 0.9.2, fix delete spinner with latest bulma * ui fixes: - show 'Loading Archives...' on initial load until first api response succeeds - fix typo in oncontrollerchange not actually resolving the promise! * embed sandbox: add other allow options, except top-nav - first api load: keep loading message until first successful api load - don't reset hash on purge to keep current page - sw config: fix typo with latest wabac.js - embed: add 'noSandbox' option to avoid adding sandbox to iframe, needed to show PDFs, add more allow rules (all except top-navigation) * ui improvements: - refresh: ensure location refresh from hitting enter in location bar always resets url - pageentry doubleclick: ensure double-clicking on page in sidebar always triggers reload, even if current page - pageentry typo fix: fix missing var causing selection error (fixes webrecorder/archivewebpage#25) - lint: don't include 'event' as global - use latest wabac.js 2.7.0-beta.1 * add CHANGES for 1.4.0, add 'noSandbox' to embedding options - electron app: fix path to 'w/' - bump electron to 11.4.3 * docs: autoload current version from package.json - chooser: support .json files for multiwacz (experimental) - update CHANGES.md - add missing .eslintrc.js file * bump version to 1.4.0
This commit is contained in:
+20
-18
@@ -1,7 +1,7 @@
|
||||
import { LitElement, html, css } from 'lit-element';
|
||||
import { wrapCss } from './misc';
|
||||
import { LitElement, html, css } from "lit-element";
|
||||
import { wrapCss } from "./misc";
|
||||
|
||||
import fabGoogleDrive from '@fortawesome/fontawesome-free/svgs/brands/google-drive.svg';
|
||||
import fabGoogleDrive from "@fortawesome/fontawesome-free/svgs/brands/google-drive.svg";
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
@@ -21,7 +21,7 @@ class GDrive extends LitElement
|
||||
sourceUrl: { type: String },
|
||||
error: { type: Boolean },
|
||||
reauth: { type: Boolean }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
updated(changedProperties) {
|
||||
@@ -41,6 +41,7 @@ class GDrive extends LitElement
|
||||
try {
|
||||
const sourceUrl = this.sourceUrl;
|
||||
const fileId = sourceUrl.slice("googledrive://".length);
|
||||
// eslint-disable-next-line no-undef
|
||||
const publicCheckUrl = `${__HELPER_PROXY__}/g/${fileId}`;
|
||||
|
||||
let resp = null;
|
||||
@@ -87,7 +88,7 @@ class GDrive extends LitElement
|
||||
|
||||
onLoad() {
|
||||
this.scriptLoaded = true;
|
||||
this.gauth('none', (response) => {
|
||||
this.gauth("none", (response) => {
|
||||
if (response.error) {
|
||||
if (this.state !== "implicitonly") {
|
||||
this.state = "trymanual";
|
||||
@@ -99,7 +100,7 @@ class GDrive extends LitElement
|
||||
}
|
||||
|
||||
onClickAuth() {
|
||||
this.gauth('select_account', (response) => {
|
||||
this.gauth("select_account", (response) => {
|
||||
if (!response.error) {
|
||||
this.authed(response);
|
||||
}
|
||||
@@ -144,12 +145,12 @@ class GDrive extends LitElement
|
||||
` : html`
|
||||
${this.error ? html`
|
||||
<div class="error has-text-danger">
|
||||
<p>${this.reauth ? 'Some resources are loaded on demand from Google Drive, which requires reauthorization.' :
|
||||
'Could not access this file with the current Google Drive account.'}</p>
|
||||
<p>${this.reauth ? "Some resources are loaded on demand from Google Drive, which requires reauthorization." :
|
||||
"Could not access this file with the current Google Drive account."}</p>
|
||||
<p>If you have multiple Google Drive accounts, be sure to select the correct one.</p>
|
||||
</div>
|
||||
<br/>
|
||||
` : ``}
|
||||
` : ""}
|
||||
<button class="button is-warning is-rounded" @click="${this.onClickAuth}">
|
||||
<span class="icon"><fa-icon .svg="${fabGoogleDrive}"></fa-icon></span>
|
||||
<span>Authorize Google Drive</span>
|
||||
@@ -161,19 +162,20 @@ class GDrive extends LitElement
|
||||
if (this.state === "trypublic" || this.scriptLoaded) {
|
||||
return html``;
|
||||
}
|
||||
const script = document.createElement('script');
|
||||
const script = document.createElement("script");
|
||||
script.onload = (() => this.onLoad());
|
||||
script.src = 'https://apis.google.com/js/platform.js';
|
||||
script.src = "https://apis.google.com/js/platform.js";
|
||||
return script;
|
||||
}
|
||||
|
||||
gauth(prompt, callback) {
|
||||
gapi.load('auth2', () => {
|
||||
gapi.auth2.authorize({
|
||||
client_id: __GDRIVE_CLIENT_ID__,
|
||||
scope: "https://www.googleapis.com/auth/drive.file",
|
||||
response_type: "token",
|
||||
prompt
|
||||
self.gapi.load("auth2", () => {
|
||||
self.gapi.auth2.authorize({
|
||||
// eslint-disable-next-line no-undef
|
||||
client_id: __GDRIVE_CLIENT_ID__,
|
||||
scope: "https://www.googleapis.com/auth/drive.file",
|
||||
response_type: "token",
|
||||
prompt
|
||||
}, callback);
|
||||
});
|
||||
}
|
||||
@@ -181,4 +183,4 @@ class GDrive extends LitElement
|
||||
|
||||
customElements.define("wr-gdrive", GDrive);
|
||||
|
||||
export { GDrive };
|
||||
export { GDrive };
|
||||
|
||||
Reference in New Issue
Block a user