Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/api/read/models/de_web_info.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions server/api/read/restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion server/api/readAPI-V0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,6 @@ definitions:
blockList:
type: array
items:
type: string
type: string
noBanner:
type: boolean
4 changes: 4 additions & 0 deletions server/int/api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ServerConfig struct {
BlockList []string
MiscPublicInfoJson interface{}
CacheConfig CacheConfig
NoBanner bool
}

type YamlServerConfig struct {
Expand All @@ -36,6 +37,7 @@ type YamlServerConfig struct {
MiscPublicInfoJson interface{} `yaml:"misc_public_info,omitempty"`
CacheConfig *YamlCacheConfig `yaml:"cache,omitempty"`
AllowOffline bool `yaml:"allow_offline,omitempty"`
NoBanner bool `yaml:"no_banner,omitempty"`
}

func DefaultConfig() (*ServerConfig, error) {
Expand All @@ -52,6 +54,7 @@ func DefaultConfig() (*ServerConfig, error) {
BlockList: []string{},
MiscPublicInfoJson: map[string]interface{}{},
CacheConfig: DefaultCacheConfig(),
NoBanner: false,
}, nil
}

Expand Down Expand Up @@ -122,6 +125,7 @@ func LoadServerConfig(configPath string) (*ServerConfig, error) {
BlockList: yamlConf.BlockList,
MiscPublicInfoJson: convertYamlMisc2Json(yamlConf.MiscPublicInfoJson),
CacheConfig: cacheConfig,
NoBanner: yamlConf.NoBanner,
}

return config, nil
Expand Down
1 change: 1 addition & 0 deletions server/int/api/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (dI *dewebInfo) Handle(params operations.GetDeWebInfoParams) middleware.Res
},
AllowList: dI.conf.AllowList,
BlockList: dI.conf.BlockList,
NoBanner: dI.conf.NoBanner,
}).WriteResponse(w, runtime)
})
}
20 changes: 17 additions & 3 deletions server/int/api/resources/massaBox.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,24 @@
function checkIfClosed() {
const isClosed = localStorage.getItem("massaBoxClosed");
const massaBox = document.getElementById("massaBox");

if (isClosed != "true") {
massaBox.style.display = "flex";
if (isClosed == "true") {
return;
}

// Check if banner should be hidden based on server response
fetch(window.location.origin + "/__deweb_info")
.then(response => response.json())
.then(data => {
if (data.noBanner !== true) {
massaBox.style.display = "flex";
return;
} else {
localStorage.setItem("massaBoxClosed", "true");
}
})
.catch(error => {
console.log("Could not fetch deweb info:", error);
});
}

// Function to close the element and save the state in local storage
Expand Down