Skip to content
Snippets Groups Projects
Commit a6df8f5d authored by Malte Bauch's avatar Malte Bauch
Browse files

Use the hash of the zip file to provide

parent 4a52e92e
Branches 37-improve-hostname-ip-handling
No related tags found
1 merge request!690Add a file storage to plugin registry
This commit is part of merge request !690. Comments created here will be created in the context of that merge request.
......@@ -66,14 +66,15 @@ func registerPlugins() *PluginRegistry {
panic(err)
}
dirHashed, err := dirhash.HashDir(dirPath, dir.Name()+manifest.Firmware, dirhash.DefaultHash)
zipPath := filepath.Join(dirPath, util.BundledPluginName)
zipHashed, err := dirhash.HashZip(zipPath, dirhash.DefaultHash)
if err != nil {
panic(err)
}
var plugin *Plugin
for i, p := range plugins {
if p.Hash == dirHashed {
if p.Hash == zipHashed {
plugin = p
plugins[i] = plugins[len(plugins)-1]
plugins = plugins[:len(plugins)-1]
......@@ -85,7 +86,7 @@ func registerPlugins() *PluginRegistry {
plugin = &Plugin{
ID: uuid.New(),
Path: filepath.Join(dirPath, util.BundledPluginName),
Hash: dirHashed,
Hash: zipHashed,
Manifest: manifest,
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment