Merge branch 'development' into development_fix_zinit

This commit is contained in:
Mahmoud-Emad
2025-11-19 15:18:23 +02:00
3 changed files with 13 additions and 26 deletions

View File

@@ -1,10 +1,10 @@
!!hero_code.generate_installer
name:'cryptpad'
classname:'CryptpadServer'
singleton:0 //there can only be 1 object in the globals, is called 'default'
templates:1 //are there templates for the installer
default:0 //can we create a default when the factory is used
singleton:0
default:0
title:''
supported_platforms:'' //osx, ... (empty means all)
reset:0 // regenerate all, dangerous !!!
startupmanager:0 //not managed by a startup manager
supported_platforms:''
startupmanager:0
hasconfig:1
build:0

View File

@@ -28,12 +28,9 @@ pub fn new(args ArgsGet) !&CryptpadServer {
return get(name: args.name)!
}
pub fn get(args_ ArgsGet) !&CryptpadServer {
mut args := args_
pub fn get(args ArgsGet) !&CryptpadServer {
mut context := base.context()!
if args.name == 'cryptpad' && cryptpad_default != '' {
args.name = cryptpad_default
}
cryptpad_default = args.name
if args.fromdb || args.name !in cryptpad_global {
mut r := context.redis()!
if r.hexists('context:cryptpad', args.name)! {
@@ -52,17 +49,12 @@ pub fn get(args_ ArgsGet) !&CryptpadServer {
return error("CryptpadServer with name '${args.name}' does not exist")
}
}
return get(
name: args.name
fromdb: args.fromdb
create: args.create
)! // no longer from db nor create
return get(name: args.name)! // no longer from db nor create
}
result := cryptpad_global[args.name] or {
return cryptpad_global[args.name] or {
print_backtrace()
return error('could not get config for cryptpad with name:${args.name}')
}
return result
}
// register the config for the future
@@ -71,8 +63,7 @@ pub fn set(o CryptpadServer) ! {
cryptpad_default = o2.name
mut context := base.context()!
mut r := context.redis()!
encoded := json.encode(o2)
r.hset('context:cryptpad', o2.name, encoded)!
r.hset('context:cryptpad', o2.name, json.encode(o2))!
}
// does the config exists?

View File

@@ -28,13 +28,9 @@ pub fn new(args ArgsGet) !&ElementChat {
return get(name: args.name)!
}
pub fn get(args_ ArgsGet) !&ElementChat {
pub fn get(args ArgsGet) !&ElementChat {
mut context := base.context()!
mut args := args_
if args.name == 'element_chat' && element_chat_default != '' {
args.name = element_chat_default
}
element_chat_default = args.name
if args.fromdb || args.name !in element_chat_global {
mut r := context.redis()!
if r.hexists('context:element_chat', args.name)! {