1. Home Tab
    a. Card> Tab> Tables (Global, Programs, Hybrid(Premium))
  2. Settings Tab

Fix ui basics and logic with go backend functions.
then refine ui.

  • Home tab: Shows AiSlash’s on/off status (listening for keyboard inputs) and an overview of all user triggers (e.g., ‘/taskai’).

  • Settings tab: Displays in-depth trigger details, including global or program-specific settings. Features Global settings (endpoints, payloads, etc.) with toggle boxes for each trigger. Includes an “Add Trigger” button for creating new triggers and a “Save” button to store updates. New triggers default to ‘global’ with global endpoints and payloads.

  • Account tab: Presents user’s account information, tier (Basic or Premium), and partially masked API key (last 3 characters visible).

  • About tab: Provides AiSlash’s website URL and Discord server link.

screw motivation, screw discipline. its all about how bad you want it.

API Key is set in

Yes, you can add the code to your app.go file as a new function called GoogleAuth. Here is an example of how you can do this:

import (
	"context"
	"fmt"
	"log"
 
	"golang.org/x/oauth2"
	"golang.org/x/oauth2/google"
)
 
// ... Your other code
 
func (a *App) GoogleAuth() {
	ctx := context.Background()
	conf := &oauth2.Config{
		ClientID:     "YOUR_CLIENT_ID",
		ClientSecret: "YOUR_CLIENT_SECRET",
		Scopes:       []string{"https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", "openid"},
		Endpoint:     google.Endpoint,
	}
 
	url := conf.AuthCodeURL("state", oauth2.AccessTypeOffline)
	fmt.Printf("Visit the URL for the auth dialog: %v", url)
}

This code defines a new method on the App struct called GoogleAuth, which constructs the authorization URL for Google using the oauth2.Config struct from the golang.org/x/oauth2 package. You need to provide your ClientID and ClientSecret, as well as the desired Scopes and Endpoint. The AuthCodeURL method generates the authorization URL, which you can use to redirect the user to the Google OAuth login page.

Make sure to replace "YOUR_CLIENT_ID" and "YOUR_CLIENT_SECRET" with your actual client ID and client secret.

After the user has authenticated with Google and you have obtained an access token, you can use the access token to retrieve the user’s email address from the Google API. You can then use this email address to create a new user in your Pocketbase user auth collection.

Here is an example of how you can do this using the google.golang.org/api/oauth2/v2 package:

import (
	"context"
	"log"
 
	"golang.org/x/oauth2"
	"golang.org/x/oauth2/google"
	oauth2api "google.golang.org/api/oauth2/v2"
)
 
func (a *App) RegisterUserWithGoogle(accessToken string) {
	ctx := context.Background()
	oauthConfig := &oauth2.Config{
		ClientID:     "YOUR_CLIENT_ID",
		ClientSecret: "YOUR_CLIENT_SECRET",
		Scopes:       []string{"https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", "openid"},
		Endpoint:     google.Endpoint,
	}
 
	token := &oauth2.Token{AccessToken: accessToken}
	client := oauthConfig.Client(ctx, token)
 
	service, err := oauth2api.New(client)
	if err != nil {
		log.Fatal(err)
	}
 
	userInfo, err := service.Userinfo.Get().Do()
	if err != nil {
		log.Fatal(err)
	}
 
	email := userInfo.Email
 
	// Use the email address to create a new user in your Pocketbase user auth collection
}

Yes, you can use the Collection type from the r--w/pocketbase package to interact with your Pocketbase user auth collection and create a new user. Here is an example of how you can do this:

import (
	"log"
 
	"github.com/r--w/pocketbase"
)
 
func (a *App) RegisterUserWithGoogle(email string) {
	client := pocketbase.NewClient("https://aislash.hqnsel.com")
	collection := pocketbase.CollectionSet[map[string]interface{}](client, "users")
 
	user := map[string]interface{}{
		"email": email,
	}
 
	response, err := collection.Create(user)
	if err != nil {
		log.Fatal(err)
	}
 
	log.Print(response.ID)
}

This code creates a new pocketbase.Client instance and uses it to create a new Collection for the users collection. The Create method is then used to create a new user in the collection, providing the user’s email address as the email field.

Make sure to replace "https://aislash.hqnsel.com" with the URL of your Pocketbase API server, and "users" with the name of your user auth collection.

https://www.brevo.com/pricing/#