feat: initial commit
This commit is contained in:
93
examples/wails3_init_updater/frontend/Inter Font License.txt
Normal file
93
examples/wails3_init_updater/frontend/Inter Font License.txt
Normal file
@@ -0,0 +1,93 @@
|
||||
Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,5 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import * as UpdateService from "./updateservice.js";
|
||||
export { UpdateService };
|
||||
@@ -0,0 +1,39 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {
|
||||
Call as $Call,
|
||||
CancellablePromise as $CancellablePromise,
|
||||
Create as $Create,
|
||||
} from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as updates$0 from "../../pkg/wails3kit/updates/models.js";
|
||||
|
||||
export function ApplyAndRestart(): $CancellablePromise<void> {
|
||||
return $Call.ByID(2468725628);
|
||||
}
|
||||
|
||||
export function Check(): $CancellablePromise<updates$0.Snapshot> {
|
||||
return $Call.ByID(688929688).then(($result: any) => {
|
||||
return $$createType0($result);
|
||||
});
|
||||
}
|
||||
|
||||
export function Download(): $CancellablePromise<updates$0.Snapshot> {
|
||||
return $Call.ByID(137313328).then(($result: any) => {
|
||||
return $$createType0($result);
|
||||
});
|
||||
}
|
||||
|
||||
export function Snapshot(): $CancellablePromise<updates$0.Snapshot> {
|
||||
return $Call.ByID(270782772).then(($result: any) => {
|
||||
return $$createType0($result);
|
||||
});
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = updates$0.Snapshot.createFrom;
|
||||
@@ -0,0 +1,17 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export {
|
||||
Artifact,
|
||||
ArtifactFormat,
|
||||
ArtifactKind,
|
||||
BundleFile,
|
||||
BundleManifest,
|
||||
Channel,
|
||||
ErrorInfo,
|
||||
InstallRoot,
|
||||
Release,
|
||||
Snapshot,
|
||||
StagedArtifact,
|
||||
State,
|
||||
} from "./models.js";
|
||||
@@ -0,0 +1,342 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import { Create as $Create } from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as time$0 from "../../../../../../time/models.js";
|
||||
|
||||
export class Artifact {
|
||||
kind: ArtifactKind;
|
||||
format: ArtifactFormat;
|
||||
url: string;
|
||||
sha256: string;
|
||||
size?: number;
|
||||
|
||||
/** Creates a new Artifact instance. */
|
||||
constructor($$source: Partial<Artifact> = {}) {
|
||||
if (!("kind" in $$source)) {
|
||||
this["kind"] = ArtifactKind.$zero;
|
||||
}
|
||||
if (!("format" in $$source)) {
|
||||
this["format"] = ArtifactFormat.$zero;
|
||||
}
|
||||
if (!("url" in $$source)) {
|
||||
this["url"] = "";
|
||||
}
|
||||
if (!("sha256" in $$source)) {
|
||||
this["sha256"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Artifact instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Artifact {
|
||||
let $$parsedSource = typeof $$source === "string" ? JSON.parse($$source) : $$source;
|
||||
return new Artifact($$parsedSource as Partial<Artifact>);
|
||||
}
|
||||
}
|
||||
|
||||
export enum ArtifactFormat {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
ArtifactFormatZip = "zip",
|
||||
ArtifactFormatTarGz = "tar.gz",
|
||||
}
|
||||
|
||||
export enum ArtifactKind {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
ArtifactKindBundleArchive = "bundle-archive",
|
||||
}
|
||||
|
||||
export class BundleFile {
|
||||
path: string;
|
||||
mode: string;
|
||||
|
||||
/** Creates a new BundleFile instance. */
|
||||
constructor($$source: Partial<BundleFile> = {}) {
|
||||
if (!("path" in $$source)) {
|
||||
this["path"] = "";
|
||||
}
|
||||
if (!("mode" in $$source)) {
|
||||
this["mode"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new BundleFile instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): BundleFile {
|
||||
let $$parsedSource = typeof $$source === "string" ? JSON.parse($$source) : $$source;
|
||||
return new BundleFile($$parsedSource as Partial<BundleFile>);
|
||||
}
|
||||
}
|
||||
|
||||
export class BundleManifest {
|
||||
schemaVersion: number;
|
||||
entrypoint: string;
|
||||
files: BundleFile[];
|
||||
|
||||
/** Creates a new BundleManifest instance. */
|
||||
constructor($$source: Partial<BundleManifest> = {}) {
|
||||
if (!("schemaVersion" in $$source)) {
|
||||
this["schemaVersion"] = 0;
|
||||
}
|
||||
if (!("entrypoint" in $$source)) {
|
||||
this["entrypoint"] = "";
|
||||
}
|
||||
if (!("files" in $$source)) {
|
||||
this["files"] = [];
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new BundleManifest instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): BundleManifest {
|
||||
const $$createField2_0 = $$createType1;
|
||||
let $$parsedSource = typeof $$source === "string" ? JSON.parse($$source) : $$source;
|
||||
if ("files" in $$parsedSource) {
|
||||
$$parsedSource["files"] = $$createField2_0($$parsedSource["files"]);
|
||||
}
|
||||
return new BundleManifest($$parsedSource as Partial<BundleManifest>);
|
||||
}
|
||||
}
|
||||
|
||||
export enum Channel {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
ChannelStable = "stable",
|
||||
ChannelBeta = "beta",
|
||||
ChannelAlpha = "alpha",
|
||||
}
|
||||
|
||||
export class ErrorInfo {
|
||||
code: string;
|
||||
message: string;
|
||||
|
||||
/** Creates a new ErrorInfo instance. */
|
||||
constructor($$source: Partial<ErrorInfo> = {}) {
|
||||
if (!("code" in $$source)) {
|
||||
this["code"] = "";
|
||||
}
|
||||
if (!("message" in $$source)) {
|
||||
this["message"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ErrorInfo instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): ErrorInfo {
|
||||
let $$parsedSource = typeof $$source === "string" ? JSON.parse($$source) : $$source;
|
||||
return new ErrorInfo($$parsedSource as Partial<ErrorInfo>);
|
||||
}
|
||||
}
|
||||
|
||||
export class InstallRoot {
|
||||
path: string;
|
||||
|
||||
/** Creates a new InstallRoot instance. */
|
||||
constructor($$source: Partial<InstallRoot> = {}) {
|
||||
if (!("path" in $$source)) {
|
||||
this["path"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new InstallRoot instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): InstallRoot {
|
||||
let $$parsedSource = typeof $$source === "string" ? JSON.parse($$source) : $$source;
|
||||
return new InstallRoot($$parsedSource as Partial<InstallRoot>);
|
||||
}
|
||||
}
|
||||
|
||||
export class Release {
|
||||
id: string;
|
||||
version: string;
|
||||
channel: Channel;
|
||||
notesMarkdown?: string;
|
||||
publishedAt: time$0.Time;
|
||||
artifact: Artifact;
|
||||
|
||||
/** Creates a new Release instance. */
|
||||
constructor($$source: Partial<Release> = {}) {
|
||||
if (!("id" in $$source)) {
|
||||
this["id"] = "";
|
||||
}
|
||||
if (!("version" in $$source)) {
|
||||
this["version"] = "";
|
||||
}
|
||||
if (!("channel" in $$source)) {
|
||||
this["channel"] = Channel.$zero;
|
||||
}
|
||||
if (!("publishedAt" in $$source)) {
|
||||
this["publishedAt"] = null;
|
||||
}
|
||||
if (!("artifact" in $$source)) {
|
||||
this["artifact"] = new Artifact();
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Release instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Release {
|
||||
const $$createField5_0 = $$createType2;
|
||||
let $$parsedSource = typeof $$source === "string" ? JSON.parse($$source) : $$source;
|
||||
if ("artifact" in $$parsedSource) {
|
||||
$$parsedSource["artifact"] = $$createField5_0($$parsedSource["artifact"]);
|
||||
}
|
||||
return new Release($$parsedSource as Partial<Release>);
|
||||
}
|
||||
}
|
||||
|
||||
export class Snapshot {
|
||||
state: State;
|
||||
currentVersion: string;
|
||||
channel: Channel;
|
||||
lastCheckedAt?: time$0.Time | null;
|
||||
candidate?: Release | null;
|
||||
staged?: StagedArtifact | null;
|
||||
lastError?: ErrorInfo | null;
|
||||
|
||||
/** Creates a new Snapshot instance. */
|
||||
constructor($$source: Partial<Snapshot> = {}) {
|
||||
if (!("state" in $$source)) {
|
||||
this["state"] = State.$zero;
|
||||
}
|
||||
if (!("currentVersion" in $$source)) {
|
||||
this["currentVersion"] = "";
|
||||
}
|
||||
if (!("channel" in $$source)) {
|
||||
this["channel"] = Channel.$zero;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Snapshot instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Snapshot {
|
||||
const $$createField4_0 = $$createType4;
|
||||
const $$createField5_0 = $$createType6;
|
||||
const $$createField6_0 = $$createType8;
|
||||
let $$parsedSource = typeof $$source === "string" ? JSON.parse($$source) : $$source;
|
||||
if ("candidate" in $$parsedSource) {
|
||||
$$parsedSource["candidate"] = $$createField4_0($$parsedSource["candidate"]);
|
||||
}
|
||||
if ("staged" in $$parsedSource) {
|
||||
$$parsedSource["staged"] = $$createField5_0($$parsedSource["staged"]);
|
||||
}
|
||||
if ("lastError" in $$parsedSource) {
|
||||
$$parsedSource["lastError"] = $$createField6_0($$parsedSource["lastError"]);
|
||||
}
|
||||
return new Snapshot($$parsedSource as Partial<Snapshot>);
|
||||
}
|
||||
}
|
||||
|
||||
export class StagedArtifact {
|
||||
path: string;
|
||||
root: InstallRoot;
|
||||
release: Release;
|
||||
bundle: BundleManifest;
|
||||
|
||||
/** Creates a new StagedArtifact instance. */
|
||||
constructor($$source: Partial<StagedArtifact> = {}) {
|
||||
if (!("path" in $$source)) {
|
||||
this["path"] = "";
|
||||
}
|
||||
if (!("root" in $$source)) {
|
||||
this["root"] = new InstallRoot();
|
||||
}
|
||||
if (!("release" in $$source)) {
|
||||
this["release"] = new Release();
|
||||
}
|
||||
if (!("bundle" in $$source)) {
|
||||
this["bundle"] = new BundleManifest();
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new StagedArtifact instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): StagedArtifact {
|
||||
const $$createField1_0 = $$createType9;
|
||||
const $$createField2_0 = $$createType3;
|
||||
const $$createField3_0 = $$createType10;
|
||||
let $$parsedSource = typeof $$source === "string" ? JSON.parse($$source) : $$source;
|
||||
if ("root" in $$parsedSource) {
|
||||
$$parsedSource["root"] = $$createField1_0($$parsedSource["root"]);
|
||||
}
|
||||
if ("release" in $$parsedSource) {
|
||||
$$parsedSource["release"] = $$createField2_0($$parsedSource["release"]);
|
||||
}
|
||||
if ("bundle" in $$parsedSource) {
|
||||
$$parsedSource["bundle"] = $$createField3_0($$parsedSource["bundle"]);
|
||||
}
|
||||
return new StagedArtifact($$parsedSource as Partial<StagedArtifact>);
|
||||
}
|
||||
}
|
||||
|
||||
export enum State {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
StateIdle = "idle",
|
||||
StateChecking = "checking",
|
||||
StateUpToDate = "up_to_date",
|
||||
StateUpdateAvailable = "update_available",
|
||||
StateDownloading = "downloading",
|
||||
StateDownloaded = "downloaded",
|
||||
StateVerifying = "verifying",
|
||||
StateReadyToApply = "ready_to_apply",
|
||||
StateApplying = "applying",
|
||||
StateRestarting = "restarting",
|
||||
StateFailed = "failed",
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = BundleFile.createFrom;
|
||||
const $$createType1 = $Create.Array($$createType0);
|
||||
const $$createType2 = Artifact.createFrom;
|
||||
const $$createType3 = Release.createFrom;
|
||||
const $$createType4 = $Create.Nullable($$createType3);
|
||||
const $$createType5 = StagedArtifact.createFrom;
|
||||
const $$createType6 = $Create.Nullable($$createType5);
|
||||
const $$createType7 = ErrorInfo.createFrom;
|
||||
const $$createType8 = $Create.Nullable($$createType7);
|
||||
const $$createType9 = InstallRoot.createFrom;
|
||||
const $$createType10 = BundleManifest.createFrom;
|
||||
@@ -0,0 +1,9 @@
|
||||
//@ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import { Create as $Create } from "@wailsio/runtime";
|
||||
|
||||
Object.freeze($Create.Events);
|
||||
@@ -0,0 +1,2 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
61
examples/wails3_init_updater/frontend/index.html
Normal file
61
examples/wails3_init_updater/frontend/index.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/wails.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/style.css" />
|
||||
<title>Updater Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<main class="layout">
|
||||
<section class="hero">
|
||||
<p class="eyebrow">Wails 3 In-App Updates</p>
|
||||
<h1>Updater Example</h1>
|
||||
<p class="lede">
|
||||
This app starts from <code>wails3 init -t vanilla-ts</code> and binds the updater library
|
||||
behind a single Wails service.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="stat-grid">
|
||||
<div class="stat">
|
||||
<span class="label">Current Version</span>
|
||||
<strong id="current-version">0.1.0</strong>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="label">Channel</span>
|
||||
<strong id="channel">stable</strong>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="label">State</span>
|
||||
<strong id="state">idle</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button id="check" class="btn">Check</button>
|
||||
<button id="download" class="btn">Download</button>
|
||||
<button id="apply" class="btn danger">Apply & Restart</button>
|
||||
</div>
|
||||
|
||||
<div class="details">
|
||||
<div>
|
||||
<span class="label">Candidate Version</span>
|
||||
<p id="candidate-version">none</p>
|
||||
</div>
|
||||
<div>
|
||||
<span class="label">Last Error</span>
|
||||
<p id="last-error">none</p>
|
||||
</div>
|
||||
<div>
|
||||
<span class="label">Release Notes</span>
|
||||
<p id="release-notes">No release selected.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
19
examples/wails3_init_updater/frontend/package.json
Normal file
19
examples/wails3_init_updater/frontend/package.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build:dev": "vite build --minify false --mode development",
|
||||
"build": "vite build --mode production",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wailsio/runtime": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.9.3",
|
||||
"vite": "^5.0.0"
|
||||
}
|
||||
}
|
||||
BIN
examples/wails3_init_updater/frontend/public/Inter-Medium.ttf
Normal file
BIN
examples/wails3_init_updater/frontend/public/Inter-Medium.ttf
Normal file
Binary file not shown.
122
examples/wails3_init_updater/frontend/public/style.css
Normal file
122
examples/wails3_init_updater/frontend/public/style.css
Normal file
@@ -0,0 +1,122 @@
|
||||
:root {
|
||||
font-family: "Inter", sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
color: #1d1e1a;
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(208, 109, 75, 0.24), transparent 35%),
|
||||
radial-gradient(circle at top right, rgba(70, 110, 98, 0.18), transparent 30%),
|
||||
linear-gradient(180deg, #f4efe6 0%, #efe3d1 100%);
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Inter";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src:
|
||||
local(""),
|
||||
url("./Inter-Medium.ttf") format("truetype");
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
padding: 0.85rem 1.35rem;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.layout {
|
||||
max-width: 860px;
|
||||
margin: 0 auto;
|
||||
padding: 4rem 1.5rem;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
margin: 0;
|
||||
font-size: clamp(2.8rem, 7vw, 5rem);
|
||||
line-height: 0.96;
|
||||
}
|
||||
|
||||
.eyebrow,
|
||||
.label {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
font-size: 0.8rem;
|
||||
color: #6b5d4e;
|
||||
}
|
||||
|
||||
.lede {
|
||||
max-width: 52ch;
|
||||
color: #433a30;
|
||||
}
|
||||
|
||||
.panel {
|
||||
margin-top: 2rem;
|
||||
padding: 1.5rem;
|
||||
border: 1px solid rgba(77, 61, 47, 0.16);
|
||||
border-radius: 28px;
|
||||
background: rgba(255, 250, 244, 0.78);
|
||||
backdrop-filter: blur(12px);
|
||||
box-shadow: 0 32px 80px rgba(90, 69, 53, 0.15);
|
||||
}
|
||||
|
||||
.stat-grid {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.stat {
|
||||
padding: 1rem;
|
||||
border-radius: 20px;
|
||||
background: rgba(255, 255, 255, 0.62);
|
||||
}
|
||||
|
||||
.stat strong {
|
||||
display: block;
|
||||
margin-top: 0.45rem;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: #f8f3ec;
|
||||
background: #294b47;
|
||||
}
|
||||
|
||||
.btn.danger {
|
||||
background: #9e5237;
|
||||
}
|
||||
|
||||
.details {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.details p {
|
||||
margin: 0.35rem 0 0;
|
||||
color: #362d24;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.stat-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#007ACC" d="M0 128v128h256V0H0z"></path><path fill="#FFF" d="m56.612 128.85l-.081 10.483h33.32v94.68h23.568v-94.68h33.321v-10.28c0-5.69-.122-10.444-.284-10.566c-.122-.162-20.4-.244-44.983-.203l-44.74.122l-.121 10.443Zm149.955-10.742c6.501 1.625 11.459 4.51 16.01 9.224c2.357 2.52 5.851 7.111 6.136 8.208c.08.325-11.053 7.802-17.798 11.988c-.244.162-1.22-.894-2.317-2.52c-3.291-4.795-6.745-6.867-12.028-7.233c-7.76-.528-12.759 3.535-12.718 10.321c0 1.992.284 3.17 1.097 4.795c1.707 3.536 4.876 5.649 14.832 9.956c18.326 7.883 26.168 13.084 31.045 20.48c5.445 8.249 6.664 21.415 2.966 31.208c-4.063 10.646-14.14 17.879-28.323 20.276c-4.388.772-14.79.65-19.504-.203c-10.28-1.828-20.033-6.908-26.047-13.572c-2.357-2.6-6.949-9.387-6.664-9.874c.122-.163 1.178-.813 2.356-1.504c1.138-.65 5.446-3.129 9.509-5.485l7.355-4.267l1.544 2.276c2.154 3.29 6.867 7.801 9.712 9.305c8.167 4.307 19.383 3.698 24.909-1.26c2.357-2.153 3.332-4.388 3.332-7.68c0-2.966-.366-4.266-1.91-6.501c-1.99-2.845-6.054-5.242-17.595-10.24c-13.206-5.69-18.895-9.224-24.096-14.832c-3.007-3.25-5.852-8.452-7.03-12.8c-.975-3.617-1.22-12.678-.447-16.335c2.723-12.76 12.353-21.659 26.25-24.3c4.51-.853 14.994-.528 19.424.569Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
BIN
examples/wails3_init_updater/frontend/public/wails.png
Normal file
BIN
examples/wails3_init_updater/frontend/public/wails.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.8 KiB |
62
examples/wails3_init_updater/frontend/src/main.ts
Normal file
62
examples/wails3_init_updater/frontend/src/main.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { Events } from "@wailsio/runtime";
|
||||
import { UpdateService } from "../bindings/github.com/Eriyc/rules_wails/examples/wails3_init_updater";
|
||||
|
||||
type Snapshot = {
|
||||
state: string;
|
||||
currentVersion: string;
|
||||
channel: string;
|
||||
candidate?: {
|
||||
version: string;
|
||||
notesMarkdown?: string;
|
||||
};
|
||||
lastError?: {
|
||||
message: string;
|
||||
};
|
||||
};
|
||||
|
||||
const currentVersionElement = document.getElementById("current-version")! as HTMLDivElement;
|
||||
const channelElement = document.getElementById("channel")! as HTMLDivElement;
|
||||
const stateElement = document.getElementById("state")! as HTMLDivElement;
|
||||
const candidateVersionElement = document.getElementById("candidate-version")! as HTMLDivElement;
|
||||
const lastErrorElement = document.getElementById("last-error")! as HTMLDivElement;
|
||||
const releaseNotesElement = document.getElementById("release-notes")! as HTMLDivElement;
|
||||
const checkButton = document.getElementById("check")! as HTMLButtonElement;
|
||||
const downloadButton = document.getElementById("download")! as HTMLButtonElement;
|
||||
const applyButton = document.getElementById("apply")! as HTMLButtonElement;
|
||||
|
||||
function render(snapshot: Snapshot) {
|
||||
currentVersionElement.innerText = snapshot.currentVersion ?? "unknown";
|
||||
channelElement.innerText = snapshot.channel ?? "unknown";
|
||||
stateElement.innerText = snapshot.state ?? "idle";
|
||||
candidateVersionElement.innerText = snapshot.candidate?.version ?? "none";
|
||||
lastErrorElement.innerText = snapshot.lastError?.message ?? "none";
|
||||
releaseNotesElement.innerText = snapshot.candidate?.notesMarkdown ?? "No release selected.";
|
||||
}
|
||||
|
||||
async function refreshSnapshot() {
|
||||
render((await UpdateService.Snapshot()) as Snapshot);
|
||||
}
|
||||
|
||||
checkButton.addEventListener("click", async () => {
|
||||
render((await UpdateService.Check()) as Snapshot);
|
||||
});
|
||||
|
||||
downloadButton.addEventListener("click", async () => {
|
||||
render((await UpdateService.Download()) as Snapshot);
|
||||
});
|
||||
|
||||
applyButton.addEventListener("click", async () => {
|
||||
try {
|
||||
await UpdateService.ApplyAndRestart();
|
||||
} catch (error) {
|
||||
lastErrorElement.innerText = String(error);
|
||||
}
|
||||
});
|
||||
|
||||
Events.On("updates:state", (event) => {
|
||||
render(event.data as Snapshot);
|
||||
});
|
||||
|
||||
refreshSnapshot().catch((error) => {
|
||||
lastErrorElement.innerText = String(error);
|
||||
});
|
||||
1
examples/wails3_init_updater/frontend/src/vite-env.d.ts
vendored
Normal file
1
examples/wails3_init_updater/frontend/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
24
examples/wails3_init_updater/frontend/tsconfig.json
Normal file
24
examples/wails3_init_updater/frontend/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true,
|
||||
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": false,
|
||||
"noImplicitAny": false,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src", "bindings"]
|
||||
}
|
||||
7
examples/wails3_init_updater/frontend/vite.config.ts
Normal file
7
examples/wails3_init_updater/frontend/vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from "vite";
|
||||
import wails from "@wailsio/runtime/plugins/vite";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [wails("./bindings")],
|
||||
});
|
||||
Reference in New Issue
Block a user