Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: marcus-crane/october
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.9.0-beta4
Choose a base ref
...
head repository: marcus-crane/october
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jun 9, 2024

  1. Add start of documentation for CLI

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 9, 2024
    Copy the full SHA
    b4612a9 View commit details
  2. Merge branch 'main' of github.com:marcus-crane/october into write-cli…

    …-docs
    
    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 9, 2024
    Copy the full SHA
    6fac4c9 View commit details

Commits on Jun 10, 2024

  1. Wrap up CLI doc for now

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 10, 2024
    Copy the full SHA
    7e12a1f View commit details
  2. Update changelog

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 10, 2024
    Copy the full SHA
    12e6a49 View commit details
  3. Mention newly recognised devices

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 10, 2024
    Copy the full SHA
    e9522e3 View commit details
  4. Merge pull request #127 from marcus-crane/write-cli-docs

    v1.9.0: Write documentation for CLI tool
    marcus-crane authored Jun 10, 2024
    Copy the full SHA
    4da75e9 View commit details
  5. Fix dead links

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 10, 2024
    Copy the full SHA
    85e9b0b View commit details

Commits on Jun 18, 2024

  1. Fix duplicate toasts on startup

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 18, 2024
    Copy the full SHA
    78034b6 View commit details
  2. Remove sync prompt in favour of onboarding flow

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 18, 2024
    Copy the full SHA
    9c02d49 View commit details
  3. Better validation of invalid sync states

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 18, 2024
    Copy the full SHA
    9516cbf View commit details
  4. Add back gitkeep

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 18, 2024
    Copy the full SHA
    6eb4b67 View commit details

Commits on Jun 23, 2024

  1. Copy the full SHA
    1d074c3 View commit details
  2. Update changelog with v1.10.0 release notes

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jun 23, 2024
    Copy the full SHA
    a7c4f97 View commit details

Commits on Dec 7, 2024

  1. Upgrade Wails

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 7, 2024
    Copy the full SHA
    dab0359 View commit details
  2. Build webkit2gtk4.0/4.1 versions for Linux + fix codesigning for Wind…

    …ows portable
    
    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 7, 2024
    Copy the full SHA
    317db67 View commit details
  3. Fix up dependency installs + actually trigger 4.1 flag

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 7, 2024
    Copy the full SHA
    5d9510a View commit details
  4. Fix up Go version and upgrade actions

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 7, 2024
    Copy the full SHA
    810b44d View commit details
  5. Fix incorrect golangci-lint version

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 7, 2024
    Copy the full SHA
    28e8b6a View commit details
  6. Fix linting issue

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 7, 2024
    Copy the full SHA
    2e1feb7 View commit details
  7. Use contains in pipeline for better cross-arch support of tag variants

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 7, 2024
    Copy the full SHA
    a315511 View commit details

Commits on Dec 14, 2024

  1. Start migrating over to log/slog

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 14, 2024
    Copy the full SHA
    99b59b9 View commit details

Commits on Dec 15, 2024

  1. Wire up slog to most of init

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 15, 2024
    Copy the full SHA
    f4fcd27 View commit details

Commits on Dec 16, 2024

  1. Finish migration to log/slog

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 16, 2024
    Copy the full SHA
    9dbe5ee View commit details
  2. Add back gitkeep for frontend

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 16, 2024
    Copy the full SHA
    faf0302 View commit details
  3. Go mod tidy

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 16, 2024
    Copy the full SHA
    5c7b715 View commit details
  4. Merge pull request #137 from marcus-crane/slogger

    Deprecate logrus in favour of log/slog
    marcus-crane authored Dec 16, 2024
    Copy the full SHA
    876c862 View commit details

Commits on Dec 30, 2024

  1. Add a note about webkit2gtk-41

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Dec 30, 2024
    Copy the full SHA
    c0c5642 View commit details

Commits on Jan 2, 2025

  1. Update various year mentions to 2025

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jan 2, 2025
    Copy the full SHA
    8cddbc4 View commit details

Commits on Jan 7, 2025

  1. Add robots.txt for docs

    Signed-off-by: Marcus Crane <marcus@utf9k.net>
    marcus-crane committed Jan 7, 2025
    Copy the full SHA
    3c8c8f8 View commit details
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
with:
fetch-depth: 0
- name: Install Bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -15,12 +15,12 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23
- run: mkdir -p frontend/dist && touch frontend/dist/.gitkeep
- run: go mod download
- run: go fmt ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.0
version: v1.62.2
skip-cache: true
43 changes: 34 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -20,10 +20,18 @@ jobs:
- platform: darwin/universal
os: macos-latest
tag: darwin_universal
- arch: amd64
platform: linux/amd64
os: ubuntu-latest
tag: linux_amd64_webkit2gtk40
- arch: amd64
platform: linux/amd64
os: ubuntu-latest
tag: linux_amd64
- arch: arm64
platform: linux/arm64
os: buildjet-4vcpu-ubuntu-2204-arm
tag: linux_arm64_webkit2gtk40
- arch: arm64
platform: linux/arm64
os: buildjet-4vcpu-ubuntu-2204-arm
@@ -60,7 +68,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23

- name: Install wails
shell: bash
@@ -73,12 +81,17 @@ jobs:

# Dependencies

## Linux

## Linux (webkit2gtk-4.0)
- name: Install Ubuntu prerequisites
if: runner.os == 'Linux'
if: runner.os == 'Linux' && contains(matrix.build.tag, 'webkit2gtk40')
shell: bash
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev

## Linux (webkit2gtk-4.1)
- name: Install Ubuntu prerequisites
if: runner.os == 'Linux' && !contains(matrix.build.tag, 'webkit2gtk40')
shell: bash
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev

## macOS
- name: Setup Gon
@@ -111,12 +124,24 @@ jobs:
# Build -- app variants

## Linux
- name: Build wails app for Linux / macOS
if: runner.os == 'Linux' || runner.os == 'macOS'
## Linux (webkit2gtk-4.0) -- We explicitly set 4.0 in this tag because it'll only be less used over time
- name: Build wails app for Linux (webkit2gtk-4.0)
if: runner.os == 'Linux' && contains(matrix.build.tag, 'webkit2gtk40')
shell: bash
run: wails build -platform ${{ matrix.build.platform }} -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}"


## Linux (webkit2gtk-4.1) -- We set this as the new default as more users will use 24.0x+ over time
- name: Build wails app for Linux (webkit2gtk-4.1)
if: runner.os == 'Linux' && !contains(matrix.build.tag, 'webkit2gtk40')
shell: bash
run: wails build -platform ${{ matrix.build.platform }} -tags webkit2_41 -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}"

## macOS
- name: Build wails app for macOS
if: runner.os == 'macOS'
shell: bash
run: wails build -platform ${{ matrix.build.platform }} -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}"

## Windows
- name: Build Windows NSIS installer (Normal)
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64'
@@ -153,7 +178,7 @@ jobs:
working-directory: ./build/bin

- name: Codesign Windows Portable
if: runner.os == 'Windows' && matrix.build.portable == 'windows-portable_amd64' && startsWith(github.ref, 'refs/tags/')
if: runner.os == 'Windows' && matrix.build.tag == 'windows-portable_amd64' && startsWith(github.ref, 'refs/tags/')
run: |
echo "Creating certificate file"
New-Item -ItemType directory -Path certificate
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23
- run: mkdir -p frontend/build && touch frontend/build/placeholder.txt # TODO: Try to fix this properly
- run: go mod download
- run: go test ./...
10 changes: 8 additions & 2 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -54,12 +54,18 @@ export default defineConfig({
{ text: 'Linux', link: '/installation/linux' }
]
},
{
text: 'Advanced',
items: [
{ text: 'October CLI', link: '/user-guide/advanced/cli' },
{ text: 'Reading Formats', link: '/user-guide/advanced/reading-formats' },
]
},
{
text: 'Extras',
items: [
{ text: 'Changelog', link: '/changelog' },
{ text: 'LICENSE', link: '/miscellaneous/license' },
{ text: 'Reading Formats', link: '/miscellaneous/reading-formats' },
{ text: 'Software License', link: '/license' },
{ text: 'Thanks', link: '/thanks' }
]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Marcus Crane <marcus@utf9k.net>
Copyright (c) 2025 Marcus Crane <marcus@utf9k.net>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
14 changes: 8 additions & 6 deletions app.go
Original file line number Diff line number Diff line change
@@ -2,38 +2,40 @@ package main

import (
"context"
slog "log/slog"

"github.com/marcus-crane/october/backend"
"github.com/sirupsen/logrus"
)

// App struct
type App struct {
ctx context.Context
logger *slog.Logger
portable bool
}

// NewApp creates a new App application struct
func NewApp(portable bool) *App {
func NewApp(portable bool, logger *slog.Logger) *App {
logger.Debug("Initialising app struct")
return &App{
logger: logger,
portable: portable,
}
}

// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.logger.Debug("Calling app startup method")
a.ctx = ctx
}

func (a *App) domReady(ctx context.Context) {
a.logger.Debug("Calling app domReady method")
a.ctx = ctx
backend.StartLogger(a.portable)
logrus.WithContext(ctx).Info("Logger should be initialised now")
logrus.WithContext(ctx).Info("Backend is about to start up")
}

func (a *App) shutdown(ctx context.Context) {
logrus.WithContext(ctx).Info("Shutting down. Goodbye!")
a.logger.Debug("Calling app shutdown method")
backend.CloseLogFile()
}
2 changes: 0 additions & 2 deletions backend/db.go
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ package backend

import (
"github.com/glebarez/sqlite"
"github.com/sirupsen/logrus"
"gorm.io/gorm"
)

@@ -11,7 +10,6 @@ var Conn *gorm.DB
func OpenConnection(filepath string) error {
conn, err := gorm.Open(sqlite.Open(filepath), &gorm.Config{})
if err != nil {
logrus.WithError(err).WithField("filepath", filepath).Error("Failed to open DB connection")
return err
}
Conn = conn
57 changes: 38 additions & 19 deletions backend/device.go
Original file line number Diff line number Diff line change
@@ -2,10 +2,9 @@ package backend

import (
"fmt"
"log/slog"
"strings"

"github.com/sirupsen/logrus"

"github.com/pgaskin/koboutils/v2/kobo"
)

@@ -155,14 +154,20 @@ func (Bookmark) TableName() string {
return "Bookmark"
}

func GetKoboMetadata(detectedPaths []string) []Kobo {
func GetKoboMetadata(detectedPaths []string, logger *slog.Logger) []Kobo {
var kobos []Kobo
for _, path := range detectedPaths {
_, _, deviceId, err := kobo.ParseKoboVersion(path)
if err != nil {
logrus.WithField("kobo_path", path).WithError(err).Error("Failed to parse Kobo version")
logger.Error("Failed to parse Kobo version",
slog.String("error", err.Error()),
slog.String("kobo_path", path),
)
}
logrus.WithField("device_id", deviceId).Info("Found an attached device")
logger.Info("Found attached device",
slog.String("device_id", deviceId),
slog.String("kobo_path", path),
)
device, found := kobo.DeviceByID(deviceId)
if found {
kobos = append(kobos, Kobo{
@@ -187,7 +192,9 @@ func GetKoboMetadata(detectedPaths []string) []Kobo {
})
continue
}
logrus.WithField("device_id", deviceId).Warn("Found a device that isn't officially supported but will likely still operate just fine")
logger.Warn("Found a device that isn't officially supported but will likely still operate just fine",
slog.String("device_id", deviceId),
)
// We can handle unsupported Kobos in future but at present, there are none
kobos = append(kobos, Kobo{
MntPath: path,
@@ -197,55 +204,67 @@ func GetKoboMetadata(detectedPaths []string) []Kobo {
return kobos
}

func (k *Kobo) ListDeviceContent(includeStoreBought bool) ([]Content, error) {
func (k *Kobo) ListDeviceContent(includeStoreBought bool, logger *slog.Logger) ([]Content, error) {
var content []Content
logrus.Debug("Retrieving content list from device")
logger.Debug("Retrieving content list from device")
result := Conn.Where(&Content{ContentType: "6", VolumeIndex: -1})
if !includeStoreBought {
result = result.Where("ContentID LIKE '%file:///%'")
}
result = result.Order("___PercentRead desc, title asc").Find(&content)
if result.Error != nil {
logrus.WithError(result.Error).Error("Failed to retrieve content from device")
logger.Error("Failed to retrieve content from device",
slog.String("error", result.Error.Error()),
)
return nil, result.Error
}
logrus.WithField("content_count", len(content)).Debug("Successfully retrieved device content")
logger.Debug("Successfully retrieved device content",
slog.Int("content_count", len(content)),
)
return content, nil
}

func (k *Kobo) ListDeviceBookmarks(includeStoreBought bool) ([]Bookmark, error) {
func (k *Kobo) ListDeviceBookmarks(includeStoreBought bool, logger *slog.Logger) ([]Bookmark, error) {
var bookmarks []Bookmark
logrus.Debug("Retrieving bookmarks from device")
logger.Debug("Retrieving bookmarks from device")
result := Conn
if !includeStoreBought {
result = result.Where("VolumeID LIKE '%file:///%'")
}
result = result.Order("VolumeID ASC, ChapterProgress ASC").Find(&bookmarks).Limit(1)
if result.Error != nil {
logrus.WithError(result.Error).Error("Failed to retrieve bookmarks from device")
logger.Error("Failed to retrieve bookmarks from device",
slog.String("error", result.Error.Error()),
)
return nil, result.Error
}
logrus.WithField("bookmark_count", len(bookmarks)).Debug("Successfully retrieved device bookmarks")
logger.Debug("Successfully retrieved device bookmarks",
slog.Int("bookmark_count", len(bookmarks)),
)
return bookmarks, nil
}

func (k *Kobo) BuildContentIndex(content []Content) map[string]Content {
logrus.Debug("Building an index out of device content")
func (k *Kobo) BuildContentIndex(content []Content, logger *slog.Logger) map[string]Content {
logger.Debug("Building an index out of device content")
contentIndex := make(map[string]Content)
for _, item := range content {
contentIndex[item.ContentID] = item
}
logrus.WithField("index_count", len(contentIndex)).Debug("Built content index")
logger.Debug("Built content index",
slog.Int("index_count", len(contentIndex)),
)
return contentIndex
}

func (k *Kobo) CountDeviceBookmarks() HighlightCounts {
func (k *Kobo) CountDeviceBookmarks(logger *slog.Logger) HighlightCounts {
var totalCount int64
var officialCount int64
var sideloadedCount int64
result := Conn.Model(&Bookmark{}).Count(&totalCount)
if result.Error != nil {
logrus.WithError(result.Error).Error("Failed to count bookmarks on device")
logger.Error("Failed to count bookmarks on device",
slog.String("error", result.Error.Error()),
)
}
Conn.Model(&Bookmark{}).Where("VolumeID LIKE '%file:///%'").Count(&sideloadedCount)
Conn.Model(&Bookmark{}).Where("VolumeID NOT LIKE '%file:///%'").Count(&officialCount)
12 changes: 5 additions & 7 deletions backend/device_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package backend

import (
"log/slog"
"os"
"path/filepath"
"testing"

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)

@@ -22,20 +22,18 @@ func setupTmpKobo(dir string, deviceId string) string {
content := []byte(deviceId)
err := os.Mkdir(filepath.Join(dir, ".kobo"), 0777)
if err != nil {
logrus.Fatal(err)
return ""
panic(err)
}
tmpfn := filepath.Join(dir, ".kobo", "version")
if err := os.WriteFile(tmpfn, content, 0666); err != nil {
logrus.Fatal(err)
return ""
panic(err)
}
return dir
}

func TestGetKoboMetadata_HandleNoDevices(t *testing.T) {
var expected []Kobo
actual := GetKoboMetadata([]string{})
actual := GetKoboMetadata([]string{}, slog.New(&discardHandler{}))
assert.Equal(t, expected, actual)
}

@@ -85,6 +83,6 @@ func TestGetKoboMetadata_HandleConnectedDevices(t *testing.T) {
},
}
detectedPaths := []string{fakeLibraVolume, fakeMiniVolume, fakeElipsaVolume, fakeClara2EVolume, fakeUnknownVolume}
actual := GetKoboMetadata(detectedPaths)
actual := GetKoboMetadata(detectedPaths, slog.New(&discardHandler{}))
assert.Equal(t, expected, actual)
}
Loading