Browse Source

Replace luci-lib-jsonc with our own lua-jsonc

Matthias Schiffer 6 years ago
parent
commit
6cf88c3b03

+ 1 - 1
package/gluon-core/Makefile

@@ -16,7 +16,7 @@ define Package/gluon-core
   CATEGORY:=Gluon
   TITLE:=Base files of Gluon
   DEPENDS:= \
-	+gluon-site +libgluonutil +lua-platform-info +lua-simple-uci +lua-hash +luci-lib-jsonc +luci-lib-nixio \
+	+gluon-site +libgluonutil +lua-platform-info +lua-simple-uci +lua-hash +lua-jsonc +luci-lib-nixio \
 	+vxlan +odhcp6c +firewall +pretty-hostname
 endef
 

+ 2 - 19
package/gluon-core/luasrc/usr/lib/lua/gluon/site.lua

@@ -1,22 +1,5 @@
-local site = (function()
-	local config = '/lib/gluon/site.json'
-
-	local json = require 'luci.jsonc'
-	local decoder = json.new()
-	local sink = decoder:sink()
-
-	local file = assert(io.open(config))
-
-	while true do
-		local chunk = file:read(2048)
-		if not chunk or chunk:len() == 0 then break end
-		sink(chunk)
-	end
-
-	file:close()
-
-	return assert(decoder:get())
-end)()
+local json = require 'jsonc'
+local site = assert(json.load('/lib/gluon/site.json'))
 
 
 local wrap

+ 1 - 1
package/gluon-status-page-api/luasrc/lib/gluon/status-page/www/cgi-bin/interfaces

@@ -1,7 +1,7 @@
 #!/usr/bin/lua
 util = require 'gluon.util'
 fs = require 'nixio.fs'
-json = require 'luci.jsonc'
+json = require 'jsonc'
 ubus = require 'ubus'
 
 io.write("Access-Control-Allow-Origin: *\n")

+ 1 - 1
package/gluon-web/Makefile

@@ -16,7 +16,7 @@ define Package/gluon-web
   SECTION:=gluon
   CATEGORY:=Gluon
   TITLE:=Minimal Lua web framework derived from LuCI
-  DEPENDS:=+luci-lib-jsonc +luci-lib-nixio
+  DEPENDS:=+lua-jsonc +luci-lib-nixio
 endef
 
 define lang-config

+ 1 - 1
package/gluon-web/luasrc/usr/lib/lua/gluon/web/dispatcher.lua

@@ -4,7 +4,7 @@
 -- Licensed to the public under the Apache License 2.0.
 
 local fs = require "nixio.fs"
-local json = require "luci.jsonc"
+local json = require "jsonc"
 local tpl = require "gluon.web.template"
 local util = require "gluon.web.util"
 local proto = require "gluon.web.http.protocol"