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 May 30, 2024
2 parents ce2ce88 + 75395c6 commit a15b7f2
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- run: go build -tags osusergo,netgo -ldflags="-s -w -X main.version=$(git describe --tags) -X main.date=$(date --iso-8601=seconds)"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@6d798873df2b1b8e5846dba6fb86631229fbcb17 # 4.4.0
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # 4.4.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Expand Down
4 changes: 4 additions & 0 deletions internal/view/assets/js/component/eventBus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Create a new Vue instance as the EventBus
const EventBus = new Vue();

export default EventBus;
10 changes: 10 additions & 0 deletions internal/view/assets/js/page/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ import paginationBox from "../component/pagination.js";
import bookmarkItem from "../component/bookmark.js";
import customDialog from "../component/dialog.js";
import basePage from "./base.js";
import EventBus from "../component/eventBus.js";

Vue.prototype.$bus = EventBus;

export default {
template: template,
Expand Down Expand Up @@ -153,6 +156,10 @@ export default {
},
},
methods: {
clearHomePage() {
this.search = "";
this.searchBookmarks();
},
reloadData() {
if (this.loading) return;
this.page = 1;
Expand Down Expand Up @@ -999,6 +1006,9 @@ export default {
},
},
mounted() {
this.$bus.$on("clearHomePage", () => {
this.clearHomePage();
});
// Prepare history state watcher
var stateWatcher = (e) => {
var state = e.state || {},
Expand Down
5 changes: 5 additions & 0 deletions internal/view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import pageHome from "./assets/js/page/home.js";
import pageSetting from "./assets/js/page/setting.js";
import customDialog from "./assets/js/component/dialog.js";
import EventBus from "../assets/js/component/eventBus.js";
Vue.prototype.$bus = EventBus;

var app = new Vue({
el: '#main-scene',
Expand Down Expand Up @@ -69,6 +71,9 @@
state = { activePage: page },
url = new Url;

if (page === 'page-home' && this.activePage === 'page-home') {
Vue.prototype.$bus.$emit('clearHomePage', {});
}
url.hash = pageName;
this.activePage = page;
history.pushState(state, page, url);
Expand Down
24 changes: 18 additions & 6 deletions scripts/styles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,26 @@ OUTPUT_STYLECSS=internal/view/assets/css/style.css
INPUT_ARCHIVECSS=internal/view/assets/less/archive.less
OUTPUT_ARCHIVECSS=internal/view/assets/css/archive.css

# Detect support of avx2
BUN="bun"
case `uname -o` in
GNU/Linux)
# Detect support of avx2 in linux hosts
if ! grep -q avx2 /proc/cpuinfo; then
BUN="sde -chip-check-disable -- bun"
echo "Your CPU does not support avx2 so we use sde, for more information please look at https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847"
fi
;;
esac

# Use bun is installled
if [ -x "$(command -v bun)" ]; then
bun install
bun x prettier internal/view/ --write
bun x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS
bun x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS
bun x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS
bun x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS
$BUN install
$BUN x prettier internal/view/ --write
$BUN x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS
$BUN x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS
$BUN x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS
$BUN x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS
exit 0
fi

Expand Down

0 comments on commit a15b7f2

Please sign in to comment.