mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
fixed some code style issues
This commit is contained in:
parent
78b83379b8
commit
14af1fd8d1
@ -11,10 +11,10 @@ class Connection {
|
||||
connectTo(url) {
|
||||
if (this.ws) { this.close(); }
|
||||
|
||||
this.ws = new WebSocket(url, 'fs');
|
||||
this.ws = new WebSocket(url, "fs");
|
||||
this.ws.onopen = () => {
|
||||
this.isConnected = true;
|
||||
this.onopen()
|
||||
this.onopen();
|
||||
};
|
||||
this.ws.onclose = () => {
|
||||
this.isConnected = false;
|
||||
|
@ -4,21 +4,21 @@ class ConnectionView {
|
||||
this.connection.onclose = () => { this.onConnectionClosed(); };
|
||||
this.connection.onopen = () => { this.onConnectionOpened(); };
|
||||
|
||||
this.element = document.createElement('div');
|
||||
this.element = document.createElement("div");
|
||||
|
||||
let urlLabel = document.createElement('span');
|
||||
urlLabel.textContent = 'URL:';
|
||||
let urlLabel = document.createElement("span");
|
||||
urlLabel.textContent = "URL:";
|
||||
this.element.appendChild(urlLabel);
|
||||
|
||||
this.urlTextbox = document.createElement('input');
|
||||
this.urlTextbox.type = 'text';
|
||||
this.urlTextbox = document.createElement("input");
|
||||
this.urlTextbox.type = "text";
|
||||
this.urlTextbox.value = window.location.href.replace(/^http/, "ws");
|
||||
this.element.appendChild(this.urlTextbox);
|
||||
|
||||
this.connectButton = document.createElement('input');
|
||||
this.connectButton.type = 'button';
|
||||
this.connectButton.value = 'connect';
|
||||
this.connectButton.addEventListener('click', () => { this.onConnectButtonClicked(); });
|
||||
this.connectButton = document.createElement("input");
|
||||
this.connectButton.type = "button";
|
||||
this.connectButton.value = "connect";
|
||||
this.connectButton.addEventListener("click", () => { this.onConnectButtonClicked(); });
|
||||
this.element.appendChild(this.connectButton);
|
||||
}
|
||||
|
||||
@ -32,11 +32,11 @@ class ConnectionView {
|
||||
}
|
||||
}
|
||||
onConnectionOpened() {
|
||||
this.connectButton.value = 'disconnect';
|
||||
this.connectButton.value = "disconnect";
|
||||
}
|
||||
|
||||
onConnectionClosed() {
|
||||
this.connectButton.value = 'connect';
|
||||
this.connectButton.value = "connect";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class FileSystem {
|
||||
return {
|
||||
inode: entry.inode,
|
||||
mode: entry.mode || parseInt("755", 8),
|
||||
type: entry.type || 'file',
|
||||
type: entry.type || "file",
|
||||
size: entry.size || (entry.contents && entry.contents.length) || 0,
|
||||
atime: entry.atime || 0,
|
||||
mtime: entry.mtime || 0,
|
||||
@ -62,7 +62,7 @@ class FileSystem {
|
||||
if (entry) {
|
||||
return {
|
||||
mode: entry.mode || parseInt("755", 8),
|
||||
type: entry.type || 'file',
|
||||
type: entry.type || "file",
|
||||
size: entry.size || (entry.contents && entry.contents.length) || 0,
|
||||
atime: entry.atime || 0,
|
||||
mtime: entry.mtime || 0,
|
||||
@ -80,13 +80,13 @@ class FileSystem {
|
||||
|
||||
if ((entry) && ("dir" === entry.type)) {
|
||||
result = [
|
||||
{name: '.', inode: entry.inode},
|
||||
{name: '..', inode: entry.inode}
|
||||
{name: ".", inode: entry.inode},
|
||||
{name: "..", inode: entry.inode}
|
||||
];
|
||||
for(let subdir of Object.entries(entry.entries)) {
|
||||
const name = subdir[0];
|
||||
const inode = subdir[1].inode;
|
||||
result.push({name: name, inode: inode});
|
||||
result.push({name, inode});
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,8 +97,8 @@ class FileSystem {
|
||||
let result = FileSystem.BAD_NOENTRY;
|
||||
let entry = this._inodes[inode];
|
||||
|
||||
if (entry.type == "file") {
|
||||
result = ((mode & FileSystem.O_ACCMODE) == FileSystem.O_RDONLY) ? {handle: 1337} : FileSystem.BAD_NOACCESS;
|
||||
if (entry.type === "file") {
|
||||
result = ((mode & FileSystem.O_ACCMODE) === FileSystem.O_RDONLY) ? {handle: 1337} : FileSystem.BAD_NOACCESS;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -113,7 +113,7 @@ class FileSystem {
|
||||
let result = FileSystem.BAD_NOENTRY;
|
||||
let entry = this._inodes[inode];
|
||||
|
||||
if (entry.type == "file") {
|
||||
if (entry.type === "file") {
|
||||
let end = Math.min(offset + length, entry.contents.length);
|
||||
let data = (offset < entry.contents.length) ? entry.contents.substring(offset, end) : "";
|
||||
result = {
|
||||
|
@ -83,5 +83,5 @@ class FileSystemHandler {
|
||||
}
|
||||
}
|
||||
catch (ex) { console.log(ex, message); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user