Compare commits

..

No commits in common. "f81e15f1b8232bd43a35be76f7a338d7babd3b72" and "46ad190b2a9a156674bac651466887899d8e55db" have entirely different histories.

6 changed files with 9 additions and 76 deletions

View File

@ -1,57 +0,0 @@
package libs
import (
"errors"
"net/http"
"personalwebsite/webfilesystem"
"github.com/gin-gonic/gin"
)
type Cat struct {
fs *webfilesystem.WebFileSystem
}
func NewCatLib(webfs *webfilesystem.WebFileSystem) *Cat {
return &Cat{
fs: webfs,
}
}
func (c *Cat) Get(filePath string) (string, error) {
file, err := c.fs.Read(filePath, nil)
if err != nil {
return "", err
}
if file.Type != "plaintext" {
return "", errors.New("todo")
}
fileData := webfilesystem.PlainTextFileData{}
_, err = c.fs.Read(filePath, &fileData)
if err != nil {
return "", err
}
return fileData.Data, nil
}
func (c *Cat) Route(route *gin.RouterGroup) {
route.GET("get", func(ctx *gin.Context) {
path := ctx.Query("path")
if path == "" {
ctx.String(http.StatusBadRequest, "TODO") //TODO json error struct
return
}
data, err := c.Get(path)
if err != nil {
ctx.Status(http.StatusInternalServerError)
return
}
ctx.String(http.StatusOK, "plaintext", data)
})
}

View File

@ -5,13 +5,11 @@ import (
)
type Libs struct {
Imglib *ImagLib
Cat *Cat
imglib *ImagLib
}
func NewLibs(webfs *webfilesystem.WebFileSystem) Libs {
return Libs{
Imglib: NewImgLib(webfs),
Cat: NewCatLib(webfs),
imglib: NewImgLib(webfs),
}
}

View File

@ -89,12 +89,6 @@ func main() {
imgLib.Route(imgLibGroup)
}
catLibGroup := libsGroup.Group("cat")
{
catLib := libs.NewCatLib(webfs)
catLib.Route(catLibGroup)
}
appsStorageGroup := libsGroup.Group("apps")
{
appsStorage.Route(appsStorageGroup)

View File

@ -20,11 +20,14 @@ class WebDesktopEnvironment{
static Applications = {};
static isMobile = false
constructor(){
// WebDesktopEnvironment.isMobile = WebDesktopEnvironment.CheckMobile()
document.body.style.setProperty('--zoom', 1)
// WebDesktopEnvironment.Open("finder", ["/home/user", "desktop", document.querySelector('#desktop-layer')])
//TODO create key -desktop-mode
this.wc = new WindowsCompositor()
this.loadWDE()
return
// WebDesktopEnvironment.isMobile = WebDesktopEnvironment.CheckMobile()
// let applications = document.createElement("div")
// applications.setAttribute('id', 'applications')
@ -63,6 +66,7 @@ class WebDesktopEnvironment{
})
} else{
document.body.style.setProperty('--zoom', 1)
// let desktopLayer = document.createElement("div")
// desktopLayer.setAttribute('id', 'desktop-layer')

View File

@ -11,7 +11,6 @@
</div>
<div id="ContentBorder" class="ContentBorder AdjectiveElement">
<div class="FinderContent">
<!-- TODO Fix ConvexElement -->
<div class="ToolBar ConvexElement">
<button id="RootButton">/</button>
<button id="HomeButton">Home</button>

View File

@ -44,11 +44,6 @@ type BinaryFileData struct {
Bin []byte `bson:"bin" json:"-"`
}
type PlainTextFileData struct {
MongoId primitive.ObjectID `bson:"_id" json:"-"`
Data string `bson:"data" json:"data"`
}
// Deprecated
func (fs *WebFileSystem) ReadHeader(fileID primitive.ObjectID) (*FileHeader, error) {
file := &FileHeader{}