parent
991babb2b5
commit
001c63ad90
|
@ -180,10 +180,11 @@ class ImageController extends GenericApiController
|
||||||
int $id,
|
int $id,
|
||||||
bool $basic = false,
|
bool $basic = false,
|
||||||
bool $current = false,
|
bool $current = false,
|
||||||
|
bool $filepath = false,
|
||||||
bool $tags = false,
|
bool $tags = false,
|
||||||
string $clusters = ''
|
string $clusters = ''
|
||||||
): Http\Response {
|
): Http\Response {
|
||||||
return Util::guardEx(function () use ($id, $basic, $current, $tags, $clusters) {
|
return Util::guardEx(function () use ($id, $basic, $current, $filepath, $tags, $clusters) {
|
||||||
$file = $this->fs->getUserFile($id);
|
$file = $this->fs->getUserFile($id);
|
||||||
|
|
||||||
// Get the image info
|
// Get the image info
|
||||||
|
@ -202,7 +203,8 @@ class ImageController extends GenericApiController
|
||||||
$info['basename'] = $file->getName();
|
$info['basename'] = $file->getName();
|
||||||
|
|
||||||
// Allow these ony for logged in users
|
// Allow these ony for logged in users
|
||||||
if (null !== $this->userSession->getUser()) {
|
$user = $this->userSession->getUser();
|
||||||
|
if (null !== $user) {
|
||||||
// Get list of tags for this file
|
// Get list of tags for this file
|
||||||
if ($tags) {
|
if ($tags) {
|
||||||
$info['tags'] = $this->getTags($id);
|
$info['tags'] = $this->getTags($id);
|
||||||
|
@ -213,6 +215,14 @@ class ImageController extends GenericApiController
|
||||||
$info['current'] = Exif::getExifFromFile($file);
|
$info['current'] = Exif::getExifFromFile($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the path of the file for the current user
|
||||||
|
if ($filepath) {
|
||||||
|
$parts = explode('/', $file->getPath());
|
||||||
|
if (\count($parts) > 3 && $parts[1] === $user->getUID()) {
|
||||||
|
$info['filepath'] = implode('/', \array_slice($parts, 3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get clusters for this file
|
// Get clusters for this file
|
||||||
if ($clusters) {
|
if ($clusters) {
|
||||||
$clist = [];
|
$clist = [];
|
||||||
|
|
|
@ -64,24 +64,30 @@ class OtherController extends GenericApiController
|
||||||
public function getUserConfig(): Http\Response
|
public function getUserConfig(): Http\Response
|
||||||
{
|
{
|
||||||
return Util::guardEx(function () {
|
return Util::guardEx(function () {
|
||||||
$appManager = \OC::$server->get(\OCP\App\IAppManager::class);
|
// get memories version
|
||||||
|
$version = \OC::$server->get(\OCP\App\IAppManager::class)
|
||||||
|
->getAppInfo('memories')['version'];
|
||||||
|
|
||||||
|
// get user if logged in
|
||||||
try {
|
try {
|
||||||
$uid = Util::getUID();
|
$uid = Util::getUID();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$uid = null;
|
$uid = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper function to get user config values
|
||||||
$getAppConfig = function ($key, $default) use ($uid) {
|
$getAppConfig = function ($key, $default) use ($uid) {
|
||||||
return $this->config->getUserValue($uid, Application::APPNAME, $key, $default);
|
return $this->config->getUserValue($uid, Application::APPNAME, $key, $default);
|
||||||
};
|
};
|
||||||
|
|
||||||
return new JSONResponse([
|
return new JSONResponse([
|
||||||
'version' => $appManager->getAppInfo('memories')['version'],
|
// general stuff
|
||||||
|
'version' => $version,
|
||||||
'vod_disable' => Util::getSystemConfig('memories.vod.disable'),
|
'vod_disable' => Util::getSystemConfig('memories.vod.disable'),
|
||||||
'video_default_quality' => Util::getSystemConfig('memories.video_default_quality'),
|
'video_default_quality' => Util::getSystemConfig('memories.video_default_quality'),
|
||||||
'places_gis' => Util::getSystemConfig('memories.gis_type'),
|
'places_gis' => Util::getSystemConfig('memories.gis_type'),
|
||||||
|
|
||||||
|
// enabled apps
|
||||||
'systemtags_enabled' => Util::tagsIsEnabled(),
|
'systemtags_enabled' => Util::tagsIsEnabled(),
|
||||||
'albums_enabled' => Util::albumsIsEnabled(),
|
'albums_enabled' => Util::albumsIsEnabled(),
|
||||||
'recognize_installed' => Util::recognizeIsInstalled(),
|
'recognize_installed' => Util::recognizeIsInstalled(),
|
||||||
|
@ -90,13 +96,21 @@ class OtherController extends GenericApiController
|
||||||
'facerecognition_enabled' => Util::facerecognitionIsEnabled(),
|
'facerecognition_enabled' => Util::facerecognitionIsEnabled(),
|
||||||
'preview_generator_enabled' => Util::previewGeneratorIsEnabled(),
|
'preview_generator_enabled' => Util::previewGeneratorIsEnabled(),
|
||||||
|
|
||||||
|
// general settings
|
||||||
'timeline_path' => $getAppConfig('timelinePath', 'EMPTY'),
|
'timeline_path' => $getAppConfig('timelinePath', 'EMPTY'),
|
||||||
|
'enable_top_memories' => 'true' === $getAppConfig('enableTopMemories', 'true'),
|
||||||
|
|
||||||
|
// viewer settings
|
||||||
|
'livephoto_autoplay' => 'true' === $getAppConfig('livephotoAutoplay', 'true'),
|
||||||
|
'sidebar_filepath' => 'true' === $getAppConfig('sidebarFilepath', false),
|
||||||
|
|
||||||
|
// folder settings
|
||||||
'folders_path' => $getAppConfig('foldersPath', '/'),
|
'folders_path' => $getAppConfig('foldersPath', '/'),
|
||||||
'show_hidden_folders' => 'true' === $getAppConfig('showHidden', false),
|
'show_hidden_folders' => 'true' === $getAppConfig('showHidden', false),
|
||||||
'sort_folder_month' => 'true' === $getAppConfig('sortFolderMonth', false),
|
'sort_folder_month' => 'true' === $getAppConfig('sortFolderMonth', false),
|
||||||
|
|
||||||
|
// album settings
|
||||||
'sort_album_month' => 'true' === $getAppConfig('sortAlbumMonth', 'true'),
|
'sort_album_month' => 'true' === $getAppConfig('sortAlbumMonth', 'true'),
|
||||||
'enable_top_memories' => 'true' === $getAppConfig('enableTopMemories', 'true'),
|
|
||||||
'livephoto_autoplay' => 'true' === $getAppConfig('livephotoAutoplay', 'true'),
|
|
||||||
], Http::STATUS_OK);
|
], Http::STATUS_OK);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,9 +153,9 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.imageInfo) {
|
if (this.filepath) {
|
||||||
list.push({
|
list.push({
|
||||||
title: this.imageInfo,
|
title: this.filepath,
|
||||||
subtitle: this.imageInfoSub,
|
subtitle: this.imageInfoSub,
|
||||||
icon: ImageIcon,
|
icon: ImageIcon,
|
||||||
});
|
});
|
||||||
|
@ -287,8 +287,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Image info */
|
/** Image info */
|
||||||
imageInfo(): string | null {
|
filepath(): string | null {
|
||||||
return this.baseInfo.basename;
|
return this.baseInfo.filepath ?? this.baseInfo.basename;
|
||||||
},
|
},
|
||||||
|
|
||||||
imageInfoSub(): string[] {
|
imageInfoSub(): string[] {
|
||||||
|
@ -382,10 +382,11 @@ export default defineComponent({
|
||||||
.join(',');
|
.join(',');
|
||||||
|
|
||||||
// get tags if enabled
|
// get tags if enabled
|
||||||
const tags = this.config.systemtags_enabled ? 1 : 0;
|
const tags = Number(this.config.systemtags_enabled);
|
||||||
|
const filepath = Number(this.config.sidebar_filepath);
|
||||||
|
|
||||||
// get image info
|
// get image info
|
||||||
const url = API.Q(utils.getImageInfoUrl(photo), { tags, clusters });
|
const url = API.Q(utils.getImageInfoUrl(photo), { tags, clusters, filepath });
|
||||||
const res = await this.guardState(axios.get<IImageInfo>(url));
|
const res = await this.guardState(axios.get<IImageInfo>(url));
|
||||||
if (!res) return null;
|
if (!res) return null;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,9 @@
|
||||||
>
|
>
|
||||||
{{ t('memories', 'Show past photos on top of timeline') }}
|
{{ t('memories', 'Show past photos on top of timeline') }}
|
||||||
</NcCheckboxRadioSwitch>
|
</NcCheckboxRadioSwitch>
|
||||||
|
</NcAppSettingsSection>
|
||||||
|
|
||||||
|
<NcAppSettingsSection id="viewer-settings" :title="t('memories', 'Viewer')">
|
||||||
<NcCheckboxRadioSwitch
|
<NcCheckboxRadioSwitch
|
||||||
:checked.sync="config.livephoto_autoplay"
|
:checked.sync="config.livephoto_autoplay"
|
||||||
@update:checked="updateLivephotoAutoplay"
|
@update:checked="updateLivephotoAutoplay"
|
||||||
|
@ -68,6 +70,14 @@
|
||||||
>
|
>
|
||||||
{{ t('memories', 'Always load full size image (not recommended)') }}
|
{{ t('memories', 'Always load full size image (not recommended)') }}
|
||||||
</NcCheckboxRadioSwitch>
|
</NcCheckboxRadioSwitch>
|
||||||
|
|
||||||
|
<NcCheckboxRadioSwitch
|
||||||
|
:checked.sync="config.sidebar_filepath"
|
||||||
|
@update:checked="updateSidebarFilepath"
|
||||||
|
type="switch"
|
||||||
|
>
|
||||||
|
{{ t('memories', 'Show full file path in sidebar') }}
|
||||||
|
</NcCheckboxRadioSwitch>
|
||||||
</NcAppSettingsSection>
|
</NcAppSettingsSection>
|
||||||
|
|
||||||
<NcAppSettingsSection id="account-settings" :title="t('memories', 'Account')" v-if="isNative">
|
<NcAppSettingsSection id="account-settings" :title="t('memories', 'Account')" v-if="isNative">
|
||||||
|
@ -197,6 +207,7 @@ export default defineComponent({
|
||||||
this.$emit('update:open', false);
|
this.$emit('update:open', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Paths settings
|
||||||
async chooseTimelinePath() {
|
async chooseTimelinePath() {
|
||||||
(<any>this.$refs.multiPathModal).open(this.config.timeline_path.split(';'));
|
(<any>this.$refs.multiPathModal).open(this.config.timeline_path.split(';'));
|
||||||
},
|
},
|
||||||
|
@ -223,10 +234,16 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// General settings
|
||||||
async updateSquareThumbs() {
|
async updateSquareThumbs() {
|
||||||
await this.updateSetting('square_thumbs');
|
await this.updateSetting('square_thumbs');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async updateEnableTopMemories() {
|
||||||
|
await this.updateSetting('enable_top_memories', 'enableTopMemories');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Viewer settings
|
||||||
async updateFullResOnZoom() {
|
async updateFullResOnZoom() {
|
||||||
await this.updateSetting('full_res_on_zoom');
|
await this.updateSetting('full_res_on_zoom');
|
||||||
},
|
},
|
||||||
|
@ -235,14 +252,15 @@ export default defineComponent({
|
||||||
await this.updateSetting('full_res_always');
|
await this.updateSetting('full_res_always');
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateEnableTopMemories() {
|
|
||||||
await this.updateSetting('enable_top_memories', 'enableTopMemories');
|
|
||||||
},
|
|
||||||
|
|
||||||
async updateLivephotoAutoplay() {
|
async updateLivephotoAutoplay() {
|
||||||
await this.updateSetting('livephoto_autoplay', 'livephotoAutoplay');
|
await this.updateSetting('livephoto_autoplay', 'livephotoAutoplay');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async updateSidebarFilepath() {
|
||||||
|
await this.updateSetting('sidebar_filepath', 'sidebarFilepath');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Folders settings
|
||||||
async updateShowHidden() {
|
async updateShowHidden() {
|
||||||
await this.updateSetting('show_hidden_folders', 'showHidden');
|
await this.updateSetting('show_hidden_folders', 'showHidden');
|
||||||
},
|
},
|
||||||
|
@ -251,6 +269,7 @@ export default defineComponent({
|
||||||
await this.updateSetting('sort_folder_month', 'sortFolderMonth');
|
await this.updateSetting('sort_folder_month', 'sortFolderMonth');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Albums settings
|
||||||
async updateSortAlbumMonth() {
|
async updateSortAlbumMonth() {
|
||||||
await this.updateSetting('sort_album_month', 'sortAlbumMonth');
|
await this.updateSetting('sort_album_month', 'sortAlbumMonth');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ export default defineComponent({
|
||||||
* Open the files app with the current file.
|
* Open the files app with the current file.
|
||||||
*/
|
*/
|
||||||
async viewInFolder() {
|
async viewInFolder() {
|
||||||
if (this.currentPhoto) dav.viewInFolder(this.currentPhoto);
|
dav.viewInFolder(this.currentPhoto!);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { dirname } from 'path';
|
||||||
* Opens a new window.
|
* Opens a new window.
|
||||||
*/
|
*/
|
||||||
export async function viewInFolder(photo: IPhoto) {
|
export async function viewInFolder(photo: IPhoto) {
|
||||||
|
if (!photo) return;
|
||||||
const f = await getFiles([photo]);
|
const f = await getFiles([photo]);
|
||||||
if (f.length === 0) return;
|
if (f.length === 0) return;
|
||||||
|
|
||||||
|
|
|
@ -97,11 +97,13 @@ class StaticConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
const config: IConfig = {
|
const config: IConfig = {
|
||||||
|
// general stuff
|
||||||
version: '',
|
version: '',
|
||||||
vod_disable: false,
|
vod_disable: false,
|
||||||
video_default_quality: '0',
|
video_default_quality: '0',
|
||||||
places_gis: -1,
|
places_gis: -1,
|
||||||
|
|
||||||
|
// enabled apps
|
||||||
systemtags_enabled: false,
|
systemtags_enabled: false,
|
||||||
albums_enabled: false,
|
albums_enabled: false,
|
||||||
recognize_installed: false,
|
recognize_installed: false,
|
||||||
|
@ -110,14 +112,23 @@ class StaticConfig {
|
||||||
facerecognition_enabled: false,
|
facerecognition_enabled: false,
|
||||||
preview_generator_enabled: false,
|
preview_generator_enabled: false,
|
||||||
|
|
||||||
|
// general settings
|
||||||
timeline_path: '',
|
timeline_path: '',
|
||||||
|
enable_top_memories: true,
|
||||||
|
|
||||||
|
// viewer settings
|
||||||
|
livephoto_autoplay: true,
|
||||||
|
sidebar_filepath: false,
|
||||||
|
|
||||||
|
// folder settings
|
||||||
folders_path: '',
|
folders_path: '',
|
||||||
show_hidden_folders: false,
|
show_hidden_folders: false,
|
||||||
sort_folder_month: false,
|
sort_folder_month: false,
|
||||||
sort_album_month: true,
|
|
||||||
enable_top_memories: true,
|
|
||||||
livephoto_autoplay: true,
|
|
||||||
|
|
||||||
|
// album settings
|
||||||
|
sort_album_month: true,
|
||||||
|
|
||||||
|
// local settings
|
||||||
square_thumbs: false,
|
square_thumbs: false,
|
||||||
full_res_on_zoom: true,
|
full_res_on_zoom: true,
|
||||||
full_res_always: false,
|
full_res_always: false,
|
||||||
|
|
18
src/types.ts
18
src/types.ts
|
@ -100,6 +100,7 @@ export interface IImageInfo {
|
||||||
tags: { [id: string]: string };
|
tags: { [id: string]: string };
|
||||||
|
|
||||||
permissions: string;
|
permissions: string;
|
||||||
|
filepath?: string;
|
||||||
basename: string;
|
basename: string;
|
||||||
mimetype: string;
|
mimetype: string;
|
||||||
size: number;
|
size: number;
|
||||||
|
@ -230,11 +231,13 @@ export type ITick = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type IConfig = {
|
export type IConfig = {
|
||||||
|
// general stuff
|
||||||
version: string;
|
version: string;
|
||||||
vod_disable: boolean;
|
vod_disable: boolean;
|
||||||
video_default_quality: string;
|
video_default_quality: string;
|
||||||
places_gis: number;
|
places_gis: number;
|
||||||
|
|
||||||
|
// enabled apps
|
||||||
systemtags_enabled: boolean;
|
systemtags_enabled: boolean;
|
||||||
albums_enabled: boolean;
|
albums_enabled: boolean;
|
||||||
recognize_installed: boolean;
|
recognize_installed: boolean;
|
||||||
|
@ -243,14 +246,23 @@ export type IConfig = {
|
||||||
facerecognition_enabled: boolean;
|
facerecognition_enabled: boolean;
|
||||||
preview_generator_enabled: boolean;
|
preview_generator_enabled: boolean;
|
||||||
|
|
||||||
|
// general settings
|
||||||
timeline_path: string;
|
timeline_path: string;
|
||||||
|
enable_top_memories: boolean;
|
||||||
|
|
||||||
|
// viewer settings
|
||||||
|
livephoto_autoplay: boolean;
|
||||||
|
sidebar_filepath: boolean;
|
||||||
|
|
||||||
|
// folder settings
|
||||||
folders_path: string;
|
folders_path: string;
|
||||||
show_hidden_folders: boolean;
|
show_hidden_folders: boolean;
|
||||||
sort_folder_month: boolean;
|
sort_folder_month: boolean;
|
||||||
sort_album_month: boolean;
|
|
||||||
enable_top_memories: boolean;
|
|
||||||
livephoto_autoplay: boolean;
|
|
||||||
|
|
||||||
|
// album settings
|
||||||
|
sort_album_month: boolean;
|
||||||
|
|
||||||
|
// local settings
|
||||||
square_thumbs: boolean;
|
square_thumbs: boolean;
|
||||||
full_res_on_zoom: boolean;
|
full_res_on_zoom: boolean;
|
||||||
full_res_always: boolean;
|
full_res_always: boolean;
|
||||||
|
|
Loading…
Reference in New Issue