mirror of
https://github.com/1f349/mail.1f349.com.git
synced 2024-11-09 22:32:52 +00:00
Add folder list action
This commit is contained in:
parent
68373d4574
commit
d20affdf35
@ -5,11 +5,43 @@
|
|||||||
let mainWS: WebSocket;
|
let mainWS: WebSocket;
|
||||||
$: window.mainWS = mainWS;
|
$: window.mainWS = mainWS;
|
||||||
|
|
||||||
|
interface FolderValue {
|
||||||
|
Attributes: string[];
|
||||||
|
Delimiter: string;
|
||||||
|
Name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
let folders: FolderValue[];
|
||||||
|
|
||||||
function connectWS() {
|
function connectWS() {
|
||||||
mainWS = new WebSocket("wss://api.1f349.com/v1/lotus/imap");
|
mainWS = new WebSocket("wss://api.1f349.com/v1/lotus/imap");
|
||||||
mainWS.addEventListener("open", () => {
|
mainWS.addEventListener("open", () => {
|
||||||
mainWS.send(JSON.stringify({token: getBearer().slice(7)}));
|
mainWS.send(JSON.stringify({token: getBearer().slice(7)}));
|
||||||
});
|
});
|
||||||
|
mainWS.addEventListener("message", e => {
|
||||||
|
let j = JSON.parse(e.data);
|
||||||
|
if (j.auth === "ok") {
|
||||||
|
mainWS.send(JSON.stringify({action: "list", args: ["", "*"]}));
|
||||||
|
}
|
||||||
|
if (j.type === "list") {
|
||||||
|
folders = j.value;
|
||||||
|
}
|
||||||
|
// let a = {
|
||||||
|
// type: "list",
|
||||||
|
// value: [
|
||||||
|
// {Attributes: ["\\HasChildren", "\\UnMarked", "\\Archive"], Delimiter: "/", Name: "Archive"},
|
||||||
|
// {Attributes: ["\\HasNoChildren", "\\UnMarked", "\\Junk"], Delimiter: "/", Name: "Junk"},
|
||||||
|
// {Attributes: ["\\HasChildren", "\\Trash"], Delimiter: "/", Name: "Trash"},
|
||||||
|
// {Attributes: ["\\HasNoChildren", "\\UnMarked"], Delimiter: "/", Name: "INBOX/status"},
|
||||||
|
// {Attributes: ["\\HasNoChildren", "\\UnMarked"], Delimiter: "/", Name: "INBOX/hello"},
|
||||||
|
// {Attributes: ["\\HasNoChildren", "\\UnMarked"], Delimiter: "/", Name: "INBOX/hi"},
|
||||||
|
// {Attributes: ["\\Noselect", "\\HasChildren"], Delimiter: "/", Name: "INBOX/this"},
|
||||||
|
// {Attributes: ["\\HasNoChildren", "\\UnMarked", "\\Drafts"], Delimiter: "/", Name: "Drafts"},
|
||||||
|
// {Attributes: ["\\HasNoChildren", "\\Sent"], Delimiter: "/", Name: "Sent"},
|
||||||
|
// {Attributes: ["\\HasChildren"], Delimiter: "/", Name: "INBOX"},
|
||||||
|
// ],
|
||||||
|
// };
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeLoginSession() {
|
function removeLoginSession() {
|
||||||
@ -43,8 +75,9 @@
|
|||||||
<div id="login-view">Please login to continue</div>
|
<div id="login-view">Please login to continue</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<button class="selected">Inbox</button>
|
{#each folders as folder}
|
||||||
<button>Sent</button>
|
<button class:selected={folder.Name === "INBOX"}>{folder.Name}</button>
|
||||||
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div id="option-view">
|
<div id="option-view">
|
||||||
<div style="padding:8px;background-color:#bb7900;">Warning: This is currently still under development</div>
|
<div style="padding:8px;background-color:#bb7900;">Warning: This is currently still under development</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user