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
No related branches found
No related tags found
1 merge request!690Add a file storage to plugin registry
...@@ -66,14 +66,15 @@ func registerPlugins() *PluginRegistry { ...@@ -66,14 +66,15 @@ func registerPlugins() *PluginRegistry {
panic(err) 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 { if err != nil {
panic(err) panic(err)
} }
var plugin *Plugin var plugin *Plugin
for i, p := range plugins { for i, p := range plugins {
if p.Hash == dirHashed { if p.Hash == zipHashed {
plugin = p plugin = p
plugins[i] = plugins[len(plugins)-1] plugins[i] = plugins[len(plugins)-1]
plugins = plugins[:len(plugins)-1] plugins = plugins[:len(plugins)-1]
...@@ -85,7 +86,7 @@ func registerPlugins() *PluginRegistry { ...@@ -85,7 +86,7 @@ func registerPlugins() *PluginRegistry {
plugin = &Plugin{ plugin = &Plugin{
ID: uuid.New(), ID: uuid.New(),
Path: filepath.Join(dirPath, util.BundledPluginName), Path: filepath.Join(dirPath, util.BundledPluginName),
Hash: dirHashed, Hash: zipHashed,
Manifest: manifest, Manifest: manifest,
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment