fix MarketPlace

This commit is contained in:
Xuan Sang LE 2018-03-18 14:16:06 +01:00
parent 4290ea602a
commit b4428d0188
4 changed files with 31 additions and 4 deletions

View File

@ -110,7 +110,7 @@ pkgar:
test -f $(BUILDDIR)/packages/$$PKG/main.js && uglifyjs $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\ test -f $(BUILDDIR)/packages/$$PKG/main.js && uglifyjs $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\
test -f $(BUILDDIR)/packages/$$PKG/main.css && uglifycss --output $(BUILDDIR)/packages/$$PKG/main.css $(BUILDDIR)/packages/$$PKG/main.css;\ test -f $(BUILDDIR)/packages/$$PKG/main.css && uglifycss --output $(BUILDDIR)/packages/$$PKG/main.css $(BUILDDIR)/packages/$$PKG/main.css;\
cd $(BUILDDIR)/packages/$$PKG && zip -r "$$PKG.zip" ./ ; \ cd $(BUILDDIR)/packages/$$PKG && zip -r "$$PKG.zip" ./ ; \
cd ../../ && mv packages/$$PKG/"$$PKG.zip" repo/ && rm -r packages/$$PKG cd ../../ && (mkdir repo/$$PKG || true) && mv packages/$$PKG/"$$PKG.zip" repo/$$PKG && touch repo/$$PKG/$$PKG.md && rm -r packages/$$PKG
uglify: uglify:
# uglify antos.js # uglify antos.js

View File

@ -290,6 +290,25 @@ class BufferFileHandler extends self.OS.API.VFS.BaseFileHandler
self.OS.API.VFS.register "^mem$", BufferFileHandler self.OS.API.VFS.register "^mem$", BufferFileHandler
class URLFileHandler extends self.OS.API.VFS.BaseFileHandler
constructor: (path) ->
super path
@ready = true
meta: (f) ->
f { result: true }
action: (n, p, f) ->
me = @
switch n
when "read"
_API.get @path, (d) ->
f(d)
, (e, s) ->
_courrier.oserror __("VFS cannot read : {0}", me.path), e, s
, if p then p else "text"
else
return _courrier.oserror __("VFS unknown action: {0}", n), (_API.throwe "OS.VFS"), n
self.OS.API.VFS.register "^(http|https)$", URLFileHandler
class SharedFileHandler extends self.OS.API.VFS.BaseFileHandler class SharedFileHandler extends self.OS.API.VFS.BaseFileHandler
constructor: (path) -> constructor: (path) ->
super path super path

3
src/libs/showdown.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -64,10 +64,15 @@ class MarketPlace extends this.OS.GUI.BaseApplication
me.error __("Fail to fetch packages list from: {0}", url) me.error __("Fail to fetch packages list from: {0}", url)
appDetail: (d) -> appDetail: (d) ->
me = @
($ @container).css "visibility", "visible" ($ @container).css "visibility", "visible"
( $ @appname ).html d.name ( $ @appname ).html d.name
($ @appdesc).html d.description if d.description if d.description
($ @appdesc).prepend ($ "<img/>").attr("src", d.screenshot) if d.screenshot d.description.asFileHandler().read (text) ->
converter = new showdown.Converter()
($ me.appdesc).html converter.makeHtml text
else
($ me.appdesc).empty()
if @systemsetting.system.packages[d.className] if @systemsetting.system.packages[d.className]
($ @btinstall).hide() ($ @btinstall).hide()
@ -175,6 +180,6 @@ class MarketPlace extends this.OS.GUI.BaseApplication
return me.installFile n, zip, files, f if r.result return me.installFile n, zip, files, f if r.result
me.error __("Cannot install {0}", path) me.error __("Cannot install {0}", path)
MarketPlace.dependencies = [ "jszip.min" ] MarketPlace.dependencies = [ "jszip.min", "showdown.min" ]
MarketPlace.singleton = true MarketPlace.singleton = true
this.OS.register "MarketPlace", MarketPlace this.OS.register "MarketPlace", MarketPlace