Skip to content

Commit

Permalink
Merge branch 'master' into fix-thumbnail-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Monirzadeh authored Jun 8, 2024
2 parents a15b7f2 + 650f192 commit a7ceb09
Show file tree
Hide file tree
Showing 22 changed files with 161 additions and 944 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: "Unit Tests"

on: workflow_call
on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: true

env:
CGO_ENABLED: 0
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
uses: ./.github/workflows/_golangci-lint.yml
call-test:
uses: ./.github/workflows/_test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN}}
call-swagger-check:
uses: ./.github/workflows/_swagger-check.yml
call-styles-check:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
uses: ./.github/workflows/_golangci-lint.yml
call-test:
uses: ./.github/workflows/_test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN}}
call-gorelease:
needs: [call-lint, call-test]
uses: ./.github/workflows/_gorelease.yml
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/dev-data*

# Coverage data
/coverage.out
/coverage.*

# Dist files
dist/
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ archives:
name_template: >-
{{ .ProjectName }}_
{{- if eq .Os "darwin" }}Darwin{{- else if eq .Os "linux" }}Linux{{- else if eq .Os "windows" }}Windows{{- else }}{{ .Os }}{{ end }}_
{{- if eq .Arch "amd64" }}x86_64{{- else if eq .Arch "arm64" }}aarch64{{- else }}{{ .Arch }}{{ end }}
{{- if eq .Arch "amd64" }}x86_64{{- else if eq .Arch "arm64" }}aarch64{{- else }}{{ .Arch }}{{ end }}_{{ .Version }}
format_overrides:
- goos: windows
format: zip
Expand Down
827 changes: 0 additions & 827 deletions coverage.txt

This file was deleted.

30 changes: 15 additions & 15 deletions docs/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api_v1.contentResponseMessage"
"$ref": "#/definitions/api_v1.readableResponseMessage"
}
},
"403": {
Expand Down Expand Up @@ -228,17 +228,6 @@ const docTemplate = `{
}
},
"definitions": {
"api_v1.contentResponseMessage": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"html": {
"type": "string"
}
}
},
"api_v1.loginRequestPayload": {
"type": "object",
"required": [
Expand Down Expand Up @@ -273,6 +262,17 @@ const docTemplate = `{
}
}
},
"api_v1.readableResponseMessage": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"html": {
"type": "string"
}
}
},
"api_v1.settingRequestPayload": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -417,12 +417,12 @@ const docTemplate = `{
"MakePublic": {
"type": "boolean"
},
"NightMode": {
"type": "boolean"
},
"ShowId": {
"type": "boolean"
},
"Theme": {
"type": "string"
},
"UseArchive": {
"type": "boolean"
}
Expand Down
30 changes: 15 additions & 15 deletions docs/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api_v1.contentResponseMessage"
"$ref": "#/definitions/api_v1.readableResponseMessage"
}
},
"403": {
Expand Down Expand Up @@ -217,17 +217,6 @@
}
},
"definitions": {
"api_v1.contentResponseMessage": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"html": {
"type": "string"
}
}
},
"api_v1.loginRequestPayload": {
"type": "object",
"required": [
Expand Down Expand Up @@ -262,6 +251,17 @@
}
}
},
"api_v1.readableResponseMessage": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"html": {
"type": "string"
}
}
},
"api_v1.settingRequestPayload": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -406,12 +406,12 @@
"MakePublic": {
"type": "boolean"
},
"NightMode": {
"type": "boolean"
},
"ShowId": {
"type": "boolean"
},
"Theme": {
"type": "string"
},
"UseArchive": {
"type": "boolean"
}
Expand Down
20 changes: 10 additions & 10 deletions docs/swagger/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
definitions:
api_v1.contentResponseMessage:
properties:
content:
type: string
html:
type: string
type: object
api_v1.loginRequestPayload:
properties:
password:
Expand All @@ -29,6 +22,13 @@ definitions:
token:
type: string
type: object
api_v1.readableResponseMessage:
properties:
content:
type: string
html:
type: string
type: object
api_v1.settingRequestPayload:
properties:
config:
Expand Down Expand Up @@ -124,10 +124,10 @@ definitions:
type: boolean
MakePublic:
type: boolean
NightMode:
type: boolean
ShowId:
type: boolean
Theme:
type: string
UseArchive:
type: boolean
type: object
Expand Down Expand Up @@ -233,7 +233,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/api_v1.contentResponseMessage'
$ref: '#/definitions/api_v1.readableResponseMessage'
"403":
description: Token not provided/invalid
summary: Get readable version of bookmark.
Expand Down
4 changes: 2 additions & 2 deletions internal/http/routes/api/v1/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func TestSettingsHandler(t *testing.T) {
ListMode: true,
HideThumbnail: true,
HideExcerpt: true,
NightMode: true,
Theme: "follow",
KeepMetadata: true,
UseArchive: true,
CreateEbook: true,
Expand All @@ -274,7 +274,7 @@ func TestSettingsHandler(t *testing.T) {
"ListMode": false,
"HideThumbnail": false,
"HideExcerpt": false,
"NightMode": false,
"Theme": "follow",
"KeepMetadata": false,
"UseArchive": false,
"CreateEbook": false,
Expand Down
2 changes: 1 addition & 1 deletion internal/http/routes/api/v1/bookmarks.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type readableResponseMessage struct {
// @Tags Auth
// @securityDefinitions.apikey ApiKeyAuth
// @Produce json
// @Success 200 {object} contentResponseMessage
// @Success 200 {object} readableResponseMessage
// @Failure 403 {object} nil "Token not provided/invalid"
// @Router /api/v1/bookmarks/id/readable [get]
func (r *BookmarksAPIRoutes) bookmarkReadable(c *gin.Context) {
Expand Down
18 changes: 9 additions & 9 deletions internal/model/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ type Account struct {
}

type UserConfig struct {
ShowId bool `json:"ShowId"`
ListMode bool `json:"ListMode"`
HideThumbnail bool `json:"HideThumbnail"`
HideExcerpt bool `json:"HideExcerpt"`
NightMode bool `json:"NightMode"`
KeepMetadata bool `json:"KeepMetadata"`
UseArchive bool `json:"UseArchive"`
CreateEbook bool `json:"CreateEbook"`
MakePublic bool `json:"MakePublic"`
ShowId bool `json:"ShowId"`
ListMode bool `json:"ListMode"`
HideThumbnail bool `json:"HideThumbnail"`
HideExcerpt bool `json:"HideExcerpt"`
Theme string `json:"Theme"`
KeepMetadata bool `json:"KeepMetadata"`
UseArchive bool `json:"UseArchive"`
CreateEbook bool `json:"CreateEbook"`
MakePublic bool `json:"MakePublic"`
}

func (c *UserConfig) Scan(value interface{}) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/view/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div id="shiori-archive-header" class="header">
<p id="shiori-logo"><span></span>shiori</p>
<div class="spacer"></div>
<a href="$$.URL$$" target="_blank">View Original</a>
<a href="$$.Book.URL$$" target="_blank">View Original</a>
$$if .Book.HasContent$$
<a href="/bookmark/$$.Book.ID$$/content">View Readable</a>
$$end$$
Expand Down
2 changes: 1 addition & 1 deletion internal/view/assets/css/style.css

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion internal/view/assets/js/page/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default {
return {
ShowId: false,
ListMode: false,
NightMode: false,
HideThumbnail: false,
HideExcerpt: false,
KeepMetadata: false,
Expand Down Expand Up @@ -95,6 +94,23 @@ export default {
return false;
}
},
themeSwitch(theme) {
switch (theme) {
case "light":
document.body.classList.remove("dark");
document.body.classList.add("light");
break;
case "dark":
document.body.classList.remove("light");
document.body.classList.add("dark");
break;
case "follow":
document.body.classList.remove("light", "dark");
break;
default:
console.error("Invalid theme selected");
}
},
showErrorDialog(msg) {
var sessionError = this.isSessionError(msg),
dialogContent = sessionError
Expand Down
14 changes: 9 additions & 5 deletions internal/view/assets/js/page/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ var template = `
<div class="setting-container">
<details open class="setting-group" id="setting-display">
<summary>Display</summary>
<label>
Theme &nbsp;
<select v-model="appOptions.Theme" @change="saveSetting">
<option value="follow">Follow system</option>
<option value="light">Light theme</option>
<option value="dark">Dark theme</option>
</select>
</label>
<label>
<input type="checkbox" v-model="appOptions.ShowId" @change="saveSetting">
Show bookmark's ID
Expand All @@ -20,10 +28,6 @@ var template = `
<input type="checkbox" v-model="appOptions.HideExcerpt" @change="saveSetting">
Hide bookmark's excerpt
</label>
<label>
<input type="checkbox" v-model="appOptions.NightMode" @change="saveSetting">
Use dark theme
</label>
</details>
<details v-if="activeAccount.owner" open class="setting-group" id="setting-bookmarks">
<summary>Bookmarks</summary>
Expand Down Expand Up @@ -92,7 +96,7 @@ export default {
ListMode: this.appOptions.ListMode,
HideThumbnail: this.appOptions.HideThumbnail,
HideExcerpt: this.appOptions.HideExcerpt,
NightMode: this.appOptions.NightMode,
Theme: this.appOptions.Theme,
};

if (this.activeAccount.owner) {
Expand Down
38 changes: 7 additions & 31 deletions internal/view/assets/less/common.less
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
:root {
--bg: #eee;
--sidebarBg: #292929;
--sidebarHoverBg: #232323;
--headerBg: #fff;
--contentBg: #fff;
--border: #e5e5e5;
--color: #232323;
--colorLink: #999;
--colorSidebar: #fff;
--main: #f44336;
--errorColor: #f44336;
--selectedBg: #ffe7e5;

@media (prefers-color-scheme: dark) {
&:root {
--bg: #1f1f1f;
--headerBg: #292929;
--contentBg: #292929;
--border: #191919;
--color: #fff;
--selectedBg: #261918;
}
}
select {
background: var(--contentBg);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--color);
}

&.night {
--bg: #1f1f1f;
--headerBg: #292929;
--contentBg: #292929;
--border: #191919;
--color: #fff;
--selectedBg: #261918;
footer {
color: var(--color);
}

* {
Expand Down
1 change: 1 addition & 0 deletions internal/view/assets/less/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@import "./libs/fontawesome.min.css";

// Less files
@import "./theme.less";
@import "./common.less";
@import "./custom-dialog.less";
@import "./bookmark-item.less";
Loading

0 comments on commit a7ceb09

Please sign in to comment.