diff --git a/src/cmd/main.go b/src/cmd/main.go
index 7f94658..e4e9f34 100644
--- a/src/cmd/main.go
+++ b/src/cmd/main.go
@@ -32,7 +32,7 @@ func main() {
logger.NewLogger,
),
fx.Invoke(func(log *logger.Logger) {
- log.Info("Я футбольный мячик :w")
+ log.Info("Starting application...");
}),
)
diff --git a/src/internal/browserlauncher/chrome.go b/src/internal/browserlauncher/chrome.go
new file mode 100644
index 0000000..fdadbe0
--- /dev/null
+++ b/src/internal/browserlauncher/chrome.go
@@ -0,0 +1,20 @@
+// Copyright (c) 2025 Nikolai Papin
+//
+// This file is part of the Auto Attendance app that looks for
+// self-attend QR-codes during lectures and opens their URLs in your
+// browser.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+// the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+package browserlauncher
diff --git a/src/internal/browserlauncher/firefox.go b/src/internal/browserlauncher/firefox.go
new file mode 100644
index 0000000..fdadbe0
--- /dev/null
+++ b/src/internal/browserlauncher/firefox.go
@@ -0,0 +1,20 @@
+// Copyright (c) 2025 Nikolai Papin
+//
+// This file is part of the Auto Attendance app that looks for
+// self-attend QR-codes during lectures and opens their URLs in your
+// browser.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+// the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+package browserlauncher
diff --git a/src/internal/config/config.go b/src/internal/config/config.go
index fd48873..9417a36 100644
--- a/src/internal/config/config.go
+++ b/src/internal/config/config.go
@@ -36,6 +36,7 @@ type Config struct {
}
type AppConfig struct {
+ SettingsReviewed bool `mapstructure:"settings_reviewed"`
EnableAlarm bool `mapstructure:"enable_alarm"`
EnableLinkOpening bool `mapstructure:"enable_link_opening"`
UseAttendanceJounralApi bool `mapstructure:"use_attendance_journal_api"`
@@ -62,6 +63,7 @@ type LoggingConfig struct {
func getDefaultConfig() Config {
return Config{
App: AppConfig{
+ SettingsReviewed: false,
EnableAlarm: false,
EnableLinkOpening: true,
UseAttendanceJounralApi: false,
@@ -108,6 +110,7 @@ func initializeViper(appName string) (*viper.Viper, string, error) {
defaults := getDefaultConfig()
+ v.SetDefault("app.settings_reviewed", defaults.App.SettingsReviewed)
v.SetDefault("app.enable_alarm", defaults.App.EnableAlarm)
v.SetDefault("app.enable_link_opening", defaults.App.EnableLinkOpening)
v.SetDefault("app.use_attendance_journal_api", defaults.App.UseAttendanceJounralApi)
@@ -129,15 +132,23 @@ func NewConfig() (*Config, error) {
return nil, fmt.Errorf("failed to initialize viper: %w", err)
}
- if err := v.ReadInConfig(); err != nil {
- if _, ok := err.(viper.ConfigFileNotFoundError); ok {
- if err := v.SafeWriteConfig(); err != nil {
- return nil, fmt.Errorf("failed to create config file: %w", err)
- }
- fmt.Printf("Created new config file at: %s\n", configFile)
- } else {
- return nil, fmt.Errorf("failed to read config file: %w", err)
+ if _, err := os.Stat(configFile); os.IsNotExist(err) {
+ file, err := os.Create(configFile)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create config file: %w", err)
}
+ file.Close()
+
+ if err := v.WriteConfig(); err != nil {
+ return nil, fmt.Errorf("failed to write default config: %w", err)
+ }
+ fmt.Printf("Created new config file at: %s\n", configFile)
+ } else if err != nil {
+ return nil, fmt.Errorf("failed to check config file: %w", err)
+ }
+
+ if err := v.ReadInConfig(); err != nil {
+ return nil, fmt.Errorf("failed to read config file: %w", err)
}
var config Config