diff --git a/CLAUDE.md b/CLAUDE.md index 2191848..35fc410 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,11 +10,6 @@ When creating, modifying, or removing plugins: - Brief description of functionality - Usage instructions with examples - Any configuration requirements -3. **For plugins with configuration options:** - - Set `ConfigRequired: true` in the plugin's BasePlugin struct - - Add corresponding HTML form fields in `internal/admin/templates/channel_plugin_config.html` - - Use conditional template logic: `{{else if eq .ChannelPlugin.PluginID "plugin.id"}}` - - Include proper form labels, help text, and value binding ## Testing diff --git a/docs/plugins.md b/docs/plugins.md index 3472a08..d84aec5 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -23,5 +23,5 @@ ### Social Media -- Twitter Link Expander: Automatically converts twitter.com and x.com links to alternative domain links and removes tracking parameters. This allows for better media embedding in chat platforms. Configure with `domain` option to set replacement domain (default: fxtwitter.com). -- Instagram Link Expander: Automatically converts instagram.com links to alternative domain links and removes tracking parameters. This allows for better media embedding in chat platforms. Configure with `domain` option to set replacement domain (default: ddinstagram.com). +- Twitter Link Expander: Automatically converts twitter.com and x.com links to fxtwitter.com links and removes tracking parameters. This allows for better media embedding in chat platforms. +- Instagram Link Expander: Automatically converts instagram.com links to ddinstagram.com links and removes tracking parameters. This allows for better media embedding in chat platforms. diff --git a/internal/admin/admin.go b/internal/admin/admin.go index cfa2595..2b41820 100644 --- a/internal/admin/admin.go +++ b/internal/admin/admin.go @@ -16,7 +16,7 @@ import ( "github.com/gorilla/sessions" ) -//go:embed templates/*.html templates/plugins/*.html +//go:embed templates/*.html var templateFS embed.FS const ( @@ -90,7 +90,7 @@ func New(cfg *config.Config, database *db.Database, version string) *Admin { } // Parse and register all templates - mainTemplateFiles := []string{ + templateFiles := []string{ "index.html", "login.html", "change_password.html", @@ -101,13 +101,7 @@ func New(cfg *config.Config, database *db.Database, version string) *Admin { "channel_plugin_config.html", } - pluginTemplateFiles := []string{ - "plugins/security.domainblock.html", - "plugins/social.instagram.html", - "plugins/social.twitter.html", - } - - for _, tf := range mainTemplateFiles { + for _, tf := range templateFiles { // Read template content from embedded filesystem content, err := templateFS.ReadFile("templates/" + tf) if err != nil { @@ -126,20 +120,6 @@ func New(cfg *config.Config, database *db.Database, version string) *Admin { panic(err) } - // If this is the channel_plugin_config template, also parse plugin templates - if tf == "channel_plugin_config.html" { - for _, pluginTf := range pluginTemplateFiles { - pluginContent, err := templateFS.ReadFile("templates/" + pluginTf) - if err != nil { - panic(err) - } - t, err = t.Parse(string(pluginContent)) - if err != nil { - panic(err) - } - } - } - templates[tf] = t } diff --git a/internal/admin/templates/channel_plugin_config.html b/internal/admin/templates/channel_plugin_config.html index 0f229f9..decf1a2 100644 --- a/internal/admin/templates/channel_plugin_config.html +++ b/internal/admin/templates/channel_plugin_config.html @@ -9,11 +9,16 @@