New applications load method
This commit is contained in:
parent
ade7b9b021
commit
46ad190b2a
@ -32,26 +32,27 @@ func (f *FinderApplication) Render(isMobile bool) gin.H {
|
|||||||
return gin.H{}
|
return gin.H{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FinderApplication) RenderContextMenu(context string, data string) gin.H {
|
func (f *FinderApplication) RenderContextMenu(context string, filePath string, data string) gin.H {
|
||||||
islands := [][]wde.ContexMenuRow{}
|
islands := [][]wde.ContexMenuRow{}
|
||||||
|
islands = append(islands, []wde.ContexMenuRow{})
|
||||||
|
|
||||||
|
if context == "FileTileView" {
|
||||||
islands = append(islands, []wde.ContexMenuRow{
|
islands = append(islands, []wde.ContexMenuRow{
|
||||||
{Label: "Get Info", Action: "getInfo"},
|
{Label: "Get Info", Action: "getInfo"},
|
||||||
{Label: "New Directory", Action: "createDir"},
|
{Label: "New Directory", Action: "createDir"},
|
||||||
})
|
})
|
||||||
if context == "FileTileView" {
|
|
||||||
return gin.H{
|
return gin.H{
|
||||||
"Islands": islands,
|
"Islands": islands,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
islands = append(islands, []wde.ContexMenuRow{
|
|
||||||
{Label: "Delete File", Action: "deleteFile"},
|
|
||||||
// {Label: "Get Info", Action: "getInfo"},
|
|
||||||
})
|
|
||||||
|
|
||||||
switch context {
|
switch context {
|
||||||
case "directory":
|
case "directory":
|
||||||
|
if f.fs.GetExtension(filePath) == "app" {
|
||||||
|
islands = append(islands, []wde.ContexMenuRow{
|
||||||
|
{Label: "Open as Directory", Action: "openAsDir"},
|
||||||
|
})
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
islands = append(islands, []wde.ContexMenuRow{
|
islands = append(islands, []wde.ContexMenuRow{
|
||||||
{Label: "temp Menu 1", Action: ""},
|
{Label: "temp Menu 1", Action: ""},
|
||||||
@ -59,6 +60,10 @@ func (f *FinderApplication) RenderContextMenu(context string, data string) gin.H
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
islands = append(islands, []wde.ContexMenuRow{
|
||||||
|
{Label: "Delete File", Action: "deleteFile"},
|
||||||
|
})
|
||||||
|
|
||||||
return gin.H{
|
return gin.H{
|
||||||
"Islands": islands,
|
"Islands": islands,
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,17 @@ func (f *FinderApplication) Routes(routes *gin.RouterGroup) {
|
|||||||
|
|
||||||
routes.GET("contextMenu", func(ctx *gin.Context) {
|
routes.GET("contextMenu", func(ctx *gin.Context) {
|
||||||
context := ctx.Query("context")
|
context := ctx.Query("context")
|
||||||
|
// if context == "" {
|
||||||
|
// ctx.Status(http.StatusBadRequest)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
filePath := ctx.Query("path")
|
||||||
|
if filePath == "" {
|
||||||
|
ctx.Status(http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
data := ctx.Query("data")
|
data := ctx.Query("data")
|
||||||
ginH := f.RenderContextMenu(context, data)
|
ginH := f.RenderContextMenu(context, filePath, data)
|
||||||
ctx.HTML(http.StatusOK, "wde-widgets/context-menu.tmpl", ginH)
|
ctx.HTML(http.StatusOK, "wde-widgets/context-menu.tmpl", ginH)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ type WebDEApplication interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ApplicationManifest struct {
|
type ApplicationManifest struct {
|
||||||
AppId string `bson:"appid" json:"appid"`
|
AppId string `bson:"appid" json:"appId"`
|
||||||
Js []string `bson:"js" json:"js"`
|
Js []string `bson:"js" json:"js"`
|
||||||
Css []string `bson:"css" json:"css"`
|
Css []string `bson:"css" json:"css"`
|
||||||
}
|
}
|
||||||
@ -50,6 +50,7 @@ func (as *ApplicationsStorage) createApp(appName string, appId string, appPath s
|
|||||||
Data: primitive.NewObjectID(),
|
Data: primitive.NewObjectID(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Create folder for app, etc
|
||||||
_, _, err := as.fs.Write(appPath+"/"+newAppFile.Name, &newAppFile, newAppData)
|
_, _, err := as.fs.Write(appPath+"/"+newAppFile.Name, &newAppFile, newAppData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
6
main.go
6
main.go
@ -128,13 +128,13 @@ func main() {
|
|||||||
{
|
{
|
||||||
webfs.Route(fs)
|
webfs.Route(fs)
|
||||||
}
|
}
|
||||||
app := router.Group("application")
|
app := router.Group("app")
|
||||||
{
|
{
|
||||||
persPropApp := app.Group("personal-properties")
|
persPropApp := app.Group("AboutMe")
|
||||||
{
|
{
|
||||||
persPropsApp.Route(persPropApp)
|
persPropsApp.Route(persPropApp)
|
||||||
}
|
}
|
||||||
finderAppRoute := app.Group("finder")
|
finderAppRoute := app.Group("Finder")
|
||||||
{
|
{
|
||||||
finderApp.Routes(finderAppRoute)
|
finderApp.Routes(finderAppRoute)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
class Finder{
|
class Finder{
|
||||||
appId = "finder"
|
appId = "Finder"
|
||||||
fileView = undefined
|
fileView = undefined
|
||||||
path = "/"
|
path = "/"
|
||||||
homePath = "/home/user"
|
homePath = "/home/user"
|
||||||
@ -8,22 +8,20 @@ class Finder{
|
|||||||
pathHistory = [] //FIXME Fixed length
|
pathHistory = [] //FIXME Fixed length
|
||||||
constructor(){
|
constructor(){
|
||||||
// this.appElem = appElem
|
// this.appElem = appElem
|
||||||
|
// WebDesktopEnvironment.RegisterApp(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
*/
|
*/
|
||||||
NewWindow(args){
|
async NewWindow(args){
|
||||||
this.path = args[0]
|
this.path = args[0]
|
||||||
if (args[1] == "desktop"){
|
if (args[1] == "desktop"){
|
||||||
this.NewDesktop(args)
|
this.NewDesktop(args)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fetch(`${window.location.origin}/application/${this.appId}/render?` + new URLSearchParams({
|
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile})
|
||||||
isMobile: WebDesktopEnvironment.isMobile,
|
fetch(`/app/${this.appId}/render?` + params)
|
||||||
// path: this.path,
|
|
||||||
// bar: true,
|
|
||||||
})) //TODO Move to wde func. Or Not?
|
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((html) => {
|
.then((html) => {
|
||||||
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 )
|
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 )
|
||||||
@ -149,9 +147,14 @@ class Finder{
|
|||||||
Click(event){
|
Click(event){
|
||||||
let fileType = event.target.getAttribute("fileType")
|
let fileType = event.target.getAttribute("fileType")
|
||||||
let fileName = event.target.getAttribute("name")
|
let fileName = event.target.getAttribute("name")
|
||||||
|
const fileExtension = fileName.split(".")[fileName.split(".").length - 1] //FIXME
|
||||||
switch (fileType) {
|
switch (fileType) {
|
||||||
case "directory":
|
case "directory":
|
||||||
WebDesktopEnvironment.Open("finder", [`${this.path}/${fileName}`]) //FIXME this.path is shared for all windows
|
if (fileExtension == "app"){
|
||||||
|
WebDesktopEnvironment.Open(`${this.path}/${fileName}`, [])
|
||||||
|
} else{
|
||||||
|
WebDesktopEnvironment.Open(`/Applications/Finder.app`, [`${this.path}/${fileName}`])
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case "blog":
|
case "blog":
|
||||||
WebDesktopEnvironment.Open("blog-viewer", [`${this.path}/${fileName}`])
|
WebDesktopEnvironment.Open("blog-viewer", [`${this.path}/${fileName}`])
|
||||||
@ -176,15 +179,16 @@ class Finder{
|
|||||||
|
|
||||||
CreateContextMenu(target, pos){
|
CreateContextMenu(target, pos){
|
||||||
let context = ""
|
let context = ""
|
||||||
|
const fileName = target.getAttribute("name")
|
||||||
|
const fileType = target.getAttribute("fileType")
|
||||||
if (target.classList.contains("FileTileView"))
|
if (target.classList.contains("FileTileView"))
|
||||||
{
|
{
|
||||||
context = "FileTileView"
|
context = "FileTileView"
|
||||||
|
} else {
|
||||||
|
context = fileType
|
||||||
}
|
}
|
||||||
fetch(`${window.location.origin}/application/${this.appId}/contextMenu?` + new URLSearchParams({
|
const params = new URLSearchParams({context: context, path: `${this.path}/${fileName}`})
|
||||||
context: context
|
fetch(`/app/${this.appId}/contextMenu?` + params)
|
||||||
|
|
||||||
}))
|
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((html) => {
|
.then((html) => {
|
||||||
let overlay = document.createElement("div") //TODO Move to WDE.CreateOverlay()
|
let overlay = document.createElement("div") //TODO Move to WDE.CreateOverlay()
|
||||||
@ -207,8 +211,6 @@ class Finder{
|
|||||||
|
|
||||||
overlay.addEventListener('click', (event) => {
|
overlay.addEventListener('click', (event) => {
|
||||||
if (event.target.classList.contains("Row")){ //TODO add uuid id to rows to more accurate checks??
|
if (event.target.classList.contains("Row")){ //TODO add uuid id to rows to more accurate checks??
|
||||||
let fileType = target.getAttribute("fileType")
|
|
||||||
let fileName = target.getAttribute("name")
|
|
||||||
switch (event.target.children[0].getAttribute("action")) {
|
switch (event.target.children[0].getAttribute("action")) {
|
||||||
case "createDir":
|
case "createDir":
|
||||||
fetch(`/fs/createDir?` + new URLSearchParams({
|
fetch(`/fs/createDir?` + new URLSearchParams({
|
||||||
@ -263,6 +265,10 @@ class Finder{
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
WebDesktopEnvironment.Alert(error);
|
WebDesktopEnvironment.Alert(error);
|
||||||
})
|
})
|
||||||
|
break
|
||||||
|
case "openAsDir":
|
||||||
|
WebDesktopEnvironment.Open(`/Applications/${this.appId}.app`,[`${this.path}/${fileName}`])
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
class PersonalProperties{
|
class AboutMe{
|
||||||
appId = "personal-properties"
|
appId = "AboutMe"
|
||||||
/**
|
/**
|
||||||
* @param {HTMLElement} appElem
|
* @param {HTMLElement} appElem
|
||||||
*/
|
*/
|
||||||
@ -9,12 +9,14 @@ class PersonalProperties{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
|
* @param {[]string} args
|
||||||
*/
|
*/
|
||||||
NewWindow(path){
|
NewWindow(path, args){
|
||||||
fetch(`${window.location.origin}/application/personal-properties/render?`+ new URLSearchParams({
|
if (path == ""){
|
||||||
isMobile: WebDesktopEnvironment.isMobile,
|
path = "/home/user/aboutme.props" //FIXME
|
||||||
path: path
|
}
|
||||||
}))
|
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: path})
|
||||||
|
fetch(`/app/${this.appId}/render?`+ params)
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((html) => {
|
.then((html) => {
|
||||||
// console.log(document.body)
|
// console.log(document.body)
|
||||||
|
140
resources/wde.js
140
resources/wde.js
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// console.log(window.screen.width)
|
// console.log(window.screen.width)
|
||||||
wde = new WebDesktopEnvironment
|
wde = new WebDesktopEnvironment()
|
||||||
if (!WebDesktopEnvironment.isMobile){
|
if (!WebDesktopEnvironment.isMobile){
|
||||||
WebDesktopEnvironment.Open("finder", ["/home/user"])
|
// WebDesktopEnvironment.Open("finder", ["/home/user"])
|
||||||
WebDesktopEnvironment.fetchApp("/home/user/AboutMe.app")
|
|
||||||
// WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog1.blog"])
|
// WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog1.blog"])
|
||||||
// WebDesktopEnvironment.Open("personal-properties", ["/home/user/aboutme.props"])
|
// WebDesktopEnvironment.Open("personal-properties", ["/home/user/aboutme.props"])
|
||||||
} else {
|
} else {
|
||||||
WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"])
|
// WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -20,11 +20,18 @@ class WebDesktopEnvironment{
|
|||||||
static Applications = {};
|
static Applications = {};
|
||||||
static isMobile = false
|
static isMobile = false
|
||||||
constructor(){
|
constructor(){
|
||||||
WebDesktopEnvironment.isMobile = WebDesktopEnvironment.CheckMobile()
|
// WebDesktopEnvironment.Open("finder", ["/home/user", "desktop", document.querySelector('#desktop-layer')])
|
||||||
|
//TODO create key -desktop-mode
|
||||||
|
|
||||||
let applications = document.createElement("div")
|
|
||||||
applications.setAttribute('id', 'applications')
|
this.wc = new WindowsCompositor()
|
||||||
document.body.appendChild(applications)
|
this.loadWDE()
|
||||||
|
return
|
||||||
|
// WebDesktopEnvironment.isMobile = WebDesktopEnvironment.CheckMobile()
|
||||||
|
|
||||||
|
// let applications = document.createElement("div")
|
||||||
|
// applications.setAttribute('id', 'applications')
|
||||||
|
// document.body.appendChild(applications)
|
||||||
|
|
||||||
if( WebDesktopEnvironment.isMobile){
|
if( WebDesktopEnvironment.isMobile){
|
||||||
document.body.style.setProperty('--zoom', 3)
|
document.body.style.setProperty('--zoom', 3)
|
||||||
@ -61,17 +68,83 @@ class WebDesktopEnvironment{
|
|||||||
} else{
|
} else{
|
||||||
document.body.style.setProperty('--zoom', 1)
|
document.body.style.setProperty('--zoom', 1)
|
||||||
|
|
||||||
let desktopLayer = document.createElement("div")
|
// let desktopLayer = document.createElement("div")
|
||||||
desktopLayer.setAttribute('id', 'desktop-layer')
|
// desktopLayer.setAttribute('id', 'desktop-layer')
|
||||||
document.body.appendChild(desktopLayer)
|
// document.body.appendChild(desktopLayer)
|
||||||
WebDesktopEnvironment.Open("finder", ["/home/user", "desktop", desktopLayer])
|
WebDesktopEnvironment.Open("finder", ["/home/user", "desktop", desktopLayer])
|
||||||
|
|
||||||
let windowsLayer = document.createElement("div")
|
// let windowsLayer = document.createElement("div")
|
||||||
windowsLayer.setAttribute('id', 'windows-layer')
|
// windowsLayer.setAttribute('id', 'windows-layer')
|
||||||
document.body.appendChild(windowsLayer)
|
// document.body.appendChild(windowsLayer)
|
||||||
|
this.Autoload()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.wc = new WindowsCompositor
|
|
||||||
|
|
||||||
|
async loadWDE(){
|
||||||
|
// await WebDesktopEnvironment.load2('/Applications/Finder.app', [ "desktop", document.querySelector('#desktop-layer')])
|
||||||
|
// WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user", "desktop", document.querySelector('#desktop-layer')])
|
||||||
|
WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user",])
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} appPath
|
||||||
|
* @param {string[]} args
|
||||||
|
*/
|
||||||
|
static async Open(appPath, args){
|
||||||
|
WebDesktopEnvironment.fetchApp(appPath).then(async appManifest =>{
|
||||||
|
if (appManifest === undefined) return //TODO return err
|
||||||
|
if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined){
|
||||||
|
WebDesktopEnvironment.load2(appManifest, () =>{
|
||||||
|
WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} appManifest
|
||||||
|
* @param {function} onload callback after script loading
|
||||||
|
*/
|
||||||
|
static async load2(appManifest, onload){
|
||||||
|
let appElem = document.createElement("div")
|
||||||
|
appElem.setAttribute("appId", appManifest.appId)
|
||||||
|
//TODO Render scripts nodes on server
|
||||||
|
//FIXME Not support more than one js now :)
|
||||||
|
let script = document.createElement("script")
|
||||||
|
script.setAttribute("src", appManifest.js[0]) //FIXME path by fs read
|
||||||
|
script.setAttribute("async", "false") //TODO Possible may creates a problems??
|
||||||
|
appElem.appendChild(script)
|
||||||
|
|
||||||
|
document.getElementById("applications").appendChild(appElem)
|
||||||
|
script.addEventListener('load', (event) => {
|
||||||
|
let newApp = eval(`new ${appManifest.appId}()`);
|
||||||
|
//TODO Check if newApp undefined
|
||||||
|
WebDesktopEnvironment.Applications[appManifest.appId] = newApp;
|
||||||
|
onload()
|
||||||
|
})
|
||||||
|
return //TODO return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {Object | undefined} //FIXME
|
||||||
|
*/
|
||||||
|
static async fetchApp(path){
|
||||||
|
const params = new URLSearchParams({path: path})
|
||||||
|
const response = await fetch(`/system/libs/apps/loadApp?` + params)
|
||||||
|
if (response.status != 200){
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
const appManifest = response.json()
|
||||||
|
return appManifest
|
||||||
|
}
|
||||||
|
|
||||||
|
Autoload(){
|
||||||
|
// WebDesktopEnvironment.Open(["/home/user/AboutMe.app"])
|
||||||
|
// WebDesktopEnvironment.load2(["/home/user/AboutMe.app"])
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {string} appId
|
* @param {string} appId
|
||||||
@ -116,44 +189,7 @@ class WebDesktopEnvironment{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @param {function} callbackFunc callback after script loading
|
|
||||||
* @returns {Application | undefined}
|
|
||||||
*/
|
|
||||||
static loadApp2(path, callbackFunc){
|
|
||||||
//var myObject = window[classNameString]; to load random classes
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @returns {Application | undefined} //FIXME
|
|
||||||
*/
|
|
||||||
static fetchApp(path){
|
|
||||||
fetch(`/system/libs/apps/loadApp?` + new URLSearchParams({
|
|
||||||
path: path,
|
|
||||||
})) .then(async (response) => {
|
|
||||||
console.log(await response.json())
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
WebDesktopEnvironment.Alert(error);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} appId
|
|
||||||
* @param {string[]} args
|
|
||||||
*/
|
|
||||||
static Open(appId, args){
|
|
||||||
if (this.Applications[appId] == undefined){
|
|
||||||
console.log(`Application ${appId} is not loaded yet`)
|
|
||||||
WebDesktopEnvironment.LoadApp(appId, () =>{
|
|
||||||
this.Applications[appId].NewWindow(args)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.Applications[appId].NewWindow(args)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} appId
|
* @param {string} appId
|
||||||
|
@ -24,7 +24,9 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- <div id="WindowsLayer"></div> -->
|
<!-- <div id="WindowsLayer"></div> -->
|
||||||
<!-- <div id="Applications"></div> -->
|
<div id="applications"></div>
|
||||||
|
<div id="desktop-layer"></div>
|
||||||
|
<div id="windows-layer"></div>
|
||||||
<!-- <div id="TestWindow" style="width: 100px; height: 100px; background-color: darkkhaki; position: absolute;" >
|
<!-- <div id="TestWindow" style="width: 100px; height: 100px; background-color: darkkhaki; position: absolute;" >
|
||||||
<div id="TestWindowHeader" class="VisualDragArea" style="width: 100%;height: 15px; background-color: cornflowerblue;">
|
<div id="TestWindowHeader" class="VisualDragArea" style="width: 100%;height: 15px; background-color: cornflowerblue;">
|
||||||
</div> -->
|
</div> -->
|
||||||
|
@ -106,21 +106,21 @@ func (fs *WebFileSystem) Route(route *gin.RouterGroup) {
|
|||||||
ctx.JSON(http.StatusOK, &files)
|
ctx.JSON(http.StatusOK, &files)
|
||||||
})
|
})
|
||||||
|
|
||||||
// route.GET("read", func(ctx *gin.Context) {
|
route.GET("read", func(ctx *gin.Context) {
|
||||||
// path := ctx.Query("path")
|
path := ctx.Query("path")
|
||||||
// if path == "" {
|
if path == "" {
|
||||||
// ctx.JSON(http.StatusBadRequest, "TODO") //TODO json error struct
|
ctx.JSON(http.StatusBadRequest, "TODO") //TODO json error struct
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// file, err := fs.NewReadDeprecated(path)
|
file, err := fs.Read(path, nil)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.JSON(http.StatusInternalServerError, "TODO") //TODO json error struct
|
ctx.JSON(http.StatusInternalServerError, "TODO") //TODO json error struct
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.JSON(http.StatusOK, &file)
|
ctx.JSON(http.StatusOK, &file)
|
||||||
// })
|
})
|
||||||
|
|
||||||
route.GET("validate", func(ctx *gin.Context) {
|
route.GET("validate", func(ctx *gin.Context) {
|
||||||
err := fs.Validate()
|
err := fs.Validate()
|
||||||
|
Loading…
Reference in New Issue
Block a user