mirror of
https://github.com/gtsteffaniak/filebrowser.git
synced 2026-11-25 16:09:41 -05:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2eb352c2d3 | ||
|
|
43bb4a36b4 | ||
|
|
c67abefc7b | ||
|
|
2ecb9036aa | ||
|
|
dbcfba993b | ||
|
|
ed22ce9421 |
No files matched your search
@@ -2,6 +2,26 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. For commit guidelines, please refer to [Standard Version](https://github.com/conventional-changelog/standard-version).
|
||||
|
||||
## v1.2.1-stable
|
||||
|
||||
**BugFixes**:
|
||||
- startup icon generation order issue (#2019)
|
||||
- login button on shares not showing (#2028)
|
||||
- removed file watcher link in context menu for shares (#2025)
|
||||
- Direct download link for single-file shares generates incorrect URL (#2026)
|
||||
- Deleting files causes error V1.2.0 #2039
|
||||
|
||||
## v1.2.7-beta
|
||||
|
||||
**BugFixes**:
|
||||
- head > title > infinitely duplicating titles (#2016)
|
||||
- Proxy auth not working with Nginx, stuck at logo (#2013)
|
||||
|
||||
## v1.2.6-beta
|
||||
|
||||
**Security**:
|
||||
- resolves https://github.com/gtsteffaniak/filebrowser/security/advisories/GHSA-8vrh-3pm2-v4v6
|
||||
|
||||
## v1.2.5-beta
|
||||
|
||||
**Notes**:
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ func updateShowFirstLogin(user *users.User) bool {
|
||||
|
||||
// func to convert legacy user with perm key to permissions
|
||||
func updatePermissions(user *users.User) bool {
|
||||
if user.Version == 1 {
|
||||
if user.Version >= 1 {
|
||||
return false
|
||||
}
|
||||
updateUser := true
|
||||
|
||||
@@ -278,8 +278,6 @@ func setupFrontend(generate bool) {
|
||||
}
|
||||
// Load custom favicon if configured
|
||||
loadCustomFavicon()
|
||||
// Generate PWA icons from custom favicon if needed
|
||||
generatePWAIcons()
|
||||
}
|
||||
|
||||
func setupMedia() {
|
||||
@@ -788,23 +786,6 @@ func loadCustomFavicon() {
|
||||
logger.Infof("Using custom favicon: %s", Env.FaviconPath)
|
||||
}
|
||||
|
||||
// generatePWAIcons sets up PWA icon paths (actual generation happens after preview service starts)
|
||||
func generatePWAIcons() {
|
||||
// Set PWA icons directory in cache
|
||||
Env.PWAIconsDir = filepath.Join(Config.Server.CacheDir, "icons")
|
||||
|
||||
// Initialize with default paths (all icons will be generated)
|
||||
Env.PWAIcon192 = "icons/pwa-icon-192.png"
|
||||
Env.PWAIcon256 = "icons/pwa-icon-256.png"
|
||||
Env.PWAIcon512 = "icons/pwa-icon-512.png"
|
||||
|
||||
// Create icons directory with configured permissions
|
||||
// Note: Parent cache directory should already exist from testCacheDirSpeed()
|
||||
if err := os.MkdirAll(Env.PWAIconsDir, fileutils.PermDir); err != nil {
|
||||
logger.Warningf("Failed to create PWA icons directory %s: %v", Env.PWAIconsDir, err)
|
||||
}
|
||||
}
|
||||
|
||||
func loadLoginIcon() {
|
||||
const imageName = "login icon"
|
||||
allowedFormats := []string{".svg", ".png", ".jpg", ".jpeg", ".gif", ".webp", ".ico"}
|
||||
|
||||
@@ -43,8 +43,8 @@ type CommonShare struct {
|
||||
AllowReplacements bool `json:"allowReplacements,omitempty"` // allow replacements of files
|
||||
SidebarLinks []users.SidebarLink `json:"sidebarLinks"` // customizable sidebar links
|
||||
HasPassword bool `json:"hasPassword,omitempty"`
|
||||
ShowHidden bool `json:"showHidden,omitempty"` // show hidden files in share (true = show, false = hide)
|
||||
DisableLoginOption bool `json:"disableLoginOption,omitempty"` // disable login option in share (true = hide, false = show)
|
||||
ShowHidden bool `json:"showHidden,omitempty"` // show hidden files in share (true = show, false = hide)
|
||||
DisableLoginOption bool `json:"disableLoginOption"` // disable login option in share (true = hide, false = show)
|
||||
}
|
||||
type CreateBody struct {
|
||||
CommonShare
|
||||
|
||||
@@ -78,7 +78,7 @@ func publicRawHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
|
||||
// Get all "file" parameter values (supports repeated params)
|
||||
files := r.URL.Query()["file"]
|
||||
if len(files) == 0 {
|
||||
return http.StatusBadRequest, fmt.Errorf("no files specified")
|
||||
files = []string{"/"}
|
||||
}
|
||||
|
||||
// Get the actual source name from the share's source mapping
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ func rawFilesHandler(w http.ResponseWriter, r *http.Request, d *requestContext,
|
||||
return http.StatusForbidden, fmt.Errorf("user is not allowed to download")
|
||||
}
|
||||
|
||||
if len(fileList) == 0 {
|
||||
if len(fileList) == 0 && d.share == nil {
|
||||
return http.StatusBadRequest, fmt.Errorf("no files specified")
|
||||
}
|
||||
|
||||
|
||||
@@ -610,8 +610,7 @@ func shareInfoHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
|
||||
return http.StatusNotFound, fmt.Errorf("share hash not found")
|
||||
}
|
||||
commonShare := shareLink.CommonShare
|
||||
commonShare.DownloadURL = getShareURL(r, hash, true, shareLink.Token)
|
||||
commonShare.ShareURL = getShareURL(r, hash, false, shareLink.Token)
|
||||
commonShare.ShareURL = getShareURL(r, hash, false, "")
|
||||
_, _, err = getShareImagePartsHelper(shareLink, true)
|
||||
if err == nil {
|
||||
commonShare.BannerUrl = fmt.Sprintf("%spublic/api/share/image?banner=true&hash=%s", config.Server.BaseURL, hash)
|
||||
|
||||
@@ -233,7 +233,19 @@ func generateSingleIcon(previewService *preview.Service, sourceData []byte, icon
|
||||
// All icons are generated as PNG for maximum compatibility (Apple devices, PWA, older browsers)
|
||||
func GeneratePWAIcons() error {
|
||||
logger.Info("Generating PWA icons...")
|
||||
// Set PWA icons directory in cache
|
||||
settings.Env.PWAIconsDir = filepath.Join(settings.Config.Server.CacheDir, "icons")
|
||||
|
||||
// Initialize with default paths (all icons will be generated)
|
||||
settings.Env.PWAIcon192 = "icons/pwa-icon-192.png"
|
||||
settings.Env.PWAIcon256 = "icons/pwa-icon-256.png"
|
||||
settings.Env.PWAIcon512 = "icons/pwa-icon-512.png"
|
||||
|
||||
// Create icons directory with configured permissions
|
||||
// Note: Parent cache directory should already exist from testCacheDirSpeed()
|
||||
if err := os.MkdirAll(settings.Env.PWAIconsDir, fileutils.PermDir); err != nil {
|
||||
logger.Warningf("Failed to create PWA icons directory %s: %v", settings.Env.PWAIconsDir, err)
|
||||
}
|
||||
// Load and prepare source data as PNG
|
||||
sourceData, err := loadFaviconSource()
|
||||
if err != nil {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { globalVars } from "@/utils/constants";
|
||||
|
||||
const ssl = window.location.protocol === "https:";
|
||||
const protocol = ssl ? "wss:" : "ws:";
|
||||
|
||||
export default function command(url, command, onmessage, onclose) {
|
||||
url = `${protocol}//${window.location.host}${globalVars.baseURL}api/command${url}`;
|
||||
let conn = new window.WebSocket(url);
|
||||
conn.onopen = () => conn.send(command);
|
||||
conn.onmessage = onmessage;
|
||||
conn.onclose = onclose;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { fetchURL, fetchJSON } from '@/api/utils'
|
||||
import { getApiPath, getPublicApiPath } from '@/utils/url.js'
|
||||
import { notify } from '@/notify' // Import notify for error handling
|
||||
|
||||
export async function getAllUsers() {
|
||||
try {
|
||||
const apiPath = getApiPath('api/users')
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
<action v-if="showGoToRaw" icon="open_in_new" :label="$t('general.openFile')" @action="goToRaw()" />
|
||||
<action v-if="shouldShowParentFolder()" icon="folder" :label="$t('buttons.openParentFolder')" @action="openParentFolder" />
|
||||
<action v-if="isPreview && permissions.modify" icon="mode_edit" :label="$t('general.rename')" @action="showRenameHoverForPreview" />
|
||||
<action v-if="hasDownload && !req.isDir" icon="visibility" :label="$t('buttons.watchFile')" @action="watchFile()" />
|
||||
<action v-if="showWatch" icon="visibility" :label="$t('buttons.watchFile')" @action="watchFile()" />
|
||||
<action v-if="hasDownload" icon="file_download" :label="$t('general.download')" @action="startDownload" />
|
||||
<action v-if="showEdit" icon="edit" :label="$t('general.edit')" @action="edit()" />
|
||||
<action v-if="showSave" icon="save" :label="$t('general.save')" @action="save()" />
|
||||
@@ -187,6 +187,9 @@ export default {
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
showWatch() {
|
||||
return this.hasDownload && !this.req.isDir && !this.isShare;
|
||||
},
|
||||
showGoToItem() {
|
||||
return this.isDuplicateFinder && this.selectedCount == 1;
|
||||
},
|
||||
|
||||
@@ -57,6 +57,7 @@ import { notify } from "@/notify";
|
||||
import { getTypeInfo } from "@/utils/mimetype";
|
||||
import ListingItem from "@/components/files/ListingItem.vue";
|
||||
import { eventBus } from "@/store/eventBus";
|
||||
import url from "@/utils/url";
|
||||
|
||||
export default {
|
||||
name: "delete",
|
||||
@@ -230,7 +231,7 @@ export default {
|
||||
const failedCount = response.failed ? response.failed.length : 0;
|
||||
|
||||
if (failedCount === 0) {
|
||||
// All succeeded - close prompt and reload
|
||||
// All succeeded - close prompt and handle navigation
|
||||
buttons.success("delete");
|
||||
notify.showSuccessToast(this.$t('prompts.deleted'));
|
||||
|
||||
@@ -245,7 +246,27 @@ export default {
|
||||
if (!this.items) {
|
||||
mutations.resetSelected();
|
||||
}
|
||||
mutations.setReload(true);
|
||||
|
||||
// Smart navigation: if in preview mode with single item deletion, navigate intelligently
|
||||
if (getters.isPreviewView() && this.itemsToDelete.length === 1) {
|
||||
// Try next, then previous, then parent directory
|
||||
if (state.navigation.nextItem) {
|
||||
// Use goToItem with undefined to use router.replace (no history entry)
|
||||
url.goToItem(state.navigation.nextItem.source, state.navigation.nextItem.path, undefined);
|
||||
} else if (state.navigation.previousItem) {
|
||||
// Use goToItem with undefined to use router.replace (no history entry)
|
||||
url.goToItem(state.navigation.previousItem.source, state.navigation.previousItem.path, undefined);
|
||||
} else {
|
||||
// Navigate to parent directory of deleted item
|
||||
const deletedItemPath = this.itemsToDelete[0].path;
|
||||
const parentPath = url.removeLastDir(deletedItemPath);
|
||||
const deletedItemSource = this.itemsToDelete[0].source;
|
||||
url.goToItem(deletedItemSource, parentPath, {});
|
||||
}
|
||||
} else {
|
||||
// For listing view or multiple deletions, just reload
|
||||
mutations.setReload(true);
|
||||
}
|
||||
} else if (succeededCount > 0) {
|
||||
// Partial success - keep prompt open to show errors
|
||||
buttons.done("delete");
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
|
||||
<div v-if="!disableQuickToggles" class="card-wrapper" @mouseleave="hideTooltip">
|
||||
<div class="quick-toggles" :class="{ 'extra-padding': !hasCreateOptions }">
|
||||
<div class="quick-toggles" :class="{ 'extra-padding': hasCreateOptions }">
|
||||
<div class="clickable" :class="{ active: user?.singleClick }" @click="toggleClick"
|
||||
@mouseenter="showTooltip($event, $t('index.toggleClick'))" @mouseleave="hideTooltip" v-if="!isInvalidShare">
|
||||
<i class="material-icons">ads_click</i>
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
},
|
||||
hasCreateOptions() {
|
||||
if (getters.isShare()) {
|
||||
return state.shareInfo?.allowCreate
|
||||
return state.shareInfo?.allowCreate == true
|
||||
}
|
||||
return state.user?.permissions?.create || state.user?.permissions?.share || state.user?.permissions?.admin;
|
||||
},
|
||||
@@ -128,7 +128,7 @@ export default {
|
||||
shouldShowLogin() {
|
||||
if (getters.isShare()) {
|
||||
// Don't show login until shareInfo is fully loaded
|
||||
if (state.shareInfo && state.shareInfo.disableLoginOption == undefined) {
|
||||
if (state.shareInfo && state.shareInfo?.disableLoginOption) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
openContextMenu() {
|
||||
mutations.resetSelected();
|
||||
mutations.showHover({
|
||||
|
||||
@@ -737,7 +737,7 @@
|
||||
"green": "groen",
|
||||
"blue": "blauw",
|
||||
"yellow": "geel",
|
||||
"violet": "violet",
|
||||
"violet": "paars",
|
||||
"orange": "oranje"
|
||||
},
|
||||
"editor": {
|
||||
@@ -850,4 +850,4 @@
|
||||
"reconnected": "Opnieuw verbinding gemaakt met server.",
|
||||
"connectionLost": "De verbinding met de server is verbroken. Probeer opnieuw verbinding te maken..."
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ import { mutations } from "@/store";
|
||||
import { validateLogin } from "@/utils/auth";
|
||||
import i18n from "@/i18n";
|
||||
|
||||
|
||||
const titles = {
|
||||
Login: i18n.global.t("general.login"),
|
||||
Share: i18n.global.t("general.share"),
|
||||
PublicShare: i18n.global.t("general.share"),
|
||||
Files: i18n.global.t("general.files"),
|
||||
Tools: i18n.global.t("general.tool"),
|
||||
Settings: i18n.global.t("general.settings"),
|
||||
@@ -180,11 +180,12 @@ router.beforeResolve(async (to, from, next) => {
|
||||
to.matched.some((record) => record.meta.requiresAuth) ||
|
||||
to.matched.some((record) => record.meta.optionalAuth)
|
||||
) {
|
||||
const isPublicRoute = to.path.startsWith("/public");
|
||||
if (state?.user?.username) {
|
||||
// do nothing, user is already set
|
||||
} else {
|
||||
try {
|
||||
await validateLogin();
|
||||
await validateLogin(isPublicRoute);
|
||||
} catch (error) {
|
||||
mutations.setCurrentUser(getters.anonymous());
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ export interface UserObject {
|
||||
rules?: any[];
|
||||
lockPassword?: boolean;
|
||||
hideDotfiles?: boolean;
|
||||
commands?: string[];
|
||||
sorting?: {
|
||||
by: string;
|
||||
asc: boolean;
|
||||
|
||||
@@ -2,9 +2,12 @@ import { mutations, getters,state } from "@/store";
|
||||
import { getApiPath, getPublicApiPath } from "@/utils/url.js";
|
||||
import { globalVars } from "@/utils/constants";
|
||||
|
||||
export async function validateLogin() {
|
||||
export async function validateLogin(isPublicRoute = false) {
|
||||
// Use direct fetch to avoid automatic logout on 401
|
||||
let apiPath = getPublicApiPath('users', { id: 'self' });
|
||||
// Public routes (e.g. /public/share/...) use the public API base path
|
||||
const apiPath = isPublicRoute
|
||||
? getPublicApiPath('users', { id: 'self' })
|
||||
: getApiPath('/api/users', { id: 'self' });
|
||||
const res = await fetch(apiPath, {
|
||||
credentials: 'same-origin', // Ensure cookies are sent with the request
|
||||
headers: {
|
||||
|
||||
@@ -356,8 +356,7 @@ export default {
|
||||
|
||||
// Display initial data immediately
|
||||
mutations.replaceRequest(file);
|
||||
document.title = `${document.title} - ${file.name}`;
|
||||
|
||||
document.title = globalVars.name + " - " + this.$t("general.share") + " - " + file.name;
|
||||
// Second pass: If directory has metadata available, fetch again with metadata IN THE BACKGROUND
|
||||
if (file.type === "directory" && file.hasMetadata) {
|
||||
this.loadingProgress = 90;
|
||||
@@ -476,7 +475,7 @@ export default {
|
||||
if (state.sources.count > 1) {
|
||||
mutations.setCurrentSource(data.source);
|
||||
}
|
||||
document.title = `${document.title} - ${res.name}`;
|
||||
document.title = globalVars.name + " - " + this.$t("general.files") + " - " + res.name;
|
||||
|
||||
// Display initial data immediately and clear loading spinner
|
||||
mutations.replaceRequest(data);
|
||||
|
||||
@@ -206,31 +206,11 @@ export default {
|
||||
req() {
|
||||
return state.req;
|
||||
},
|
||||
deletedItem() {
|
||||
return state.deletedItem;
|
||||
},
|
||||
disableFileViewer() {
|
||||
return state.shareInfo?.disableFileViewer;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
deletedItem() {
|
||||
if (!state.deletedItem) {
|
||||
return;
|
||||
}
|
||||
this.isDeleted = true;
|
||||
this.listing = null; // Invalidate the listing to force a refresh
|
||||
|
||||
// Let the navigation component handle next/previous logic
|
||||
if (state.navigation.nextLink) {
|
||||
this.$router.replace({ path: state.navigation.nextLink });
|
||||
} else if (state.navigation.previousLink) {
|
||||
this.$router.replace({ path: state.navigation.previousLink });
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
mutations.setDeletedItem(false);
|
||||
},
|
||||
async req() {
|
||||
if (!getters.isLoggedIn()) {
|
||||
return;
|
||||
@@ -257,7 +237,6 @@ export default {
|
||||
} else if (state.req.items) {
|
||||
this.listing = state.req.items;
|
||||
}
|
||||
mutations.setDeletedItem(false);
|
||||
window.addEventListener("keydown", this.keyEvent);
|
||||
this.subtitlesList = await this.subtitles();
|
||||
this.updatePreview();
|
||||
|
||||
Reference in new issue
Block a user