Compare commits

..

No commits in common. "master" and "gh-pages" have entirely different histories.

671 changed files with 21922 additions and 106822 deletions

1
.gitattributes vendored
View File

@ -1 +0,0 @@
l10n/** linguist-vendored

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
github: [pulsejet]

View File

@ -1,48 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: needs triage
assignees: ''
---
<!--
**🛑 READ THE FOLLOWING BEFORE YOU CONTINUE! 🛑**
All bug reports *must* follow the issue template below.
If it is a help request, you might want to try the [Discord community](https://discord.gg/7Dr9f9vNjJ) first.
Make the following items are true before filing a bug:
- You are using the latest version of the app.
- You tried and can replicate the bug.
- You have followed the [configuration steps](https://memories.gallery/config/).
- You have looked at the [troubleshooting](https://memories.gallery/troubleshooting/) documentation.
- You have searched the [open issues](https://github.com/pulsejet/memories/issues)
-->
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Platform:**
- OS: [e.g. iOS]
- Browser: [e.g. Chrome, Safari]
- Memories Version: [e.g. 4.1.0]
- Nextcloud Version: [e.g. 25.0.6]
- PHP Version: [e.g. 8.1]
**Additional context**
Add any other context about the problem here.
- Any errors in the JS console?
- Any errors in the Nextcloud server logs?

View File

@ -1,6 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Discord Community
url: https://discord.gg/7Dr9f9vNjJ
about: Please ask and answer questions here.

View File

@ -1,19 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -1,34 +0,0 @@
name: docs
on:
push:
branches:
- master
paths:
- 'docs/**'
- 'CHANGELOG.md'
- 'mkdocs.yml'
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- name: Build documentation
run: |
cp CHANGELOG.md docs/changelog.md
sed -n '/DEFAULTS = \[/,/];/p' lib/Settings/SystemConfig.php | sed 's/^ //' > docs/system-config.php
pip install mkdocs-material pillow cairosvg
mkdocs gh-deploy --force

View File

@ -1,241 +0,0 @@
name: e2e
on:
push:
branches:
- master
- pulsejet/*
paths-ignore:
- 'docs/**'
- 'go-vod/**'
- 'android/**'
- 'mkdocs.yml'
- '**.md'
env:
APP_NAME: memories
PHP_CLI_SERVER_WORKERS: 8
jobs:
vue:
runs-on: ubuntu-latest
steps:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Checkout the app
uses: actions/checkout@v4
- name: Build vue app
run: |
make dev-setup
make patch-external
make build-js-production
zip -r vue.zip js/
- uses: actions/upload-artifact@v3
with:
name: vue.zip
path: vue.zip
mysql:
runs-on: ubuntu-latest
needs: vue
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['8.1']
server-versions: ['stable27']
services:
mysql:
image: mariadb:10.5
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Checkout server
uses: actions/checkout@v4
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout the app
uses: actions/checkout@v4
with:
path: apps/${{ env.APP_NAME }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/download-artifact@v2
with:
name: vue.zip
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
coverage: none
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
php occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
git clone --depth 1 --branch ${{ matrix.server-versions }} https://github.com/nextcloud/viewer apps/viewer
- name: Run tests
run: |
./apps/memories/scripts/ci-test.sh
- uses: actions/upload-artifact@v3
if: always()
with:
name: report-mysql-${{ matrix.php-versions }}-${{ matrix.server-versions }}
path: apps/${{ env.APP_NAME }}/playwright-report
pgsql:
runs-on: ubuntu-latest
needs: vue
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['8.1']
server-versions: ['stable27']
services:
postgres:
image: postgres
ports:
- 4444:5432/tcp
env:
POSTGRES_DB: nextcloud
POSTGRES_PASSWORD: rootpassword
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout server
uses: actions/checkout@v4
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout the app
uses: actions/checkout@v4
with:
path: apps/${{ env.APP_NAME }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/download-artifact@v2
with:
name: vue.zip
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
coverage: none
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
php occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=postgres --database-pass=rootpassword --admin-user admin --admin-pass password
git clone --depth 1 --branch ${{ matrix.server-versions }} https://github.com/nextcloud/viewer apps/viewer
- name: Run tests
run: |
./apps/memories/scripts/ci-test.sh
- uses: actions/upload-artifact@v3
if: always()
with:
name: report-pgsql-${{ matrix.php-versions }}-${{ matrix.server-versions }}
path: apps/${{ env.APP_NAME }}/playwright-report
sqlite:
runs-on: ubuntu-latest
needs: vue
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['8.1']
server-versions: ['stable27']
steps:
- name: Checkout server
uses: actions/checkout@v4
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout the app
uses: actions/checkout@v4
with:
path: apps/${{ env.APP_NAME }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/download-artifact@v2
with:
name: vue.zip
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
coverage: none
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
php occ maintenance:install --verbose --admin-user admin --admin-pass password
git clone --depth 1 --branch ${{ matrix.server-versions }} https://github.com/nextcloud/viewer apps/viewer
- name: Run tests
run: |
./apps/memories/scripts/ci-test.sh
- uses: actions/upload-artifact@v3
if: always()
with:
name: report-sqlite-${{ matrix.php-versions }}-${{ matrix.server-versions }}
path: apps/${{ env.APP_NAME }}/playwright-report

View File

@ -1,70 +0,0 @@
name: go-vod
on:
push:
tags:
- "go-vod/*"
jobs:
binary:
name: Binary
runs-on: ubuntu-latest
container:
image: golang:1.20-bullseye
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
working-directory: go-vod
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -ldflags="-s -w" -o go-vod-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -buildvcs=false -ldflags="-s -w" -o go-vod-aarch64
- name: Upload to releases
uses: svenstaro/upload-release-action@v2
id: attach_to_release
with:
file: go-vod/go-vod-*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
make_latest: false
docker:
runs-on: ubuntu-latest
name: Docker
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get image label
id: image_label
run: echo "label=${GITHUB_REF#refs/tags/go-vod/}" >> $GITHUB_OUTPUT
- name: Build container image
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
context: './go-vod/'
no-cache: true
file: './go-vod/Dockerfile'
tags: radialapps/go-vod:${{ steps.image_label.outputs.label }} , radialapps/go-vod:latest
provenance: false

View File

@ -1,48 +0,0 @@
name: release
on:
release:
types: [published]
env:
APP_NAME: memories
jobs:
publish:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Build
run: |
make dev-setup
make patch-external
make build-js-production
./scripts/bundle.sh
- name: Upload app tarball to release
uses: svenstaro/upload-release-action@v2
id: attach_to_release
with:
file: memories.tar.gz
asset_name: memories.tar.gz
tag: ${{ github.ref }}
overwrite: true
- name: Upload app to Nextcloud appstore
uses: R0Wi/nextcloud-appstore-push-action@v1
with:
app_name: ${{ env.APP_NAME }}
appstore_token: ${{ secrets.APPSTORE_TOKEN }}
download_url: ${{ steps.attach_to_release.outputs.browser_download_url }}
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
nightly: ${{ github.event.release.prerelease }}

View File

@ -1,75 +0,0 @@
---
name: static analysis
on:
push:
paths-ignore:
- 'docs/**'
- 'go-vod/**'
- 'android/**'
- 'mkdocs.yml'
- '**.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'go-vod/**'
- 'android/**'
- 'mkdocs.yml'
- '**.md'
jobs:
php-lint:
name: PHP Lint
runs-on: ubuntu-latest
steps:
- name: Checkout server
uses: actions/checkout@v4
with:
submodules: true
repository: nextcloud/server
ref: stable27
- name: Checkout the app
uses: actions/checkout@v4
with:
path: apps/memories
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl
coverage: none
- name: Install dependencies
working-directory: apps/memories
run: |
make install-tools
- name: Run PHP-CS-Fixer
if: ${{ ! cancelled() }}
working-directory: apps/memories
run: |
vendor/bin/php-cs-fixer fix --dry-run --diff
- name: Run Psalm
if: ${{ ! cancelled() }}
working-directory: apps/memories
run: |
vendor/bin/psalm --no-cache --shepherd --stats --threads=max lib
vue-lint:
name: Vue Lint
runs-on: ubuntu-latest
steps:
- name: Checkout the app
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Run vue-tsc
run: npx vue-tsc --noEmit --skipLibCheck
- name: Run Prettier
run: npx prettier src --check

30
.gitignore vendored
View File

@ -1,30 +0,0 @@
.DS_Store
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
js/
*.tsbuildinfo
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
.vscode/launch.json
.marginalia
build/
coverage/
.php_cs.cache
.php-cs-fixer.cache
vendor
memories.tar.gz
/test-results/
/playwright-report/
/playwright/.cache/
.cache/
bin-ext/

View File

@ -1,2 +0,0 @@
js/
docs/

View File

@ -1 +0,0 @@
node_modules

View File

@ -1,43 +0,0 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
$finder = PhpCsFixer\Finder::create()
->ignoreDotFiles(false)
->ignoreVCSIgnored(true)
->in(__DIR__.'/lib')
;
$config = new PhpCsFixer\Config();
$config
->setUsingCache(true)
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead
'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'template-implements', 'var']],
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'parameters', 'arguments']],
'modernize_strpos' => true,
'no_alias_functions' => true,
'array_syntax' => ['syntax' => 'short'],
'ternary_to_elvis_operator' => true,
'ternary_to_null_coalescing' => true,
'return_assignment' => true,
'declare_strict_types' => true,
'strict_param' => true,
])
->setFinder($finder)
;
return $config;

View File

@ -1,4 +0,0 @@
{
"printWidth": 120,
"singleQuote": true
}

View File

@ -1,10 +0,0 @@
[main]
host = https://www.transifex.com
lang_map = bg_BG: bg, cs_CZ: cs, fi_FI: fi, hu_HU: hu, nb_NO: nb, sk_SK: sk, th_TH: th, ja_JP: ja
[o:nextcloud:p:nextcloud:r:memories]
file_filter = translationfiles/<lang>/memories.po
source_file = translationfiles/templates/memories.pot
source_lang = en
type = PO

View File

@ -1,10 +0,0 @@
{
"recommendations": [
"bmewburn.vscode-intelephense-client",
"muuvmuuv.vscode-just-php-cs-fixer",
"getpsalm.psalm-vscode-plugin",
"esbenp.prettier-vscode",
"Vue.volar",
"Vue.vscode-typescript-vue-plugin"
]
}

104
.vscode/settings.json vendored
View File

@ -1,104 +0,0 @@
{
"intelephense.stubs": [
"apache",
"bcmath",
"bz2",
"calendar",
"com_dotnet",
"Core",
"ctype",
"curl",
"date",
"dba",
"dom",
"enchant",
"exif",
"FFI",
"fileinfo",
"filter",
"fpm",
"ftp",
"gd",
"gettext",
"gmp",
"hash",
"iconv",
"imap",
"intl",
"json",
"ldap",
"libxml",
"mbstring",
"meta",
"mysqli",
"oci8",
"odbc",
"openssl",
"pcntl",
"pcre",
"PDO",
"pdo_ibm",
"pdo_mysql",
"pdo_pgsql",
"pdo_sqlite",
"pgsql",
"Phar",
"posix",
"pspell",
"random",
"readline",
"Reflection",
"session",
"shmop",
"SimpleXML",
"snmp",
"soap",
"sockets",
"sodium",
"SPL",
"sqlite3",
"standard",
"superglobals",
"sysvmsg",
"sysvsem",
"sysvshm",
"tidy",
"tokenizer",
"xml",
"xmlreader",
"xmlrpc",
"xmlwriter",
"xsl",
"Zend OPcache",
"zip",
"zlib",
"imagick"
],
"intelephense.environment.phpVersion": "8.0.0",
"intelephense.environment.documentRoot": "${workspaceFolder}/../../",
"php-cs-fixer.allow-risky": true,
"psalm.disableAutoComplete": true,
"[php]": {
"editor.defaultFormatter": "muuvmuuv.vscode-just-php-cs-fixer"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"files.trimTrailingWhitespace": false,
"editor.formatOnSave": false,
},
"search.exclude": {
"**/l10n": true,
"**/.vscode": true,
"**/patches": true
},
"git.alwaysSignOff": true,
"editor.formatOnSave": true,
"psalm.configPaths": [
"psalm-ls.xml"
],
}

767
404.html 100644
View File

@ -0,0 +1,767 @@
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="/assets/favicon.ico">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.3">
<title>Memories</title>
<link rel="stylesheet" href="/assets/stylesheets/main.50c56a3b.min.css">
<link rel="stylesheet" href="/assets/stylesheets/palette.06af60db.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<script>__md_scope=new URL("/",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="blue" data-md-color-accent="indigo">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
</div>
<div data-md-component="announce">
</div>
<header class="md-header md-header--shadow md-header--lifted" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="/." title="Memories" class="md-header__button md-logo" aria-label="Memories" data-md-component="logo">
<img src="/assets/app.svg" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Memories
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="blue" data-md-color-accent="indigo" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_0">
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"/></svg>
</label>
<input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="blue" data-md-color-accent="indigo" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_0" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12c0-2.42-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"/></svg>
</label>
</form>
<script>var media,input,key,value,palette=__md_get("__palette");if(palette&&palette.color){"(prefers-color-scheme)"===palette.color.media&&(media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']"),palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent"));for([key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/pulsejet/memories" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
pulsejet/memories
</div>
</a>
</div>
</nav>
<nav class="md-tabs" aria-label="Tabs" data-md-component="tabs">
<div class="md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item">
<a href="/." class="md-tabs__link">
Home
</a>
</li>
<li class="md-tabs__item">
<a href="/install/" class="md-tabs__link">
Getting started
</a>
</li>
<li class="md-tabs__item">
<a href="/faq/" class="md-tabs__link">
Support
</a>
</li>
</ul>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="/." title="Memories" class="md-nav__button md-logo" aria-label="Memories" data-md-component="logo">
<img src="/assets/app.svg" alt="logo">
</a>
Memories
</label>
<div class="md-nav__source">
<a href="https://github.com/pulsejet/memories" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
pulsejet/memories
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="/." class="md-nav__link">
<span class="md-ellipsis">
Home
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2" >
<label class="md-nav__link" for="__nav_2" id="__nav_2_label" tabindex="">
<span class="md-ellipsis">
Getting started
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_2">
<span class="md-nav__icon md-icon"></span>
Getting started
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="/install/" class="md-nav__link">
<span class="md-ellipsis">
Installation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/config/" class="md-nav__link">
<span class="md-ellipsis">
Configuration
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/file-types/" class="md-nav__link">
<span class="md-ellipsis">
File Type Support
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/hw-transcoding/" class="md-nav__link">
<span class="md-ellipsis">
Hardware Transcoding
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/troubleshooting/" class="md-nav__link">
<span class="md-ellipsis">
Troubleshooting
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/system-config/" class="md-nav__link">
<span class="md-ellipsis">
config.php options
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/occ-commands/" class="md-nav__link">
<span class="md-ellipsis">
OCC commands
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="">
<span class="md-ellipsis">
Support
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
Support
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="/faq/" class="md-nav__link">
<span class="md-ellipsis">
Help and FAQ
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/changelog/" class="md-nav__link">
<span class="md-ellipsis">
Changelog
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/memories-vs-photos/" class="md-nav__link">
<span class="md-ellipsis">
Memories vs Photos
</span>
</a>
</li>
<li class="md-nav__item">
<a href="/privacy/" class="md-nav__link">
<span class="md-ellipsis">
Privacy
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1>404 - Not found</h1>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
<div class="md-copyright__highlight">
Copyright &copy; 2022 - 2023 <a href="https://github.com/pulsejet">Varun Patil</a>
</div>
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
<div class="md-social">
<a href="https://discord.gg/7Dr9f9vNjJ" target="_blank" rel="noopener" title="discord.gg" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M524.531 69.836a1.5 1.5 0 0 0-.764-.7A485.065 485.065 0 0 0 404.081 32.03a1.816 1.816 0 0 0-1.923.91 337.461 337.461 0 0 0-14.9 30.6 447.848 447.848 0 0 0-134.426 0 309.541 309.541 0 0 0-15.135-30.6 1.89 1.89 0 0 0-1.924-.91 483.689 483.689 0 0 0-119.688 37.107 1.712 1.712 0 0 0-.788.676C39.068 183.651 18.186 294.69 28.43 404.354a2.016 2.016 0 0 0 .765 1.375 487.666 487.666 0 0 0 146.825 74.189 1.9 1.9 0 0 0 2.063-.676A348.2 348.2 0 0 0 208.12 430.4a1.86 1.86 0 0 0-1.019-2.588 321.173 321.173 0 0 1-45.868-21.853 1.885 1.885 0 0 1-.185-3.126 251.047 251.047 0 0 0 9.109-7.137 1.819 1.819 0 0 1 1.9-.256c96.229 43.917 200.41 43.917 295.5 0a1.812 1.812 0 0 1 1.924.233 234.533 234.533 0 0 0 9.132 7.16 1.884 1.884 0 0 1-.162 3.126 301.407 301.407 0 0 1-45.89 21.83 1.875 1.875 0 0 0-1 2.611 391.055 391.055 0 0 0 30.014 48.815 1.864 1.864 0 0 0 2.063.7A486.048 486.048 0 0 0 610.7 405.729a1.882 1.882 0 0 0 .765-1.352c12.264-126.783-20.532-236.912-86.934-334.541ZM222.491 337.58c-28.972 0-52.844-26.587-52.844-59.239s23.409-59.241 52.844-59.241c29.665 0 53.306 26.82 52.843 59.239 0 32.654-23.41 59.241-52.843 59.241Zm195.38 0c-28.971 0-52.843-26.587-52.843-59.239s23.409-59.241 52.843-59.241c29.667 0 53.307 26.82 52.844 59.239 0 32.654-23.177 59.241-52.844 59.241Z"/></svg>
</a>
<a href="https://github.com/pulsejet/memories" target="_blank" rel="noopener" title="github.com" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</a>
<a href="https://help.nextcloud.com/c/apps/memories/" target="_blank" rel="noopener" title="help.nextcloud.com" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M225.9 32C103.3 32 0 130.5 0 252.1 0 256 .1 480 .1 480l225.8-.2c122.7 0 222.1-102.3 222.1-223.9C448 134.3 348.6 32 225.9 32zM224 384c-19.4 0-37.9-4.3-54.4-12.1L88.5 392l22.9-75c-9.8-18.1-15.4-38.9-15.4-61 0-70.7 57.3-128 128-128s128 57.3 128 128-57.3 128-128 128z"/></svg>
</a>
<a href="https://play.google.com/store/apps/details?id=gallery.memories" target="_blank" rel="noopener" title="play.google.com" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M325.3 234.3 104.6 13l280.8 161.2-60.1 60.1zM47 0C34 6.8 25.3 19.2 25.3 35.3v441.3c0 16.1 8.7 28.5 21.7 35.3l256.6-256L47 0zm425.2 225.6-58.9-34.1-65.7 64.5 65.7 64.5 60.1-34.1c18-14.3 18-46.5-1.2-60.8zM104.6 499l280.8-161.2-60.1-60.1L104.6 499z"/></svg>
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "/", "features": ["navigation.tabs", "navigation.tabs.sticky", "navigation.tracking", "content.action.edit"], "search": "/assets/javascripts/workers/search.f886a092.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="/assets/javascripts/bundle.d7c377c4.min.js"></script>
</body>
</html>

View File

@ -1,376 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
## [v6.2.2] - 2024-01-10
- Hotfix for a bug in request pipelining.
## [v6.2.0] - 2024-01-09
- Nextcloud 28 compatibility
- Various bug fixes
## [v6.1.5] - 2023-11-25
- Hotfix in service worker caching strategy.
## [v6.1.1] - 2023-11-24
- This is an off-cycle hotfix release for some bugs in v6.1.0 ([see](https://github.com/pulsejet/memories/milestone/19?closed=1)).
- **Breaking**: The CUDA scaler is now the default for NVENC. You may need to reconfigure your transcoder. (see [#582](https://github.com/pulsejet/memories/issues/582))
- This release also cuts down a lot of weirdness and improves the usage of dependencies significantly.
## [v6.1.0] - 2023-11-15
- **Feature**: RAW files are now hidden (stacked) when another file with the same basename exists ([#537](https://github.com/pulsejet/memories/issues/537), [#152](https://github.com/pulsejet/memories/issues/152), [#419](https://github.com/pulsejet/memories/issues/419))
- **Feature**: Multiple files can be now selected and shared from the timeline ([#472](https://github.com/pulsejet/memories/issues/472), [#901](https://github.com/pulsejet/memories/issues/901))
- **Feature**: Bulk rotating of images. You can now rotate images losslessly by editing the rotation EXIF metadata. ([#856](https://github.com/pulsejet/memories/issues/856))
- **Feature**: Icon animation when playing live photos ([#898](https://github.com/pulsejet/memories/issues/898))
- **Feature**: Swipe to refresh on timeline ([#547](https://github.com/pulsejet/memories/issues/547))
- **Bugfix**: Allow switching video to direct on Safari ([#650](https://github.com/pulsejet/memories/issues/650))
- Many other [bug fixes](https://github.com/pulsejet/memories/milestone/18?closed=1)
- Android app is now open source ([see](https://github.com/pulsejet/memories/tree/master/android))
## [v6.0.1] - 2023-10-27
- Bug fixes in video streaming.
## [v6.0.0] - 2023-10-25
- This release focuses on improvements in code quality, maintainability and [documentation](https://memories.gallery/install/).
- New CI/CD [jobs](https://github.com/pulsejet/memories/actions/workflows/static-analysis.yaml) for type checking with [Psalm](https://psalm.dev/) and [vue-tsc](https://www.npmjs.com/package/vue-tsc)
- Vue templates are now checked and largely type-safe
- The backend now has native type coverage with PHP 8 type hints. This unearthed multiple bugs that are now fixed.
- [Developing](https://github.com/pulsejet/memories/#-development-setup) is now easier for new contributors
- **Breaking**: Nextcloud 26+ and PHP 8.0 are now required.
- **Breaking**: The directory containing the `exiftool` and `go-vod` binaries was renamed from `exiftool-bin` to `bin-ext`
- **Feature**: External transcoders are much easier to set up now. See [docs](https://memories.gallery/hw-transcoding) for details.
- **Feature**: Folders view in shares ([#880](https://github.com/pulsejet/memories/pull/880))
- **Feature**: Improved back button navigation on mobile ([#861](https://github.com/pulsejet/memories/issues/861)).
- **Feature**: The transcoding quality factor can now be configured from the admin panel.
## [v5.5.0] - 2023-10-06
- **Important**: This update runs some slow database migrations. It is recommended to upgrade using the CLI (`occ upgrade`) instead of the web interface.
- **Important**: This version corrects some errors in indexing and indexes some new EXIF fields. It is recommended to run `occ memories:index -f` after upgrading.
- **Breaking**: Files in hidden folders are now hidden in the timeline ([#825](https://github.com/pulsejet/memories/issues/825))
- **Feature**: An Android app is now available with early access (https://play.google.com/store/apps/details?id=gallery.memories). Memories v5.5+ is required.
- **Feature**: Support showing full file path in sidebar ([#173](https://github.com/pulsejet/memories/issues/173))
- **Feature**: View file in folder on clicking name in sidebar
- **Feature**: User can leave albums that are shared with them
- **Feature**: Admin can now configure default behavior of loading high resolution image in viewer ([#672](https://github.com/pulsejet/memories/pull/672))
- **Feature**: Shared videos will now be transcoded to be smaller in size
- **Feature**: Confirmation box on deletion ([#798](https://github.com/pulsejet/memories/issues/798))
- **Feature**: Prompt on editing metadata if date will be lost
- **Feature**: Allow changing binary temp directory ([#821](https://github.com/pulsejet/memories/issues/821))
- **Feature**: Support for Samsung HEIC Motion Photos on newer devices
- **Fix**: Support for transcoding MKV files.
## [v5.4.1] - 2023-08-20
- Corrects a versioning error. This version is the same as v5.3.0
## [v5.3.0] - 2023-08-20
- **Feature**: Allow adding photos to multiple albums together ([#752](https://github.com/pulsejet/memories/pull/752))
- **Feature**: Improved layout for albums list view
- **Feature**: Search bar for album picker when adding to album.
- **Feature**: Show albums of photo in metadata ([#752](https://github.com/pulsejet/memories/pull/752))
- **Feature**: Show faces in photo in sidebar metadata
- **Feature**: Allow creation of new tags when editing metadata ([#487](https://github.com/pulsejet/memories/issues/487))
- **Feature**: Allow disabling autoplay of live photo ([#591](https://github.com/pulsejet/memories/issues/591))
- **Feature**: Improvements in admin interface
- **Feature**: A `.nomemories` file will now hide a folder from Memories without affecting other apps ([#777](https://github.com/pulsejet/memories/issues/777))
- **Feature**: More crop options for image editor ([#546](https://github.com/pulsejet/memories/issues/546))
- **Bugfix**: You can now configure the transpose strategy of the transcoder (required for QSV)
## [v5.2.1] - 2023-07-03
- **Feature**: Allow moving unclustered faces to a cluster with Recognize (v4.2.0+)
## [v5.2.0] - 2023-06-30
**Note:** You will need to run `occ memories:places-setup --recalculate` to re-index places (or reindex everything)
- New project home page: https://memories.gallery
- New Discord community: https://discord.gg/7Dr9f9vNjJ
- Nextcloud 27 compatibility
- **Feature**: Hierarchical places view
- **Feature**: Layout improvements especially for mobile.
- **Feature**: Allow downloading entire publicly shared albums.
- **Feature**: Basic preview generation configuration in admin interface.
- **Bugfix**: Prevent keeping original file on metadata edit.
- **Bugfix**: Use correct locale for time in metadata view.
- **Bugfix**: Allow editing metadata on large video files.
## [v5.1.0] - 2023-04-29
- **Feature**: Allow creating new cluster in recognize while moving faces.
- **Feature**: Allow specifying precise coordinates while editing GPS metadata.
- **Feature**: Whitelist x-msvideo mime type.
- **Fix**: Improved handling of duplicate Live Photos.
- **Fix**: Prevent zombie processes when running in Docker.
- **Breaking**: Recognize v3.8 (minimum) is now required.
## [v5.0.0] - 2023-04-16
Note: this is a major release and may introduce breaking changes to your workflow.
- **Feature**: You can now configure Memories from the admin panel.
To access the admin panel, go to the admin settings and click on the "Memories" tab.
- **Breaking**: The `memories:video-setup` command has been removed.
Transcoding with or without hardware acceleration must now be configured from the admin panel.
For running an external go-vod instance, specifying a configuration file is no longer required.
- **Breaking**: The transcoder and exiftool binaries will be copied to the temp directory before execution.
Make sure your temp directory is writable by the web server.
- **Breaking**: The `--cleanup` flag to `memories:index` has been removed and is no longer necessary.
Folders having a `.nomedia` file will automatically be excluded from the timeline.
- **Feature**: Indexing will now build and check indices automatically in the backgroud.
Make sure Nextcloud cron is configured correctly. You can disable automatic indexing in the admin panel.
Note that files are still indexed immediately on upload.
- **Feature**: You can now choose which folders to index by default.
This can be configured from the admin panel. The available options are:
- All media files (excluding folders with `.nomedia` files, default and recommended)
- All files in every user's configured timeline folder (not recommended).
- All files in a given folder for each user (relative path).
- **Feature**: You can now run indexing in parallel on multiple threads.
`for i in {1..4}; do (occ memories:index &); done`
- **Feature**: Image editing is now done server-side, and is much faster and more reliable.
- PHP Imagick extension is now required for image editing.
- This fixes multiple issues editing images especially in Firefox.
- **Feature**: Significant performance improvements for the timeline view.
## [v4.13.1] - 2023-04-03
- **Feature**: "Direct" video playback will now fall back to HLS (transcoding) if playback fails (e.g. due to lack of browser support).
## [v4.13.0] - 2023-04-03
- **Feature**: Use GPS location data for timezone calculation.
Many cameras do not store the timezone in EXIF data. This feature allows Memories to use the GPS location data to calculate the timezone. To take advantage of this, you will need to run `occ memories:places-setup` followed by `occ memories:index --clear` (or `occ memories:index -f`) to reindex your photos.
- **Feature**: You can now specify the user and/or folder to index when running `occ memories:index` ([#184](https://github.com/pulsejet/memories/issues/184)).
- **Feature**: The map view now has a much more flexible layout, especially on mobile.
- **Feature**: Support for Google MVIMG photos ([#468](https://github.com/pulsejet/memories/issues/468))
## [v4.12.5] - 2023-03-23
- These releases significantly overhaul the application logic for better maintainability. If you run into any regressions, please [file a bug report](https://github.com/pulsejet/memories/issues).
## [v4.12.2] - 2023-03-17
- **Feature**: Allow migrating Google Takeout metadata to EXIF ([#430](https://github.com/pulsejet/memories/issues/430))
## [v4.12.1] - 2023-03-15
- **Feature**: Load full image on zoom ([#266](https://github.com/pulsejet/memories/issues/266))
## [v4.12.0] - 2023-03-10
**This release drops support for Nextcloud 24.**
Make sure you run at least Nextcloud 25.0.4
PHP 7.4 support is now deprecated. Please upgrade to at least PHP 8.0.
You may need to clear browser cache to use location search.
- **Feature**: Allow editing of GPS coordinates ([#418](https://github.com/pulsejet/memories/issues/418))
- **Feature**: Allow bulk editing of EXIF attributes other than date/time
- **Feature**: Allow (optionally bulk) editing of collaborative tags
- **Feature**: Allow sharing single photo / video ([#307](https://github.com/pulsejet/memories/issues/307))
- **Feature**: Allow sharing photos in high/low resolution.
- **Feature**: Allow sharing videos ([#261](https://github.com/pulsejet/memories/issues/261))
- **Feature**: Show list of tags in sidebar
- **Feature**: Better configurability and feature detection for go-vod ([#450](https://github.com/pulsejet/memories/issues/450))
- **Feature**: Configurable folder/album sorting order ([#371](https://github.com/pulsejet/memories/issues/371))
- **Feature**: Configurable album list sorting order ([#377](https://github.com/pulsejet/memories/issues/377))
- **Feature**: Allow archiving photos through folder view ([#350](https://github.com/pulsejet/memories/issues/350))
- **Feature**: Add search bar to face cluster merge dialog ([#177](https://github.com/pulsejet/memories/issues/177))
- **Bugfix**: Sidebar now shows metadata on albums and public shares ([#320](https://github.com/pulsejet/memories/issues/320)).
- Other fixes and features ([milestone](https://github.com/pulsejet/memories/milestone/9?closed=1))
## [v4.11.0] - 2023-02-10
- **Feature**: Show map of photos ([#396](https://github.com/pulsejet/memories/pull/396))
To index existing images, you must run `occ memories:index -f`
- **Feature**: Show list of places using reverse geocoding (MySQL/Postgres only) ([#395](https://github.com/pulsejet/memories/issues/395))
To configure this feature, you need to run `occ memories:places-setup` followed by `occ memories:index -f`
- Other minor fixes and features ([milestone](https://github.com/pulsejet/memories/milestone/7?closed=1))
## [v4.10.0] - 2023-01-17
- **Feature**: Allow sharing albums using public links ([#274](https://github.com/pulsejet/memories/issues/274))
- **Feature**: Allow sharing albums with groups ([#329](https://github.com/pulsejet/memories/issues/329))
- **Feature**: Directly move photos from the timeline to any folder ([#321](https://github.com/pulsejet/memories/pull/321))
- **Feature**: Optionally view folders in the recursive timeline view ([#260](https://github.com/pulsejet/memories/pull/260))
- Fix folder share title and remove footer ([#323](https://github.com/pulsejet/memories/issues/323))
- Other minor fixes ([milestone](https://github.com/pulsejet/memories/milestone/6?closed=1))
## [v4.9.0] - 2022-12-08
- **Important**: v4.9.0 comes with an optimization that greatly reduces CPU usage for preview serving. However, for best experience, the preview generator app is now **required** to be configured properly. Please install it from the app store.
- **Feature**: Slideshow for photos and videos ([#217](https://github.com/pulsejet/memories/issues/217))
- **Feature**: Support for GPU transcoding ([#194](https://github.com/pulsejet/memories/issues/194))
- **Feature**: Allow downloading entire albums
- **Feature**: Allow editing more EXIF fields ([#169](https://github.com/pulsejet/memories/issues/169))
- **Feature**: Alpha integration with the face recognition app ([#146](https://github.com/pulsejet/memories/issues/146))
- Fix downloading from albums ([#259](https://github.com/pulsejet/memories/issues/259))
- Fix support for HEVC Live Photos ([#234](https://github.com/pulsejet/memories/issues/234))
- Fix native photo sharing ([#254](https://github.com/pulsejet/memories/issues/254), [#263](https://github.com/pulsejet/memories/issues/263))
- Use larger previews in viewer (please see [these docs](https://memories.gallery/config/#preview-storage)) ([#226](https://github.com/pulsejet/memories/issues/226))
## [v4.8.0] - 2022-11-22
- **Feature**: Support for Live Photos ([#124](https://github.com/pulsejet/memories/issues/124))
- You need to run `occ memories:index --clear` to reindex Live Photos
- Only JPEG (iOS with MOV, Google, Samsung) is supported. HEIC is not supported.
- **Feature**: Timeline path now scans recursively for mounted volumes / shares inside it
- **Feature**: Multiple timeline paths can be specified ([#178](https://github.com/pulsejet/memories/issues/178))
- Support for server-side encrypted storage ([#99](https://github.com/pulsejet/memories/issues/99))
- Mouse wheel now zooms on desktop
- Improved caching performance
- Due to incorrect caching in previous versions, your browser cache may have become very large. You can clear it to save some space.
## [v4.7.0] - 2022-11-14
- **Note**: you must run `occ memories:index -f` to take advantage of new features.
- **Massively improved video performance**
- Memories now comes with a dedicated transcoding server with HLS support.
- Read the documentation [here](https://memories.gallery/config/#transcoding) carefully for more details.
- **Feature**: Show EXIF metadata in sidebar ([#68](https://github.com/pulsejet/memories/issues/68))
- **Feature**: Multi-selection with drag (mobile) and shift+click ([#28](https://github.com/pulsejet/memories/issues/28))
- **Feature**: Show duration on video tiles
- **Feature**: Allow editing all image formats (HEIC etc.)
- Fix stretched images in viewer ([#176](https://github.com/pulsejet/memories/issues/176))
- Restore metadata after image edit ([#174](https://github.com/pulsejet/memories/issues/174))
- Fix loss of resolution after image edit
## [v4.6.1] - 2022-11-07
- **Feature**: Native sharing from the viewer (images only)
- **Feature**: Deep linking to photos on opening viewer
- **Feature**: Password protected folder shares ([#165](https://github.com/pulsejet/memories/issues/165))
- **Feature**: Folders view will now show only folders with photos ([#163](https://github.com/pulsejet/memories/issues/163))
- Improvements to viewer UX
- Restore image editor (see v4.6.0)
## [v4.6.0] - 2022-11-06
- **Brand new photo viewer** with improved touch interface and UX
- Improvements from v4.5.4 below
- Known regressions: Photo Editor and Slideshow are not implemented yet
- New layout for Albums view (date ascending, grouped by month)
- Re-enable viewer editing and deletion
## [v4.5.2] - 2022-10-30
- Improved scroller performance
- Improved support for external storage and FreeBSD
- Improved selection of photos
## [v4.5.0] - 2022-10-28
- **Feature**: Album sharing to other Nextcloud users
- **Feature**: Folder sharing with public link [#74](https://github.com/pulsejet/memories/issues/74)
- Performance improvements and bug fixes
## [v4.4.1] - 2022-10-27
- **Feature**: Albums support for Nextcloud 25 (alpha)
- Performance improvements and bug fixes
## [v4.3.8] - 2022-10-26
- **Feature**: Full screen viewer on desktop
- **Feature**: Allow opening people and tags in new tab
- Bugfix: Fix regression in performance with large number of files
- Bugfix: Improve image quality on mobile
## [v4.3.7] - 2022-10-24
- **Feature**: Support for RAW (must run `occ memories:index` after upgrade) with camera raw previews app ([#107](https://github.com/pulsejet/memories/issues/107))
- **Feature**: Better settings experience.
- **Feature**: Better first start experience.
- Bug fixes for postgresql and mysql
## [v4.3.0] - 2022-10-22
- **Note:** you must run `occ memories:index -f` after updating to take advantage of new features.
- **Feature**: **Brand new tiled layout for photos**
- **Feature**: Photos from "On this day" are now shown at the top of the timeline
- **Feature**: Move selected photos from one person to another ([#78](https://github.com/pulsejet/memories/issues/78))
- **Feature**: Highlight faces in People view ([#79](https://github.com/pulsejet/memories/issues/79))
- **Feature**: Choose root folder for Folders view ([#85](https://github.com/pulsejet/memories/issues/85))
- **No longer need to install exiftool**. It will be bundled with the app.
- Improve overall performance with caching
- Basic offline support with cache
- Improve scroller performance
- Improve faces view performance
## [v4.2.2] - 2022-10-12
- Update to mobile layout with improved performance
- Show how old photos are in `On this day`
## [v4.2.1] - 2022-10-11
- Fix incorrect layout of `On this day`
## [v4.2.0] - 2022-10-11
- Allow renaming and merging recognize faces
- Bug fixes
## [v4.1.0] - 2022-10-08
- First release for Nextcloud 25
## [v3.0.0] - 2022-10-07
- People tab with faces from recognize app
- Tags tab with objects from recognize app
- On this day tab
- Bug fixes and performance improvements
## [v2.1.3] - 2022-09-27
- Bug fixes and optimized performance
## [v2.1.2] - 2022-09-25
- Breadcrumb navigation in folder view
- Edit Exif date feature (use with care)
- Archive photos function
- Improved localization and performance
## [v2.0.0] - 2022-09-23
- **Note:** you must re-run `occ memories:index` after updating.
- Support for external storage and shared folders for timeline.
- Localization support. Many languages already available.
- Select and favorite / unfavorite photos
## [v1.1.6] - 2022-09-15
- **New feature:** Select photos from an entire day together
- **Fix:** Timeline with nested folders
## [v1.1.5] - 2022-09-15
- Fix for postgres
- Fix for Exiftool crash
## [v1.1.4] - 2022-09-13
- PHP 7.4 support
- Bug fixes
## [v1.1.0] - 2022-09-13
- Support for external storage
- Favorites and Videos tabs
- Improved performance
- Better support for folder shares
## [v1.0.1] - 2022-09-08
- Initial release

View File

661
COPYING
View File

@ -1,661 +0,0 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

View File

@ -1,69 +0,0 @@
all: dev-setup lint build-js-production test
# Dev env management
dev-setup: clean clean-dev npm-init bin-ext install-tools
bin-ext:
sh scripts/get-bin-ext.sh
install-tools:
composer install
php-lint:
vendor/bin/php-cs-fixer fix
psalm:
vendor/bin/psalm --no-cache
npm-init:
npm ci
npm-update:
npm update
.PHONY: dev-setup bin-ext install-tools php-lint psalm npm-init npm-update
# Building
build-js:
npm run dev
build-js-production:
rm -f js/* && npm run build
patch-external:
bash scripts/patch-external.sh
watch-js:
npm run watch
.PHONY: build-js patch-external watch-js
# Testing
test:
npm run test
test-watch:
npm run test:watch
test-coverage:
npm run test:coverage
.PHONY: test test-watch test-coverage
# Linting
lint:
npm run lint
lint-fix:
npm run lint:fix
.PHONY: lint lint-fix
# Cleaning
clean:
rm -f js/*
clean-dev:
rm -rf node_modules
.PHONY: clean clean-dev

105
README.md
View File

@ -1,105 +0,0 @@
![Screenshot](appinfo/screenshot.jpg)
# Memories: Photo Management for Nextcloud
[![Discord](https://dcbadge.vercel.app/api/server/7Dr9f9vNjJ)](https://discord.gg/7Dr9f9vNjJ)
[![Website](https://img.shields.io/website?down_color=red&down_message=offline&label=website&style=for-the-badge&up_color=brightgreen&up_message=online&url=https%3A%2F%2Fmemories.gallery)](https://memories.gallery)
[![Demo](https://img.shields.io/website?down_color=red&down_message=offline&label=demo&style=for-the-badge&up_color=brightgreen&up_message=online&url=https%3A%2F%2Fdemo.memories.gallery)](https://demo.memories.gallery/apps/memories/)
[![Nextcloud Store](https://img.shields.io/badge/nextcloud_store-blue?style=for-the-badge)](https://apps.nextcloud.com/apps/memories)
![GitHub](https://img.shields.io/github/license/pulsejet/memories)
[![GitHub issues](https://img.shields.io/github/issues/pulsejet/memories)](https://github.com/pulsejet/memories/issues)
[![GitHub Sponsor](https://img.shields.io/github/sponsors/pulsejet?logo=GitHub)](https://github.com/sponsors/pulsejet)
[![e2e](https://github.com/pulsejet/memories/actions/workflows/e2e.yaml/badge.svg)](https://github.com/pulsejet/memories/actions/workflows/e2e.yaml)
[![static analysis](https://github.com/pulsejet/memories/actions/workflows/static-analysis.yaml/badge.svg)](https://github.com/pulsejet/memories/actions/workflows/static-analysis.yaml)
[![Shepherd](https://shepherd.dev/github/pulsejet/memories/coverage.svg)](https://shepherd.dev/github/pulsejet/memories)
[![go-vod](https://github.com/pulsejet/memories/actions/workflows/go-vod.yml/badge.svg)](https://github.com/pulsejet/memories/actions/workflows/go-vod.yml)
Memories is a _batteries-included_ photo management solution for Nextcloud with advanced features
## 🎁 Features
- **📸 Timeline**: Sort photos and videos by date taken, parsed from Exif data.
- **⏪ Rewind**: Jump to any time in the past instantly and relive your memories.
- **🤖 AI Tagging**: Group photos by people and objects, powered by [recognize](https://github.com/nextcloud/recognize) and [facerecognition](https://github.com/matiasdelellis/facerecognition).
- **🖼️ Albums**: Create albums to group photos and videos together. Then share these albums with others.
- **🫱🏻‍🫲🏻 External Sharing**: Share photos and videos with people outside of your Nextcloud instance.
- **📱 Mobile Support**: Work from any device, of any shape and size through the web app.
- **✏️ Edit Metadata**: Edit dates and other metadata on photos quickly and in bulk.
- **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder.
- **📹 Video Transcoding**: Transcode videos and use HLS for maximal performance.
- **🗺️ Map**: View your photos on a map, tagged with accurate reverse geocoding.
- **📦 Migration**: Migrate easily from Nextcloud Photos and Google Takeout.
- **⚡️ Performance**: Do all this very fast.
## 🚀 Installation
1. Install the app from the Nextcloud [app store](https://apps.nextcloud.com/apps/memories).
1. Perform the recommended [configuration steps](https://memories.gallery/config/).
1. Run `php occ memories:index` to generate metadata indices for existing photos.
1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos.
## 📱 Mobile Apps
- An Android client for Memories is available in early access on [Google Play](https://play.google.com/store/apps/details?id=gallery.memories) or [GitHub Releases](https://github.com/pulsejet/memories/releases?q=android).
- For automatic uploads, you can use the official Nextcloud mobile apps.
- Android: [Google Play](https://play.google.com/store/apps/details?id=com.nextcloud.client), [F-Droid](https://f-droid.org/en/packages/com.nextcloud.client/)
- iOS: [App Store](https://apps.apple.com/us/app/nextcloud/id1125420102).
## 🏗 Development Setup
1. ☁ Clone this monorepo into the `custom_apps` folder of your Nextcloud.
1. 📥 Install [Composer](https://getcomposer.org/) and [Node.js 18](https://nodejs.org)
1. 👩‍💻 In a terminal, run the command `make dev-setup` to install the dependencies.
1. 🏗 To build/watch the UI, run `make watch-js`.
1. ✅ Enable the app through the app management of your Nextcloud.
1. ⚒️ (Strongly recommended) use VS Code for development and install these extensions (`Ctrl+Shift+P` > `Show Recommended Extensions`).
- [PHP Intelephense](https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client): For PHP intellisense and static analysis
- [PHP-CS-Fixer](https://marketplace.visualstudio.com/items?itemName=muuvmuuv.vscode-just-php-cs-fixer): For PHP formatting (alternatively, `make php-cs-fixer`)
- [Psalm](https://marketplace.visualstudio.com/items?itemName=getpsalm.psalm-vscode-plugin): For PHP static analysis (alternatively, `make psalm`)
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode): For autoformatting Vue and Typescript
- [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar): For Vue intellisense and static analysis
- [Volar Typescript](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin): For Vue Typescript support
This monorepo is organized into the following packages:
- [lib](lib): Backend and database migrations (PHP).
- [src](src): Frontend for all platforms (Vue)
- [go-vod](go-vod): On-demand video transcoder (Go)
- [android](android): Android implemention of NativeX (Kotlin)
- [l10n](l10n): Translations (Transifex)
Releases are organized with these tags:
- `v*`: overall releases (e.g. `v1.0.0` or `v1.0.0-beta.1`)
- `go-vod/*`: transcoder releases (e.g. `go-vod/1.0.0`)
- `android/*`: Android releases (e.g. `android/1.0.0`)
## 🤝 Support the project
1. **🌟 Star this repository**: This is the easiest way to support Memories and costs nothing.
1. **🪲 Report bugs**: Report any bugs you find on the issue tracker.
1. **📖 Translate**: Help translate Memories into your language on [Transifex](https://www.transifex.com/nextcloud/nextcloud/memories/).
1. **📝 Contribute**: Read and file or comment on an issue and ask for guidance.
1. **🪙 Sponsorship**: You can support the project financially at [GitHub Sponsors](https://github.com/sponsors/pulsejet).
A shout out to the current and past financial backers of Memories! See the sponsors page for a full list.
[<img src="https://github.com/mpodshivalin.png" width="42" />](https://github.com/mpodshivalin)
[<img src="https://github.com/k1l1.png" width="42" />](https://github.com/k1l1)
[<img src="https://github.com/ChickenTarm.png" width="42" />](https://github.com/ChickenTarm)
[<img src="https://github.com/ChildLearningClub.png" width="42" />](https://github.com/ChildLearningClub)
[<img src="https://github.com/mpanhans.png" width="42" />](https://github.com/mpanhans)
## 📝 Changelog
For the full changelog, see [CHANGELOG.md](CHANGELOG.md).
## 🙏 Special Thanks
To the great folks building Nextcloud, PHP, Vue and all the other dependencies that make this project possible.
Thanks to [GitHub](https://github.com), [CircleCI](https://circleci.com/) and [BrowserStack](https://www.browserstack.com) for sponsorship for Open Source projects for CI / testing on different devices.
## 📄 License
Memories is licensed under the [AGPLv3](COPYING). Subpackages such as [go-vod](go-vod) are licensed under their respective licenses. See the directory of the subpackage for more information.

16
android/.gitignore vendored
View File

@ -1,16 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
app/release

View File

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -1 +0,0 @@
Memories

View File

@ -1,123 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\varun\.android\avd\Pixel_6_API_33_2.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-05-16T08:14:59.213052500Z" />
</component>
</project>

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.0" />
</component>
</project>

View File

@ -1,14 +0,0 @@
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="android.webkit.JavascriptInterface" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,5 +0,0 @@
# Memories Android Wrapper
Android implementation of the NativeX interface.
Note that all code under this tree is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html), unlike Memories itself, which is licensed under the AGPLv3 license.

View File

@ -1 +0,0 @@
/build

View File

@ -1,57 +0,0 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.google.devtools.ksp' version '1.9.0-1.0.13'
}
android {
namespace 'gallery.memories'
compileSdk 33
defaultConfig {
applicationId "gallery.memories"
minSdk 27
targetSdk 33
versionCode 6
versionName "1.6"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
buildFeatures {
viewBinding true
}
}
dependencies {
def media_version = "1.1.1"
def room_version = "2.5.2"
implementation 'androidx.core:core-ktx:1.10.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.6.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.6.0'
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation "androidx.media3:media3-exoplayer:$media_version"
implementation "androidx.media3:media3-ui:$media_version"
implementation "androidx.media3:media3-exoplayer-hls:$media_version"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
ksp "androidx.room:room-compiler:$room_version"
implementation "com.squareup.okhttp3:okhttp:4.10.0"
implementation "io.github.g00fy2:versioncompare:1.5.0"
}

View File

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
<application
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Memories"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.Memories.NoActionBar"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".service.DownloadBroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="47.276897mm" height="12.685879mm" viewBox="0 0 47.276898 12.685879" version="1.1" id="svg5"
sodipodi:docname="memories-title (1).svg" inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview14"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="1.2378992"
inkscape:cx="85.225033"
inkscape:cy="88.456314"
inkscape:window-width="1920"
inkscape:window-height="991"
inkscape:window-x="1911"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="svg5" />
<defs
id="defs2" />
<g
id="layer1"
transform="translate(-57.784684,-63.463599)"
style="stroke:none;stroke-opacity:1;fill:white;fill-opacity:1">
<g
aria-label="Memories"
id="text1574"
style="font-size:14.1111px;line-height:1.25;font-family:monospace;-inkscape-font-specification:monospace;stroke-width:0.264583;stroke:none;stroke-opacity:1;fill:white;fill-opacity:1">
<path
d="m 67.718898,66.850263 c 0,2.328331 -1.467554,4.797774 -1.467554,7.224883 0,1.41111 0.860777,2.074332 1.622776,2.074332 2.031999,0 3.400776,-4.600219 3.781775,-5.870218 0.07056,-0.211667 -0.02822,-0.282222 -0.268111,-0.282222 -0.197555,0 -0.225777,0.05644 -0.296333,0.239889 -0.634999,1.523999 -2.003776,4.938885 -2.850442,4.938885 -0.211666,0 -0.592666,-0.197556 -0.592666,-1.001888 0,-2.356554 1.439332,-4.23333 1.439332,-7.027328 0,-0.719666 -0.141111,-1.79211 -1.142999,-1.79211 -1.326444,0 -2.906887,1.989665 -3.58422,3.443108 0.225778,-0.917221 0.719667,-2.652886 0.719667,-3.711219 0,-0.973666 -0.409222,-1.622776 -1.030111,-1.622776 -1.693332,0 -3.739441,5.26344 -4.388552,6.646328 0.296333,-1.185333 1.298221,-4.684885 1.298221,-5.602107 0,-0.493888 -0.268111,-0.931333 -0.578555,-0.931333 -0.437444,0 -0.917221,0.917222 -1.312332,2.539998 -0.239889,0.945444 -0.649111,3.005665 -0.917222,4.656664 -0.225777,1.396998 -0.366888,2.046109 -0.366888,2.666997 0,0.381 0.183444,0.437445 0.437444,0.437445 0.310444,0 0.536222,-0.08467 0.747888,-0.282222 0.578555,-0.550333 0.620889,-1.622777 0.917222,-2.483554 0.592666,-1.707443 3.062108,-6.180662 3.612441,-6.180662 0.127,0 0.127,0.239889 0.127,0.282222 0,1.636888 -1.241777,4.628441 -1.241777,6.632217 0,0 0,0.409222 0.352778,0.409222 0.155222,0 0.352777,-0.07055 0.522111,-0.197555 0.338666,-0.254 0.409222,-0.592667 0.606777,-1.086555 0.818444,-2.116665 2.82222,-4.571997 3.59833,-4.571997 0.268111,0 0.254,0.239889 0.254,0.451556 z"
style="font-family:'Lofty Goals';-inkscape-font-specification:'Lofty Goals';stroke:none;stroke-opacity:1;fill:white;fill-opacity:1"
id="path7728" />
<path
d="m 71.980438,73.016813 c 1.396999,0 3.033887,-1.693332 3.033887,-2.808109 0,-0.04233 0,-0.07055 -0.01411,-0.112888 -0.07056,-0.08467 -0.155222,-0.141111 -0.268111,-0.141111 -0.366889,0.578555 -1.53811,2.257776 -2.31422,2.257776 -0.437445,0 -0.620889,-0.550333 -0.620889,-0.917222 v -0.07055 c 0.987777,-0.05644 1.91911,-1.298222 1.91911,-2.243665 0,-0.550333 -0.296333,-0.860777 -0.860777,-0.860777 -1.523999,0 -2.314221,1.93322 -2.314221,3.217331 0,0.705555 0.578555,1.67922 1.439332,1.67922 z m 1.030111,-3.880552 c 0,0.395111 -0.719666,1.495777 -1.15711,1.523999 0.02822,-0.381 0.52211,-1.834443 1.001888,-1.834443 0.155222,0 0.155222,0.211666 0.155222,0.310444 z"
style="font-family:'Lofty Goals';-inkscape-font-specification:'Lofty Goals';stroke:none;stroke-opacity:1;fill:white;fill-opacity:1"
id="path7730" />
<path
d="m 75.804523,67.301818 c -1.128888,0 -1.467555,3.838219 -1.467555,4.727218 0,0.352778 0.02822,0.987777 0.508,0.987777 0.790222,0 1.213555,-0.733777 1.425221,-1.396998 0.169333,-0.550333 1.086555,-3.612442 1.552221,-3.668887 0.127,0.197556 0.127,0.635 0.127,0.874889 0,0.888999 -0.08467,1.763887 -0.08467,2.652887 0,0.324555 -0.01411,1.015999 0.465666,1.015999 0.705555,0 1.890887,-3.824108 2.511776,-3.922886 0.07055,0.183444 0.08467,0.366888 0.08467,0.550333 0,1.058332 -0.296333,2.074332 -0.296333,3.132664 0,0.465666 0.05644,1.368777 0.705555,1.368777 0.606777,0 2.610554,-2.892776 2.69522,-3.527775 -0.05644,-0.08467 -0.169333,-0.141111 -0.268111,-0.141111 -0.197555,0 -1.665109,2.342442 -2.046109,2.398887 -0.04233,-0.02822 -0.05644,-0.08467 -0.05644,-0.112889 0,-0.381 0.155223,-0.818444 0.239889,-1.199444 0.169333,-0.761999 0.338667,-1.552221 0.338667,-2.342442 0,-0.508 -0.254,-1.255888 -0.874889,-1.255888 -1.100665,0 -2.017887,1.947332 -2.427109,2.793998 0.01411,-0.578555 0.112889,-1.157111 0.112889,-1.749777 0,-0.564444 -0.05644,-1.66511 -0.846666,-1.66511 -1.171221,0 -2.158998,2.920998 -2.539998,3.83822 0.08467,-0.931333 0.508,-1.820332 0.508,-2.765776 0,-0.282222 0.01411,-0.592666 -0.366889,-0.592666 z"
style="font-family:'Lofty Goals';-inkscape-font-specification:'Lofty Goals';stroke:none;stroke-opacity:1;fill:white;fill-opacity:1"
id="path7732" />
<path
d="m 84.652174,74.046924 c 1.058333,0 1.975554,-1.086555 2.384776,-2.412998 0.860777,-0.09878 2.04611,-0.959555 2.04611,-1.495777 0,-0.127 -0.07056,-0.254 -0.169334,-0.282222 -0.437444,0.352777 -1.199443,0.776111 -1.679221,0.90311 0.02822,-0.183444 0.02822,-0.366888 0.02822,-0.550333 0,-1.396998 -0.747889,-2.652886 -1.594555,-2.652886 -0.691444,0 -1.467554,0.832555 -1.467554,1.566332 0,0.02822 0,0.07055 0,0.09878 -0.691444,0.564444 -1.086555,1.495777 -1.086555,2.539999 0,1.326443 0.649111,2.285998 1.53811,2.285998 z m 1.749777,-3.443109 c -0.606778,-0.338666 -1.284111,-1.044221 -1.284111,-1.467554 0,-0.254 0.268111,-0.550333 0.522111,-0.550333 0.409222,0 0.776111,0.804333 0.776111,1.693332 0,0.112889 0,0.211667 -0.01411,0.324555 z m -0.155223,0.917222 c -0.239888,0.90311 -0.691443,1.679221 -1.227665,1.679221 -0.381,0 -0.733777,-0.620889 -0.733777,-1.298221 0,-0.536222 0.225777,-1.213555 0.465666,-1.523999 0.395111,0.493888 0.959555,0.931332 1.495776,1.142999 z"
style="font-family:'Lofty Goals';-inkscape-font-specification:'Lofty Goals';stroke:none;stroke-opacity:1;fill:white;fill-opacity:1"
id="path7734" />
<path
d="m 89.986155,74.752479 c 1.001888,0 3.570108,-3.697108 3.640664,-4.656663 0.01411,-0.155222 -0.155222,-0.141111 -0.268111,-0.141111 -0.254,0.395111 -2.300109,3.485441 -2.737553,3.485441 -0.09878,0 -0.08467,-0.141111 -0.08467,-0.211666 0.07056,-0.790222 0.705555,-1.594554 0.776111,-2.427109 0.08467,-0.874889 -0.606778,-0.889 -1.312333,-1.128888 0.338667,-0.310445 0.649111,-0.917222 0.691444,-1.354666 0.04233,-0.522111 -0.268111,-1.326443 -0.874888,-1.326443 -1.001888,0 -1.368777,1.015999 -1.439332,1.834443 -0.112889,1.41111 0.931332,1.509887 1.961443,1.834443 -0.01411,0.239888 -0.352778,0.945443 -0.465667,1.227665 -0.225777,0.606778 -0.451555,1.241777 -0.507999,1.876777 -0.04233,0.507999 0.01411,0.987777 0.620888,0.987777 z m -0.155222,-6.349995 c -0.02822,0.282222 -0.169333,0.931332 -0.381,1.128888 -0.211666,-0.112889 -0.239888,-0.479778 -0.225777,-0.705555 0.02822,-0.183445 0.112889,-0.959555 0.395111,-0.959555 0.197555,0 0.225777,0.395111 0.211666,0.536222 z"
style="font-family:'Lofty Goals';-inkscape-font-specification:'Lofty Goals';stroke:none;stroke-opacity:1;fill:white;fill-opacity:1"
id="path7736" />
<path
d="m 94.473479,67.555818 c 0.479778,0 0.719666,-0.550333 0.719666,-0.959555 0,-0.282222 -0.09878,-0.649111 -0.451555,-0.649111 -0.578555,0 -0.804332,0.508 -0.804332,0.945444 0,0.296333 0.211666,0.663222 0.536221,0.663222 z m -0.550333,5.64444 c 0.860778,0 2.568221,-2.328332 2.568221,-3.033887 0,-0.127 -0.02822,-0.211666 -0.169334,-0.211666 -0.52211,0 -1.636887,2.257776 -2.031998,2.257776 -0.211666,0 -0.225778,-0.324556 -0.225778,-0.465667 0,-1.721554 0.677333,-2.356553 0.677333,-2.977442 0,-0.366888 -0.211666,-0.451555 -0.550333,-0.451555 -0.733777,0 -1.213554,1.834443 -1.213554,3.033887 0,0.592666 0.141111,1.848554 0.945443,1.848554 z"
style="font-family:'Lofty Goals';-inkscape-font-specification:'Lofty Goals';stroke:none;stroke-opacity:1;fill:white;fill-opacity:1"
id="path7738" />
<path
d="m 97.098125,73.016813 c 1.396999,0 3.033885,-1.693332 3.033885,-2.808109 0,-0.04233 0,-0.07055 -0.0141,-0.112888 -0.0706,-0.08467 -0.155222,-0.141111 -0.268111,-0.141111 -0.366888,0.578555 -1.53811,2.257776 -2.31422,2.257776 -0.437444,0 -0.620889,-0.550333 -0.620889,-0.917222 v -0.07055 c 0.987777,-0.05644 1.91911,-1.298222 1.91911,-2.243665 0,-0.550333 -0.296333,-0.860777 -0.860777,-0.860777 -1.523999,0 -2.31422,1.93322 -2.31422,3.217331 0,0.705555 0.578555,1.67922 1.439332,1.67922 z m 1.03011,-3.880552 c 0,0.395111 -0.719666,1.495777 -1.15711,1.523999 0.02822,-0.381 0.522111,-1.834443 1.001888,-1.834443 0.155222,0 0.155222,0.211666 0.155222,0.310444 z"
style="font-family:'Lofty Goals';-inkscape-font-specification:'Lofty Goals';stroke:none;stroke-opacity:1;fill:white;fill-opacity:1"
id="path7740" />
<path
d="m 101.00688,72.043148 c -0.95956,0.733777 -1.693333,1.580443 -1.693333,2.328331 0,0.832555 0.634999,1.439332 1.453443,1.439332 1.27,0 2.65289,-1.213554 2.65289,-2.356553 0,-0.776111 -0.31045,-1.298222 -0.73378,-1.693332 0.94544,-0.578556 1.905,-1.100666 2.37066,-1.523999 0.0282,-0.141111 -0.0705,-0.296333 -0.21166,-0.268111 -0.52211,0.127 -1.651,0.634999 -2.75167,1.326443 -0.67733,-0.465666 -1.35466,-0.77611 -1.35466,-1.382888 0,-0.592666 0.60678,-1.707443 1.28411,-1.707443 0.32455,0 0.55033,0.197556 0.55033,0.592666 0,0.324556 -0.16933,0.620889 -0.16933,0.945444 0,0.183444 0.11289,0.324555 0.29633,0.324555 0.508,0 0.80433,-0.64911 0.80433,-1.072443 0,-0.973666 -0.52211,-1.495777 -1.49577,-1.495777 -1.43934,0 -2.441224,1.185333 -2.441224,2.582332 0,1.086554 0.719664,1.566332 1.439334,1.961443 z m -0.69145,2.116665 c 0,-0.578556 0.59267,-1.171222 1.36878,-1.735666 0.42333,0.268111 0.74789,0.578555 0.74789,1.100666 0,0.522111 -0.74789,1.326443 -1.397,1.326443 -0.42333,0 -0.71967,-0.324555 -0.71967,-0.691443 z"
style="font-family:'Lofty Goals';-inkscape-font-specification:'Lofty Goals';stroke:none;stroke-opacity:1;fill:white;fill-opacity:1"
id="path7742" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,107 +0,0 @@
:root {
--theme-color: #2b94f0;
--fg-color: white;
}
body {
margin: 0;
padding: 0;
background-color: var(--theme-color);
color: var(--fg-color);
overflow: hidden;
font-family: sans-serif;
}
* {
user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
}
.container {
width: 90vw;
max-width: 800px;
margin: 40px auto;
text-align: center;
}
.animatable {
transition: opacity 0.7s ease-in-out, transform 0.7s ease-in-out;
}
.invisible {
transform: translateY(10px);
opacity: 0;
}
p,
div.p {
color: white;
margin-bottom: 30px;
line-height: 1.5em;
}
.logo {
color: var(--fg-color);
margin-bottom: 30px;
width: 60vw;
max-width: 400px;
}
input.m-input {
width: 80vw;
max-width: 800px;
padding: 10px 12px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 10px;
background-color: #f9f9f9;
color: #333;
outline: none;
transition: border-color 0.3s ease-in-out;
}
input.m-input:focus {
border-color: #0096ff;
box-shadow: 0 0 4px var(--theme-color);
}
.m-button {
display: inline-block;
padding: 10px 20px;
font-size: 16px;
font-weight: bold;
color: var(--theme-color);
background-color: var(--fg-color);
border: none;
border-radius: 20px;
cursor: pointer;
text-decoration: none;
transition: background-color 0.3s ease-in-out;
}
.m-button:disabled {
background-color: #eee;
color: #aaa;
cursor: not-allowed;
}
.m-button.link {
background-color: unset;
color: var(--fg-color);
}
.login-button {
margin: 10px;
margin-top: 12px;
}
div.trust {
margin-top: 10px;
}
input[type="checkbox"] {
width: 1.5em;
height: 1.5em;
vertical-align: -3px;
}

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Memories</title>
<link rel="stylesheet" href="styles.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div id="main" class="container">
<img src="memories.svg" alt="Memories Logo" class="logo" />
<p id="waiting">
Waiting for login to complete <br />
Keep this page open in the background
</p>
</div>
</body>
</html>

View File

@ -1,136 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Memories</title>
<link rel="stylesheet" href="styles.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div id="main" class="container animatable invisible">
<img src="memories.svg" alt="Memories Logo" class="logo" />
<p>
Start organizing and sharing your precious moments. Enter the address of
your Nextcloud server to begin.
</p>
<input
type="url"
id="server-url"
class="m-input"
placeholder="nextcloud.example.com"
/>
<div class="trust">
<label for="trust-all">
<input
type="checkbox"
id="trust-all"
class="m-checkbox"
/>
Disable certificate verification (unsafe)
</label>
</div>
<button class="m-button login-button" id="login">
Continue to Login
</button>
<br />
<a class="m-button link" href="https://memories.gallery/install/">
I don't have a server
</a>
</div>
<script>
const urlBox = document.getElementById("server-url");
const loginButton = document.getElementById("login");
function validateUrl(url) {
try {
url = new URL(url);
const protoOk = url.protocol === "http:" || url.protocol === "https:";
const hostOk = url.hostname.length > 0;
return protoOk && hostOk;
} catch (e) {
return false;
}
}
function getUrl() {
const url = urlBox.value.toLowerCase();
if (!url.startsWith("http://") && !url.startsWith("https://")) {
return "https://" + url;
}
return url;
}
function updateLoginEnabled() {
loginButton.disabled = !validateUrl(getUrl());
}
function getMemoriesUrl() {
const url = new URL(getUrl());
// Add trailing slash to the path if it's not there already
if (!url.pathname.endsWith("/")) {
url.pathname += "/";
}
// Add index.php to the path if it's not there already
if (!url.pathname.includes("index.php")) {
url.pathname += "index.php/";
}
// Add path to memories
url.pathname += "apps/memories/";
return url;
}
// Update login button enabled state when the URL changes
urlBox.addEventListener("input", updateLoginEnabled);
updateLoginEnabled();
// Login button click handler
loginButton.addEventListener("click", async () => {
try {
urlBox.disabled = true;
loginButton.disabled = true;
// Abort request after 5 seconds
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000);
// Login signal
const encUrl = encodeURIComponent(encodeURIComponent(getMemoriesUrl().toString()));
// Trust all certificates
const trustAll = document.getElementById("trust-all").checked ? "1" : "0";
await fetch(`http://127.0.0.1/api/login/${encUrl}?trustAll=${trustAll}`, {
method: "GET",
signal: controller.signal,
});
// API is fine, redirect to login page
clearTimeout(timeoutId);
} catch (e) {
// unreachable?
} finally {
urlBox.disabled = false;
loginButton.disabled = false;
}
});
// Set action bar color
const themeColor = getComputedStyle(
document.documentElement
).getPropertyValue("--theme-color");
globalThis.nativex?.setThemeColor(themeColor, true);
// Make container visible
document.getElementById("main").classList.remove("invisible");
</script>
</body>
</html>

View File

@ -1,442 +0,0 @@
package gallery.memories
import android.annotation.SuppressLint
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.net.Uri
import android.net.http.SslError
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.KeyEvent
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsController
import android.view.WindowManager
import android.webkit.CookieManager
import android.webkit.SslErrorHandler
import android.webkit.WebResourceRequest
import android.webkit.WebResourceResponse
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Lifecycle
import androidx.media3.common.MediaItem
import androidx.media3.common.PlaybackException
import androidx.media3.common.Player
import androidx.media3.common.util.UnstableApi
import androidx.media3.datasource.DefaultDataSource
import androidx.media3.datasource.DefaultHttpDataSource
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.exoplayer.hls.HlsMediaSource
import androidx.media3.exoplayer.source.ProgressiveMediaSource
import gallery.memories.databinding.ActivityMainBinding
import java.util.concurrent.Executors
@UnstableApi
class MainActivity : AppCompatActivity() {
companion object {
val TAG = MainActivity::class.java.simpleName
}
val binding by lazy(LazyThreadSafetyMode.NONE) {
ActivityMainBinding.inflate(layoutInflater)
}
val threadPool = Executors.newFixedThreadPool(4)
private lateinit var nativex: NativeX
private var player: ExoPlayer? = null
private var playerUris: Array<Uri>? = null
private var playerUid: Long? = null
private var playWhenReady = true
private var mediaItemIndex = 0
private var playbackPosition = 0L
private var mNeedRefresh = false
private val memoriesRegex = Regex("/apps/memories/.*$")
private var host: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
// Restore last known look
restoreTheme()
// Initialize services
nativex = NativeX(this)
// Sync if permission is available
nativex.doMediaSync(false)
// Load JavaScript
initializeWebView()
// Destroy video after 1 seconds (workaround for video not showing on first load)
binding.videoView.postDelayed({
binding.videoView.alpha = 1.0f
binding.videoView.visibility = View.GONE
}, 1000)
}
override fun onDestroy() {
super.onDestroy()
binding.webview.removeAllViews();
binding.coordinator.removeAllViews()
binding.webview.destroy();
nativex.destroy()
}
override fun onConfigurationChanged(config: Configuration) {
super.onConfigurationChanged(config)
// Hide the status bar in landscape
setFullscreen(config.orientation == Configuration.ORIENTATION_LANDSCAPE)
}
public override fun onResume() {
super.onResume()
if (playerUris != null && player == null) {
initializePlayer(playerUris!!, playerUid!!)
}
if (mNeedRefresh) {
refreshTimeline(true)
}
}
public override fun onPause() {
super.onPause()
}
public override fun onStop() {
super.onStop()
releasePlayer()
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
when (keyCode) {
KeyEvent.KEYCODE_BACK -> {
if (binding.webview.canGoBack()) {
binding.webview.goBack()
} else {
finish()
}
return true
}
}
}
return super.onKeyDown(keyCode, event)
}
@SuppressLint("SetJavaScriptEnabled", "ClickableViewAccessibility")
private fun initializeWebView() {
// Intercept local APIs
binding.webview.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView,
request: WebResourceRequest
): Boolean {
val pathMatches = request.url.path?.matches(memoriesRegex) == true
val hostMatches = request.url.host.equals(host)
if (pathMatches && hostMatches) {
return false
}
// Open external links in browser
Intent(Intent.ACTION_VIEW, request.url).apply { startActivity(this) }
return true
}
override fun shouldInterceptRequest(
view: WebView,
request: WebResourceRequest
): WebResourceResponse? {
return if (request.url.host == "127.0.0.1") {
nativex.handleRequest(request)
} else null
}
override fun onReceivedSslError(
view: WebView?,
handler: SslErrorHandler?,
error: SslError?
) {
if (nativex.http.isTrustingAllCertificates) {
handler?.proceed()
} else {
nativex.toast("Failed to load due to SSL error: ${error?.primaryError}", true)
super.onReceivedSslError(view, handler, error)
}
}
}
// Pass through touch events
binding.webview.setOnTouchListener { _, event ->
if (player != null) {
binding.videoView.dispatchTouchEvent(event)
}
false
}
val userAgent =
getString(R.string.ua_app_prefix) + BuildConfig.VERSION_NAME + " " + getString(R.string.ua_chrome)
val webSettings = binding.webview.settings
webSettings.javaScriptEnabled = true
webSettings.javaScriptCanOpenWindowsAutomatically = true
webSettings.allowContentAccess = true
webSettings.domStorageEnabled = true
webSettings.databaseEnabled = true
webSettings.userAgentString = userAgent
webSettings.setSupportZoom(false)
webSettings.builtInZoomControls = false
webSettings.displayZoomControls = false
binding.webview.addJavascriptInterface(nativex, "nativex")
binding.webview.setLayerType(View.LAYER_TYPE_HARDWARE, null)
binding.webview.setBackgroundColor(Color.TRANSPARENT)
// binding.webview.clearCache(true)
// WebView.setWebContentsDebuggingEnabled(true);
// Welcome page or actual app
nativex.account.refreshCredentials()
val isApp = loadDefaultUrl()
// Start version check if loaded account
if (isApp) {
// Do not use the threadPool here since this might block indefinitely
Thread { nativex.account.checkCredentialsAndVersion() }.start()
}
}
fun loadDefaultUrl(): Boolean {
// Load app interface if authenticated
host = nativex.http.loadWebView(binding.webview)
if (host != null) return true
// Load welcome page
binding.webview.loadUrl("file:///android_asset/welcome.html");
return false
}
fun initializePlayer(uris: Array<Uri>, uid: Long) {
if (player != null) {
if (playerUid == uid) return
player?.release()
player = null
}
// Prevent re-creating
playerUris = uris
playerUid = uid
// Build exoplayer
player = ExoPlayer.Builder(this)
.build()
.also { exoPlayer ->
// Bind to player view
binding.videoView.player = exoPlayer
binding.videoView.visibility = View.VISIBLE
binding.videoView.setShowNextButton(false)
binding.videoView.setShowPreviousButton(false)
for (uri in uris) {
// Create media item from URI
val mediaItem = MediaItem.fromUri(uri)
// Check if remote or local URI
if (uri.toString().contains("http")) {
// Add cookies from webview to data source
val cookies = CookieManager.getInstance().getCookie(uri.toString())
val httpDataSourceFactory =
DefaultHttpDataSource.Factory()
.setDefaultRequestProperties(mapOf("cookie" to cookies))
.setAllowCrossProtocolRedirects(true)
val dataSourceFactory =
DefaultDataSource.Factory(this, httpDataSourceFactory)
// Check if HLS source from URI (contains .m3u8 anywhere)
exoPlayer.addMediaSource(
if (uri.toString().contains(".m3u8")) {
HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(mediaItem)
} else {
ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(mediaItem)
}
)
} else {
exoPlayer.setMediaItems(listOf(mediaItem), mediaItemIndex, playbackPosition)
}
}
// Catch errors and fall back to other sources
exoPlayer.addListener(object : Player.Listener {
override fun onPlayerError(error: PlaybackException) {
exoPlayer.seekToNext()
exoPlayer.playWhenReady = true
exoPlayer.play()
}
})
// Start the player
exoPlayer.playWhenReady = playWhenReady
exoPlayer.prepare()
}
}
fun destroyPlayer(uid: Long) {
if (playerUid == uid) {
releasePlayer()
// Reset vars
playWhenReady = true
mediaItemIndex = 0
playbackPosition = 0L
playerUris = null
playerUid = null
}
}
private fun releasePlayer() {
player?.let { exoPlayer ->
playbackPosition = exoPlayer.currentPosition
mediaItemIndex = exoPlayer.currentMediaItemIndex
playWhenReady = exoPlayer.playWhenReady
exoPlayer.release()
}
player = null
binding.videoView.visibility = View.GONE
}
/**
* Make the app fullscreen.
*/
private fun setFullscreen(value: Boolean) {
if (value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
window.attributes.layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.insetsController?.apply {
hide(WindowInsets.Type.statusBars())
systemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}
} else {
@Suppress("Deprecation")
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_IMMERSIVE
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
window.attributes.layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.insetsController?.apply {
show(WindowInsets.Type.statusBars())
}
} else {
@Suppress("Deprecation")
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE
}
}
}
/**
* Store a given theme for restoreTheme.
*/
fun storeTheme(color: String?, isDark: Boolean) {
if (color == null) return
getSharedPreferences(getString(R.string.preferences_key), 0).edit()
.putString(getString(R.string.preferences_theme_color), color)
.putBoolean(getString(R.string.preferences_theme_dark), isDark)
.apply()
}
/**
* Restore the last known theme color.
*/
fun restoreTheme() {
val preferences = getSharedPreferences(getString(R.string.preferences_key), 0)
val color = preferences.getString(getString(R.string.preferences_theme_color), null)
val isDark = preferences.getBoolean(getString(R.string.preferences_theme_dark), false)
applyTheme(color, isDark)
}
/**
* Apply a color theme.
*/
fun applyTheme(color: String?, isDark: Boolean) {
if (color == null) return
// Set system bars
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val appearance =
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS or WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
window.insetsController?.setSystemBarsAppearance(
if (isDark) 0 else appearance,
appearance
)
} else {
window.decorView.systemUiVisibility =
if (isDark) 0 else View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
}
// Set colors
try {
val parsed = Color.parseColor(color.trim())
window.navigationBarColor = parsed
window.statusBarColor = parsed
} catch (e: Exception) {
Log.w(TAG, "Invalid color: $color")
return
}
}
/**
* Do a soft refresh on the open timeline
*/
fun refreshTimeline(force: Boolean = false) {
runOnUiThread {
// Check webview is loaded
if (binding.webview.url == null) return@runOnUiThread
// Schedule for resume if not active
if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED) || force) {
mNeedRefresh = false
busEmit("nativex:db:updated")
busEmit("memories:timeline:soft-refresh")
} else {
mNeedRefresh = true
}
}
}
/**
* Emit an event to the nextcloud event bus
*/
fun busEmit(event: String, data: String = "null") {
runOnUiThread {
if (binding.webview.url == null) return@runOnUiThread
binding.webview.evaluateJavascript(
"window._nc_event_bus?.emit('$event', $data)",
null
)
}
}
}

View File

@ -1,311 +0,0 @@
package gallery.memories
import android.net.Uri
import android.util.Log
import android.view.SoundEffectConstants
import android.webkit.JavascriptInterface
import android.webkit.WebResourceRequest
import android.webkit.WebResourceResponse
import android.widget.Toast
import androidx.media3.common.util.UnstableApi
import gallery.memories.service.AccountService
import gallery.memories.service.DownloadService
import gallery.memories.service.HttpService
import gallery.memories.service.ImageService
import gallery.memories.service.PermissionsService
import gallery.memories.service.TimelineQuery
import org.json.JSONArray
import java.io.ByteArrayInputStream
import java.net.URLDecoder
@UnstableApi
class NativeX(private val mCtx: MainActivity) {
val TAG = NativeX::class.java.simpleName
private var themeStored = false
val query = TimelineQuery(mCtx)
val image = ImageService(mCtx, query)
val http = HttpService()
val account = AccountService(mCtx, http)
val permissions = PermissionsService(mCtx).register()
init {
dlService = DownloadService(mCtx, query)
}
companion object {
var dlService: DownloadService? = null
}
fun destroy() {
dlService = null
query.destroy()
}
object API {
val LOGIN = Regex("^/api/login/.+$")
val DAYS = Regex("^/api/days$")
val DAY = Regex("^/api/days/\\d+$")
val IMAGE_INFO = Regex("^/api/image/info/\\d+$")
val IMAGE_DELETE = Regex("^/api/image/delete/[0-9a-f]+(,[0-9a-f]+)*$")
val IMAGE_PREVIEW = Regex("^/image/preview/\\d+$")
val IMAGE_FULL = Regex("^/image/full/[0-9a-f]+$")
val SHARE_URL = Regex("^/api/share/url/.+$")
val SHARE_BLOB = Regex("^/api/share/blobs$")
val CONFIG_ALLOW_MEDIA = Regex("^/api/config/allow_media/\\d+$")
}
@JavascriptInterface
fun isNative(): Boolean {
return true
}
@JavascriptInterface
fun setThemeColor(color: String?, isDark: Boolean) {
// Save for getting it back on next start
if (!themeStored && http.isLoggedIn()) {
themeStored = true
mCtx.storeTheme(color, isDark);
}
// Apply the theme
mCtx.runOnUiThread {
mCtx.applyTheme(color, isDark)
}
}
@JavascriptInterface
fun playTouchSound() {
mCtx.runOnUiThread {
mCtx.binding.webview.playSoundEffect(SoundEffectConstants.CLICK)
}
}
@JavascriptInterface
fun toast(message: String, long: Boolean = false) {
mCtx.runOnUiThread {
val duration = if (long) Toast.LENGTH_LONG else Toast.LENGTH_SHORT
Toast.makeText(mCtx, message, duration).show()
}
}
@JavascriptInterface
fun logout() {
account.loggedOut()
}
@JavascriptInterface
fun reload() {
mCtx.runOnUiThread {
mCtx.loadDefaultUrl()
}
}
@JavascriptInterface
fun downloadFromUrl(url: String?, filename: String?) {
if (url == null || filename == null) return;
dlService!!.queue(url, filename)
}
@JavascriptInterface
fun setShareBlobs(objects: String?) {
if (objects == null) return;
dlService!!.setShareBlobs(JSONArray(objects))
}
@JavascriptInterface
fun playVideo(auid: String, fileid: Long, urlsArray: String) {
mCtx.threadPool.submit {
// Get URI of remote videos
val urls = JSONArray(urlsArray)
val list = Array(urls.length()) {
Uri.parse(urls.getString(it))
}
// Get URI of local video
val videos = query.getSystemImagesByAUIDs(arrayListOf(auid))
// Play with exoplayer
mCtx.runOnUiThread {
if (!videos.isEmpty()) {
mCtx.initializePlayer(arrayOf(videos[0].uri), fileid)
} else {
mCtx.initializePlayer(list, fileid)
}
}
}
}
@JavascriptInterface
fun destroyVideo(fileid: Long) {
mCtx.runOnUiThread {
mCtx.destroyPlayer(fileid)
}
}
@JavascriptInterface
fun configSetLocalFolders(json: String?) {
if (json == null) return;
query.localFolders = JSONArray(json)
}
@JavascriptInterface
fun configGetLocalFolders(): String {
return query.localFolders.toString()
}
@JavascriptInterface
fun configHasMediaPermission(): Boolean {
return permissions.hasAllowMedia() && permissions.hasMediaPermission()
}
@JavascriptInterface
fun getSyncStatus(): Int {
return query.syncStatus
}
@JavascriptInterface
fun setHasRemote(auids: String, buids: String, value: Boolean) {
Log.v(TAG, "setHasRemote: auids=$auids, buids=$buids, value=$value")
mCtx.threadPool.submit {
val auidArray = JSONArray(auids)
val buidArray = JSONArray(buids)
query.setHasRemote(
List(auidArray.length()) { auidArray.getString(it) },
List(buidArray.length()) { buidArray.getString(it) },
value
)
}
}
fun handleRequest(request: WebResourceRequest): WebResourceResponse {
val path = request.url.path ?: return makeErrorResponse()
val response = try {
when (request.method) {
"GET" -> {
routerGet(request)
}
"OPTIONS" -> {
WebResourceResponse(
"text/plain",
"UTF-8",
ByteArrayInputStream("".toByteArray())
)
}
else -> {
throw Exception("Method Not Allowed")
}
}
} catch (e: Exception) {
Log.w(TAG, "handleRequest: " + e.message)
makeErrorResponse()
}
// Allow CORS from all origins
response.responseHeaders = mutableMapOf(
"Access-Control-Allow-Origin" to "*",
"Access-Control-Allow-Headers" to "*"
)
// Cache image responses for 7 days
if (path.matches(API.IMAGE_PREVIEW) || path.matches(API.IMAGE_FULL)) {
response.responseHeaders["Cache-Control"] = "max-age=604800"
}
return response
}
@Throws(Exception::class)
private fun routerGet(request: WebResourceRequest): WebResourceResponse {
val path = request.url.path ?: return makeErrorResponse()
val parts = path.split("/").toTypedArray()
return if (path.matches(API.LOGIN)) {
makeResponse(
account.login(
URLDecoder.decode(parts[3], "UTF-8"),
request.url.getBooleanQueryParameter("trustAll", false)
)
)
} else if (path.matches(API.DAYS)) {
makeResponse(query.getDays())
} else if (path.matches(API.DAY)) {
makeResponse(query.getDay(parts[3].toLong()))
} else if (path.matches(API.IMAGE_INFO)) {
makeResponse(query.getImageInfo(parts[4].toLong()))
} else if (path.matches(API.IMAGE_DELETE)) {
makeResponse(
query.delete(
parseIds(parts[4]),
request.url.getBooleanQueryParameter("dry", false)
)
)
} else if (path.matches(API.IMAGE_PREVIEW)) {
makeResponse(image.getPreview(parts[3].toLong()), "image/jpeg")
} else if (path.matches(API.IMAGE_FULL)) {
makeResponse(image.getFull(parts[3]), "image/jpeg")
} else if (path.matches(API.SHARE_URL)) {
makeResponse(dlService!!.shareUrl(URLDecoder.decode(parts[4], "UTF-8")))
} else if (path.matches(API.SHARE_BLOB)) {
makeResponse(dlService!!.shareBlobs())
} else if (path.matches(API.CONFIG_ALLOW_MEDIA)) {
permissions.setAllowMedia(true)
if (permissions.requestMediaPermissionSync()) {
doMediaSync(true) // separate thread
}
makeResponse("done")
} else {
throw Exception("Path did not match any known API route: $path")
}
}
private fun makeResponse(bytes: ByteArray?, mimeType: String?): WebResourceResponse {
return if (bytes != null) {
WebResourceResponse(mimeType, "UTF-8", ByteArrayInputStream(bytes))
} else makeErrorResponse()
}
private fun makeResponse(json: Any): WebResourceResponse {
return makeResponse(json.toString().toByteArray(), "application/json")
}
private fun makeErrorResponse(): WebResourceResponse {
val response = WebResourceResponse(
"application/json",
"UTF-8",
ByteArrayInputStream("{}".toByteArray())
)
response.setStatusCodeAndReasonPhrase(500, "Internal Server Error")
return response
}
private fun parseIds(ids: String): List<String> {
return ids.trim().split(",")
}
fun doMediaSync(forceFull: Boolean) {
if (permissions.hasAllowMedia()) {
// Full sync if this is the first time permission was granted
val fullSync = forceFull || !permissions.hasMediaPermission()
mCtx.threadPool.submit {
// Block for media permission
if (!permissions.requestMediaPermissionSync()) return@submit
// Full sync requested
if (fullSync) query.syncFullDb()
// Run delta sync and register hooks
query.initialize()
}
}
}
}

View File

@ -1,49 +0,0 @@
package gallery.memories.dao
import android.content.Context
import androidx.room.Database
import androidx.room.Room.databaseBuilder
import androidx.room.RoomDatabase
import androidx.sqlite.db.SupportSQLiteDatabase
import gallery.memories.R
import gallery.memories.mapper.Photo
@Database(entities = [Photo::class], version = 34)
abstract class AppDatabase : RoomDatabase() {
abstract fun photoDao(): PhotoDao
companion object {
private val DATABASE_NAME = "memories_room"
@Volatile
private var INSTANCE: AppDatabase? = null
fun get(context: Context): AppDatabase {
if (INSTANCE == null) {
synchronized(AppDatabase::class.java) {
val ctx = context.applicationContext
if (INSTANCE == null) {
INSTANCE = databaseBuilder(ctx, AppDatabase::class.java, DATABASE_NAME)
.fallbackToDestructiveMigration()
.addCallback(callbacks(ctx))
.build()
}
}
}
return INSTANCE!!
}
private fun callbacks(ctx: Context): Callback {
return object : Callback() {
override fun onDestructiveMigration(db: SupportSQLiteDatabase) {
super.onDestructiveMigration(db)
// retrigger synchronization whenever database is destructed
ctx.getSharedPreferences(ctx.getString(R.string.preferences_key), 0).edit()
.remove(ctx.getString(R.string.preferences_last_sync_time))
.apply()
}
}
}
}
}

View File

@ -1,47 +0,0 @@
package gallery.memories.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import gallery.memories.mapper.Bucket
import gallery.memories.mapper.Day
import gallery.memories.mapper.Photo
@Dao
interface PhotoDao {
@Query("SELECT 1")
fun ping(): Int
@Query("SELECT dayid, COUNT(local_id) AS count FROM photos WHERE bucket_id IN (:bucketIds) AND has_remote = 0 GROUP BY dayid ORDER BY dayid DESC")
fun getDays(bucketIds: List<String>): List<Day>
@Query("SELECT * FROM photos WHERE dayid=:dayId AND bucket_id IN (:buckets) AND has_remote = 0 ORDER BY date_taken DESC")
fun getPhotosByDay(dayId: Long, buckets: List<String>): List<Photo>
@Query("DELETE FROM photos WHERE local_id IN (:fileIds)")
fun deleteFileIds(fileIds: List<Long>)
@Query("SELECT * FROM photos WHERE local_id IN (:fileIds)")
fun getPhotosByFileIds(fileIds: List<Long>): List<Photo>
@Query("SELECT * FROM photos WHERE auid IN (:auids)")
fun getPhotosByAUIDs(auids: List<String>): List<Photo>
@Query("UPDATE photos SET flag=1")
fun flagAll()
@Query("UPDATE photos SET flag=0 WHERE local_id=:fileId")
fun unflag(fileId: Long)
@Query("DELETE FROM photos WHERE flag=1")
fun deleteFlagged()
@Insert
fun insert(vararg photos: Photo)
@Query("SELECT bucket_id, bucket_name FROM photos GROUP BY bucket_id")
fun getBuckets(): List<Bucket>
@Query("UPDATE photos SET has_remote=:v WHERE auid IN (:auids) OR buid IN (:buids)")
fun setHasRemote(auids: List<String>, buids: List<String>, v: Boolean)
}

View File

@ -1,8 +0,0 @@
package gallery.memories.mapper
import androidx.room.ColumnInfo
data class Bucket(
@ColumnInfo(name = "bucket_id") val id: String,
@ColumnInfo(name = "bucket_name") val name: String,
)

View File

@ -1,8 +0,0 @@
package gallery.memories.mapper
import androidx.room.ColumnInfo
data class Day(
@ColumnInfo(name = "dayid") val dayId: Long,
@ColumnInfo(name = "count") val count: Long
)

View File

@ -1,59 +0,0 @@
package gallery.memories.mapper
import androidx.exifinterface.media.ExifInterface
class Fields {
object Day {
const val DAYID = Photo.DAYID
const val COUNT = "count"
}
object Photo {
const val FILEID = "fileid"
const val BASENAME = "basename"
const val MIMETYPE = "mimetype"
const val HEIGHT = "h"
const val WIDTH = "w"
const val SIZE = "size"
const val ETAG = "etag"
const val DATETAKEN = "datetaken"
const val EPOCH = "epoch"
const val AUID = "auid"
const val BUID = "buid"
const val DAYID = "dayid"
const val ISVIDEO = "isvideo"
const val VIDEO_DURATION = "video_duration"
const val EXIF = "exif"
const val PERMISSIONS = "permissions"
}
object Perm {
const val DELETE = "D"
}
object EXIF {
val MAP = mapOf(
ExifInterface.TAG_APERTURE_VALUE to "Aperture",
ExifInterface.TAG_FOCAL_LENGTH to "FocalLength",
ExifInterface.TAG_F_NUMBER to "FNumber",
ExifInterface.TAG_SHUTTER_SPEED_VALUE to "ShutterSpeed",
ExifInterface.TAG_EXPOSURE_TIME to "ExposureTime",
ExifInterface.TAG_ISO_SPEED to "ISO",
ExifInterface.TAG_DATETIME_ORIGINAL to "DateTimeOriginal",
ExifInterface.TAG_OFFSET_TIME_ORIGINAL to "OffsetTimeOriginal",
ExifInterface.TAG_GPS_LATITUDE to "GPSLatitude",
ExifInterface.TAG_GPS_LONGITUDE to "GPSLongitude",
ExifInterface.TAG_GPS_ALTITUDE to "GPSAltitude",
ExifInterface.TAG_MAKE to "Make",
ExifInterface.TAG_MODEL to "Model",
ExifInterface.TAG_ORIENTATION to "Orientation",
ExifInterface.TAG_IMAGE_DESCRIPTION to "Description"
)
}
object Bucket {
const val ID = "id"
const val NAME = "name"
const val ENABLED = "enabled"
}
}

View File

@ -1,32 +0,0 @@
package gallery.memories.mapper
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "photos", indices = [
Index(value = ["local_id"]),
Index(value = ["auid"]),
Index(value = ["buid"]),
Index(value = ["dayid"]),
Index(value = ["flag"]),
Index(value = ["bucket_id"]),
Index(value = ["bucket_id", "dayid", "has_remote"])
]
)
data class Photo(
@PrimaryKey(autoGenerate = true) val id: Int? = null,
@ColumnInfo(name = "local_id") val localId: Long,
@ColumnInfo(name = "auid") val auid: String,
@ColumnInfo(name = "buid") val buid: String,
@ColumnInfo(name = "mtime") val mtime: Long,
@ColumnInfo(name = "date_taken") val dateTaken: Long,
@ColumnInfo(name = "dayid") val dayId: Long,
@ColumnInfo(name = "basename") val baseName: String,
@ColumnInfo(name = "bucket_id") val bucketId: Long,
@ColumnInfo(name = "bucket_name") val bucketName: String,
@ColumnInfo(name = "has_remote") val hasRemote: Boolean,
@ColumnInfo(name = "flag") val flag: Int
)

View File

@ -1,12 +0,0 @@
package gallery.memories.mapper
import org.json.JSONObject
class Response {
companion object {
val OK
get(): JSONObject {
return JSONObject().put("message", "ok")
}
}
}

View File

@ -1,262 +0,0 @@
package gallery.memories.mapper
import android.content.ContentUris
import android.content.Context
import android.icu.text.SimpleDateFormat
import android.icu.util.TimeZone
import android.net.Uri
import android.provider.MediaStore
import android.util.Log
import androidx.exifinterface.media.ExifInterface
import org.json.JSONObject
import java.io.IOException
import java.math.BigInteger
import java.security.MessageDigest
class SystemImage {
var fileId = 0L
var baseName = ""
var mimeType = ""
var dateTaken = 0L
var height = 0L
var width = 0L
var size = 0L
var mtime = 0L
var dataPath = ""
var bucketId = 0L
var bucketName = ""
var isVideo = false
var videoDuration = 0L
val uri: Uri
get() {
return ContentUris.withAppendedId(mCollection, fileId)
}
private var mCollection: Uri = IMAGE_URI
companion object {
val TAG = SystemImage::class.java.simpleName
val IMAGE_URI = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
val VIDEO_URI = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
/**
* Iterate over all images/videos in the given collection
* @param ctx Context - application context
* @param collection Uri - either IMAGE_URI or VIDEO_URI
* @param selection String? - selection string
* @param selectionArgs Array<String>? - selection arguments
* @param sortOrder String? - sort order
* @return Sequence<SystemImage>
*/
fun cursor(
ctx: Context,
collection: Uri,
selection: String?,
selectionArgs: Array<String>?,
sortOrder: String?
) = sequence {
// Base fields common for videos and images
val projection = arrayListOf(
MediaStore.Images.Media._ID,
MediaStore.Images.Media.DISPLAY_NAME,
MediaStore.Images.Media.MIME_TYPE,
MediaStore.Images.Media.HEIGHT,
MediaStore.Images.Media.WIDTH,
MediaStore.Images.Media.SIZE,
MediaStore.Images.Media.ORIENTATION,
MediaStore.Images.Media.DATE_TAKEN,
MediaStore.Images.Media.DATE_MODIFIED,
MediaStore.Images.Media.DATA,
MediaStore.Images.Media.BUCKET_ID,
MediaStore.Images.Media.BUCKET_DISPLAY_NAME,
)
// Add video-specific fields
if (collection == VIDEO_URI) {
projection.add(MediaStore.Video.Media.DURATION)
}
// Get column indices
val idColumn = projection.indexOf(MediaStore.Images.Media._ID)
val nameColumn = projection.indexOf(MediaStore.Images.Media.DISPLAY_NAME)
val mimeColumn = projection.indexOf(MediaStore.Images.Media.MIME_TYPE)
val heightColumn = projection.indexOf(MediaStore.Images.Media.HEIGHT)
val widthColumn = projection.indexOf(MediaStore.Images.Media.WIDTH)
val sizeColumn = projection.indexOf(MediaStore.Images.Media.SIZE)
val orientationColumn = projection.indexOf(MediaStore.Images.Media.ORIENTATION)
val dateTakenColumn = projection.indexOf(MediaStore.Images.Media.DATE_TAKEN)
val dateModifiedColumn = projection.indexOf(MediaStore.Images.Media.DATE_MODIFIED)
val dataColumn = projection.indexOf(MediaStore.Images.Media.DATA)
val bucketIdColumn = projection.indexOf(MediaStore.Images.Media.BUCKET_ID)
val bucketNameColumn = projection.indexOf(MediaStore.Images.Media.BUCKET_DISPLAY_NAME)
// Query content resolver
ctx.contentResolver.query(
collection,
projection.toTypedArray(),
selection,
selectionArgs,
sortOrder
).use { cursor ->
while (cursor!!.moveToNext()) {
val image = SystemImage()
// Common fields
image.fileId = cursor.getLong(idColumn)
image.baseName = cursor.getString(nameColumn)
image.mimeType = cursor.getString(mimeColumn)
image.height = cursor.getLong(heightColumn)
image.width = cursor.getLong(widthColumn)
image.size = cursor.getLong(sizeColumn)
image.dateTaken = cursor.getLong(dateTakenColumn)
image.mtime = cursor.getLong(dateModifiedColumn)
image.dataPath = cursor.getString(dataColumn)
image.bucketId = cursor.getLong(bucketIdColumn)
image.bucketName = cursor.getString(bucketNameColumn)
image.mCollection = collection
// Swap width/height if orientation is 90 or 270
val orientation = cursor.getInt(orientationColumn)
if (orientation == 90 || orientation == 270) {
image.width = image.height.also { image.height = image.width }
}
// Video specific fields
image.isVideo = collection == VIDEO_URI
if (image.isVideo) {
val durationColumn = projection.indexOf(MediaStore.Video.Media.DURATION)
image.videoDuration = cursor.getLong(durationColumn)
}
// Add to main list
yield(image)
}
}
}
/**
* Get image or video by a list of IDs
* @param ctx Context - application context
* @param ids List<Long> - list of IDs
* @return List<SystemImage>
*/
fun getByIds(ctx: Context, ids: List<Long>): List<SystemImage> {
val selection = MediaStore.Images.Media._ID + " IN (" + ids.joinToString(",") + ")"
val images = cursor(ctx, IMAGE_URI, selection, null, null).toList()
if (images.size == ids.size) return images
return images + cursor(ctx, VIDEO_URI, selection, null, null).toList()
}
}
/**
* JSON representation of the SystemImage.
* This corresponds to IPhoto on the frontend.
*/
val json
get(): JSONObject {
val obj = JSONObject()
.put(Fields.Photo.FILEID, fileId)
.put(Fields.Photo.BASENAME, baseName)
.put(Fields.Photo.MIMETYPE, mimeType)
.put(Fields.Photo.HEIGHT, height)
.put(Fields.Photo.WIDTH, width)
.put(Fields.Photo.SIZE, size)
.put(Fields.Photo.ETAG, mtime.toString())
.put(Fields.Photo.EPOCH, epoch)
if (isVideo) {
obj.put(Fields.Photo.ISVIDEO, 1)
.put(Fields.Photo.VIDEO_DURATION, videoDuration / 1000)
}
return obj
}
/** The epoch timestamp of the image. */
val epoch
get(): Long {
return dateTaken / 1000
}
val exifInterface
get() : ExifInterface? {
if (isVideo) return null
try {
return ExifInterface(dataPath)
} catch (e: Exception) {
Log.w(TAG, "Failed to read EXIF data: " + e.message)
return null
}
}
/** The UTC dateTaken timestamp of the image. */
fun utcDate(exif: ExifInterface?): Long {
// Get EXIF date using ExifInterface if image
if (exif != null) {
try {
val exifDate = exif.getAttribute(ExifInterface.TAG_DATETIME)
?: throw IOException()
val sdf = SimpleDateFormat("yyyy:MM:dd HH:mm:ss")
sdf.timeZone = TimeZone.GMT_ZONE
sdf.parse(exifDate).let {
return it.time / 1000
}
} catch (e: Exception) {
Log.w(TAG, "Failed to read EXIF datetime: " + e.message)
}
}
// No way to get the actual local date, so just assume current timezone
return (dateTaken + TimeZone.getDefault().getOffset(dateTaken).toLong()) / 1000
}
fun auid(): String {
return md5("$epoch$size")
}
fun buid(exif: ExifInterface?): String {
var sfx = "size=$size"
if (exif != null) {
try {
val iuid = exif.getAttribute(ExifInterface.TAG_IMAGE_UNIQUE_ID)
?: throw IOException()
sfx = "iuid=$iuid"
} catch (e: Exception) {
Log.w(TAG, "Failed to read EXIF unique ID ($baseName): " + e.message)
}
}
return md5("$baseName$sfx");
}
/**
* The database Photo object corresponding to the SystemImage.
* This should ONLY be used for insertion into the database.
*/
val photo
get(): Photo {
val exif = exifInterface
val dateCache = utcDate(exif)
return Photo(
localId = fileId,
auid = auid(),
buid = buid(exif),
mtime = mtime,
dateTaken = dateCache,
dayId = dateCache / 86400,
baseName = baseName,
bucketId = bucketId,
bucketName = bucketName,
flag = 0,
hasRemote = false
)
}
private fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
return BigInteger(1, md.digest(input.toByteArray())).toString(16).padStart(32, '0')
}
}

View File

@ -1,224 +0,0 @@
package gallery.memories.service
import SecureStorage
import android.content.Intent
import android.net.Uri
import android.util.Log
import android.widget.Toast
import androidx.media3.common.util.UnstableApi
import gallery.memories.MainActivity
import gallery.memories.R
import io.github.g00fy2.versioncompare.Version
@UnstableApi
class AccountService(private val mCtx: MainActivity, private val mHttp: HttpService) {
companion object {
val TAG = AccountService::class.java.simpleName
}
private val store = SecureStorage(mCtx)
/**
* Make the first request to log in
* @param url The URL of the Nextcloud server
* @param trustAll Whether to trust all certificates
*/
fun login(url: String, trustAll: Boolean) {
try {
mHttp.build(url, trustAll)
val res = mHttp.getApiDescription()
if (res.code != 200) {
throw Exception("${url}api/describe (status ${res.code})")
}
val body = mHttp.bodyJson(res) ?: throw Exception("Failed to parse API description")
val baseUrl = body.getString("baseUrl")
val loginFlowUrl = body.getString("loginFlowUrl")
loginFlow(baseUrl, loginFlowUrl)
} catch (e: Exception) {
toast("Error: ${e.message}")
throw Exception("Failed to connect to server: ${e.message}")
}
}
/**
* Login to a server
* @param baseUrl The base URL of the server
* @param loginFlowUrl The login flow URL
* @throws Exception If the login flow failed
*/
fun loginFlow(baseUrl: String, loginFlowUrl: String) {
val res = mHttp.postLoginFlow(loginFlowUrl)
// Check if 200 was received
if (res.code != 200) {
throw Exception("Login flow returned a ${res.code} status code. Check your reverse proxy configuration and overwriteprotocol is correct.")
}
// Get body as JSON
val body = mHttp.bodyJson(res) ?: throw Exception("Failed to parse login flow response")
// Parse response body as JSON
val pollObj = body.getJSONObject("poll")
val pollToken = pollObj.getString("token")
val pollUrl = pollObj.getString("endpoint")
val loginUrl = body.getString("login")
// Open login page in browser
mCtx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(loginUrl)))
// Start polling in background
Thread { pollLogin(pollUrl, pollToken, baseUrl) }.start()
}
/**
* Poll the login flow URL until we get a login token
* @param pollUrl The login flow URL
* @param pollToken The login token
* @param baseUrl The base URL of the server
*/
private fun pollLogin(pollUrl: String, pollToken: String, baseUrl: String) {
mCtx.binding.webview.post {
mCtx.binding.webview.loadUrl("file:///android_asset/waiting.html")
}
var pollCount = 0
while (pollCount < 10 * 60) {
pollCount += 3
// Sleep for 3s
Thread.sleep(3000)
try {
val response = mHttp.getPollLogin(pollUrl, pollToken)
val body = mHttp.bodyJson(response) ?: throw Exception("Failed to parse login flow response")
Log.v(TAG, "pollLogin: Got status code ${response.code}")
// Check status code
if (response.code != 200) {
throw Exception("Failed to poll login flow")
}
val loginName = body.getString("loginName")
val appPassword = body.getString("appPassword")
toast("Logged in, waiting for next page ...")
mCtx.runOnUiThread {
// Save login info (also updates header)
storeCredentials(baseUrl, loginName, appPassword)
// Go to next screen
mHttp.loadWebView(mCtx.binding.webview, "nxsetup")
}
return
} catch (e: Exception) {
continue
}
}
}
/**
* Check if the credentials are valid and the server version is supported
* Makes a toast to the user if something is wrong
*/
fun checkCredentialsAndVersion() {
if (!mHttp.isLoggedIn()) return
try {
val response = mHttp.getApiDescription()
val body = mHttp.bodyJson(response)
// Check status code
if (response.code == 401) {
return loggedOut()
}
// Could not connect to memories
if (response.code == 404) {
return toast(mCtx.getString(R.string.err_no_ver))
}
// Check body
if (body == null || response.code != 200) {
toast(mCtx.getString(R.string.err_no_describe))
return
}
// Get body values
val uid = body.get("uid")
val version = body.getString("version")
// Check UID exists
if (uid.equals(null)) {
return loggedOut()
}
// Check minimum version
if (Version(version) < Version(mCtx.getString(R.string.min_server_version))) {
return toast(mCtx.getString(R.string.err_no_ver))
}
} catch (e: Exception) {
Log.w(TAG, "checkCredentialsAndVersion: ", e)
return
}
}
/**
* Handle a logout. Delete the stored credentials and go back to the login screen.
*/
fun loggedOut() {
toast(mCtx.getString(R.string.err_logged_out))
deleteCredentials()
mCtx.runOnUiThread {
mCtx.loadDefaultUrl()
}
}
/**
* Store the credentials
* @param url The URL to store
* @param user The username to store
* @param password The password to store
*/
fun storeCredentials(url: String, user: String, password: String) {
store.saveCredentials(Credential(
url = url,
trustAll = mHttp.isTrustingAllCertificates,
username = user,
token = password,
))
refreshCredentials()
}
/**
* Delete the stored credentials
*/
fun deleteCredentials() {
store.deleteCredentials()
mHttp.setAuthHeader(null)
mHttp.build(null, false)
}
/**
* Refresh the authorization header
*/
fun refreshCredentials() {
val cred = store.getCredentials() ?: return
mHttp.build(cred.url, cred.trustAll)
mHttp.setAuthHeader(Pair(cred.username, cred.token))
}
/**
* Show a toast on the UI thread
* @param message The message to show
*/
private fun toast(message: String) {
mCtx.runOnUiThread {
Toast.makeText(mCtx, message, Toast.LENGTH_LONG).show()
}
}
}

View File

@ -1,33 +0,0 @@
package gallery.memories.service
import android.content.Context
import gallery.memories.R
class ConfigService(private val mCtx: Context) {
companion object {
private var mEnabledBuckets: List<String>? = null
}
/**
* Get the list of enabled local folders
* @return The list of enabled local folders
*/
var enabledBucketIds: List<String>
get() {
if (mEnabledBuckets != null) return mEnabledBuckets!!
mEnabledBuckets = mCtx.getSharedPreferences(mCtx.getString(R.string.preferences_key), 0)
.getStringSet(mCtx.getString(R.string.preferences_enabled_local_folders), null)
?.toList()
?: listOf()
return mEnabledBuckets!!
}
set(value) {
mEnabledBuckets = value
mCtx.getSharedPreferences(mCtx.getString(R.string.preferences_key), 0).edit()
.putStringSet(
mCtx.getString(R.string.preferences_enabled_local_folders),
value.toSet()
)
.apply()
}
}

View File

@ -1,8 +0,0 @@
package gallery.memories.service
data class Credential(
var url: String,
var trustAll: Boolean,
var username: String,
var token: String,
)

View File

@ -1,16 +0,0 @@
package gallery.memories.service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import androidx.media3.common.util.UnstableApi
import gallery.memories.NativeX
@UnstableApi class DownloadBroadcastReceiver : BroadcastReceiver() {
/**
* Callback when download is complete
*/
override fun onReceive(context: Context, intent: Intent) {
NativeX.dlService?.runDownloadCallback(intent)
}
}

View File

@ -1,161 +0,0 @@
package gallery.memories.service
import android.app.DownloadManager
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Environment
import android.webkit.CookieManager
import androidx.appcompat.app.AppCompatActivity
import androidx.collection.ArrayMap
import androidx.media3.common.util.UnstableApi
import org.json.JSONArray
import java.util.concurrent.CountDownLatch
@UnstableApi class DownloadService(private val mActivity: AppCompatActivity, private val query: TimelineQuery) {
private val mDownloads: MutableMap<Long, () -> Unit> = ArrayMap()
private var mShareBlobs: JSONArray? = null
/**
* Callback when download is complete
* @param intent The intent that triggered the callback
*/
fun runDownloadCallback(intent: Intent) {
if (mActivity.isDestroyed) return
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE == intent.action) {
val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0)
synchronized(mDownloads) {
mDownloads[id]?.let {
it()
mDownloads.remove(id)
return
}
}
}
}
/**
* Queue a download
* @param url The URL to download
* @param filename The filename to save the download as
* @return The download ID
*/
fun queue(url: String, filename: String): Long {
val uri = Uri.parse(url)
val manager = mActivity.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
val request = DownloadManager.Request(uri)
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
// Copy all cookies from the webview to the download request
val cookies = CookieManager.getInstance().getCookie(url)
request.addRequestHeader("cookie", cookies)
if (filename != "") {
// Save the file to external storage
request.setDestinationInExternalPublicDir(
Environment.DIRECTORY_DOWNLOADS,
"memories/$filename"
)
}
// Start the download
return manager.enqueue(request)
}
/**
* Share a URL as a string
* @param url The URL to share
* @return True if the URL was shared
*/
fun shareUrl(url: String): Boolean {
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, url)
mActivity.startActivity(Intent.createChooser(intent, null))
return true
}
/**
* Share the blobs from URLs already set by setShareBlobs
* @return True if the URL was shared
*/
@Throws(Exception::class)
fun shareBlobs(): Boolean {
if (mShareBlobs == null) throw Exception("No blobs to share")
// All URIs to share including remote and local files
val uris = ArrayList<Uri>()
val dlIds = ArrayList<Long>()
// Process all objects to share
for (i in 0 until mShareBlobs!!.length()) {
val obj = mShareBlobs!!.getJSONObject(i)
// If AUID is found, then look for local file
val auid = obj.getString("auid")
if (auid != "") {
val sysImgs = query.getSystemImagesByAUIDs(listOf(auid))
if (sysImgs.isNotEmpty()) {
uris.add(sysImgs[0].uri)
continue
}
}
// Queue a download for remote files
dlIds.add(queue(obj.getString("href"), ""))
}
// Wait for all downloads to complete
val latch = CountDownLatch(dlIds.size)
synchronized(mDownloads) {
for (dlId in dlIds) {
mDownloads.put(dlId, fun() { latch.countDown() })
}
}
latch.await()
// Get the URI of the downloaded file
for (id in dlIds) {
val sUri = getDownloadedFileURI(id) ?: throw Exception("Failed to download file")
uris.add(Uri.parse(sUri))
}
// Create sharing intent
val intent = Intent(Intent.ACTION_SEND_MULTIPLE)
intent.type = "*/*"
intent.putExtra(Intent.EXTRA_STREAM, uris)
mActivity.startActivity(Intent.createChooser(intent, null))
// Reset the blobs
mShareBlobs = null
return true
}
/**
* Set the blobs to share
* @param objects The blobs to share
*/
fun setShareBlobs(objects: JSONArray) {
mShareBlobs = objects
}
/**
* Get the URI of a downloaded file from download ID
* @param downloadId The download ID
* @return The URI of the downloaded file
*/
private fun getDownloadedFileURI(downloadId: Long): String? {
val downloadManager =
mActivity.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
val query = DownloadManager.Query()
query.setFilterById(downloadId)
val cursor = downloadManager.query(query)
if (cursor.moveToFirst()) {
val columnIndex = cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)
return cursor.getString(columnIndex)
}
cursor.close()
return null
}
}

View File

@ -1,194 +0,0 @@
package gallery.memories.service
import android.net.Uri
import android.util.Base64
import android.webkit.WebView
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import org.json.JSONArray
import org.json.JSONObject
import java.security.SecureRandom
import java.security.cert.CertificateException
import java.security.cert.X509Certificate
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
class HttpService {
companion object {
val TAG = HttpService::class.java.simpleName
}
private var client = OkHttpClient()
private var authHeader: String? = null
private var mBaseUrl: String? = null
private var mTrustAll = false
/**
* Check if all certificates are trusted
*/
val isTrustingAllCertificates: Boolean
get() = mTrustAll
/**
* Check if the HTTP service is logged in
*/
fun isLoggedIn(): Boolean {
return authHeader != null
}
/**
* Build the HTTP client
* @param url The URL to use
* @param trustAll Whether to trust all certificates
*/
fun build(url: String?, trustAll: Boolean) {
mBaseUrl = url
mTrustAll = trustAll
client = if (trustAll) {
val trustAllCerts = arrayOf<TrustManager>(
object : X509TrustManager {
@Throws(CertificateException::class)
override fun checkClientTrusted(
chain: Array<X509Certificate>,
authType: String
) {
}
@Throws(CertificateException::class)
override fun checkServerTrusted(
chain: Array<X509Certificate>,
authType: String
) {
}
override fun getAcceptedIssuers(): Array<X509Certificate> {
return arrayOf()
}
}
)
val sslContext = SSLContext.getInstance("SSL")
sslContext.init(null, trustAllCerts, SecureRandom())
OkHttpClient.Builder()
.sslSocketFactory(sslContext.socketFactory, trustAllCerts[0] as X509TrustManager)
.hostnameVerifier({ hostname, session -> true })
.build()
} else {
OkHttpClient()
}
}
/**
* Set the authorization header
* @param credentials The credentials to use
*/
fun setAuthHeader(credentials: Pair<String, String>?) {
if (credentials != null) {
val auth = "${credentials.first}:${credentials.second}"
authHeader = "Basic ${Base64.encodeToString(auth.toByteArray(), Base64.NO_WRAP)}"
return
}
authHeader = null
}
/**
* Load a webview at the default page
* @param webView The webview to load
* @param subpath The subpath to load
* @return Host URL if authenticated, null otherwise
*/
fun loadWebView(webView: WebView, subpath: String? = null): String? {
// Load app interface if authenticated
if (authHeader != null && mBaseUrl != null) {
var url = mBaseUrl
if (subpath != null) url += subpath
// Get host name
val host = Uri.parse(url).host
// Clear webview history
webView.clearHistory()
// Set authorization header
webView.loadUrl(url!!, mapOf("Authorization" to authHeader))
return host
}
return null
}
/** Get body as JSON Object */
@Throws(Exception::class)
fun bodyJson(response: Response): JSONObject? {
return getBody(response)?.let { JSONObject(it) }
}
/** Get body as JSON array */
@Throws(Exception::class)
fun bodyJsonArray(response: Response): JSONArray? {
return getBody(response)?.let { JSONArray(it) }
}
/** Get a string from the response body */
@Throws(Exception::class)
fun getBody(response: Response): String? {
val body = response.body?.string()
response.body?.close()
return body
}
/** Get the API description request */
@Throws(Exception::class)
fun getApiDescription(): Response {
return runRequest(buildGet("api/describe"))
}
/** Make login flow request */
@Throws(Exception::class)
fun postLoginFlow(loginFlowUrl: String): Response {
return runRequest(
Request.Builder()
.url(loginFlowUrl)
.header("User-Agent", "Memories")
.post("".toRequestBody("application/json".toMediaTypeOrNull()))
.build()
)
}
/** Make login polling request */
@Throws(Exception::class)
fun getPollLogin(pollUrl: String, pollToken: String): Response {
return runRequest(
Request.Builder()
.url(pollUrl)
.post("token=$pollToken".toRequestBody("application/x-www-form-urlencoded".toMediaTypeOrNull()))
.build()
)
}
/** Run a request and get a JSON object */
@Throws(Exception::class)
private fun runRequest(request: Request): Response {
return client.newCall(request).execute()
}
/** Build a GET request */
private fun buildGet(path: String, auth: Boolean = true): Request {
val builder = Request.Builder()
.url(mBaseUrl + path)
.header("User-Agent", "Memories")
.get()
if (auth)
builder.header("Authorization", authHeader ?: "")
return builder.build()
}
}

View File

@ -1,70 +0,0 @@
package gallery.memories.service
import android.content.ContentUris
import android.content.Context
import android.graphics.Bitmap
import android.graphics.ImageDecoder
import android.os.Build
import android.provider.MediaStore
import androidx.media3.common.util.UnstableApi
import java.io.ByteArrayOutputStream
@UnstableApi class ImageService(private val mCtx: Context, private val query: TimelineQuery) {
/**
* Get a preview image for a given image ID
* @param id The image ID
* @return The preview image as a JPEG byte array
*/
@Throws(Exception::class)
fun getPreview(id: Long): ByteArray {
val bitmap =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
mCtx.contentResolver.loadThumbnail(
ContentUris.withAppendedId(
MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL),
id
),
android.util.Size(2048, 2048),
null
)
} else {
MediaStore.Images.Thumbnails.getThumbnail(
mCtx.contentResolver, id, MediaStore.Images.Thumbnails.FULL_SCREEN_KIND, null
)
?: MediaStore.Video.Thumbnails.getThumbnail(
mCtx.contentResolver, id, MediaStore.Video.Thumbnails.FULL_SCREEN_KIND, null
)
?: throw Exception("Thumbnail not found")
}
val stream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, stream)
return stream.toByteArray()
}
/**
* Get a full image for a given image ID
* @param id The image ID
* @return The full image as a JPEG byte array
*/
@Throws(Exception::class)
fun getFull(auid: String): ByteArray {
val sysImgs = query.getSystemImagesByAUIDs(listOf(auid))
if (sysImgs.isEmpty()) {
throw Exception("Image not found")
}
val uri = sysImgs[0].uri
val bitmap =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
ImageDecoder.decodeBitmap(ImageDecoder.createSource(mCtx.contentResolver, uri))
} else {
MediaStore.Images.Media.getBitmap(mCtx.contentResolver, uri)
?: throw Exception("Image not found")
}
val stream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, stream)
return stream.toByteArray()
}
}

View File

@ -1,80 +0,0 @@
package gallery.memories.service
import android.os.Build
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.media3.common.util.UnstableApi
import gallery.memories.MainActivity
import gallery.memories.R
import java.util.concurrent.CountDownLatch
@UnstableApi class PermissionsService(private val activity: MainActivity) {
var isGranted: Boolean = false
var latch: CountDownLatch? = null
lateinit var requestPermissionLauncher: ActivityResultLauncher<Array<String>>
fun register(): PermissionsService {
requestPermissionLauncher = activity.registerForActivityResult(
ActivityResultContracts.RequestMultiplePermissions()
) { permissions ->
// we need all of these
isGranted = permissions.all { it.value }
// Persist that we have it now
setHasMediaPermission(isGranted)
// Release latch
latch?.countDown()
}
return this
}
/**
* Requests media permission and blocks until it is granted
*/
fun requestMediaPermissionSync(): Boolean {
if (isGranted) return true
// Wait for response
latch = CountDownLatch(1)
// Request media read permission
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
requestPermissionLauncher.launch(
arrayOf(
android.Manifest.permission.READ_MEDIA_IMAGES,
android.Manifest.permission.READ_MEDIA_VIDEO,
)
)
} else {
requestPermissionLauncher.launch(arrayOf(android.Manifest.permission.READ_EXTERNAL_STORAGE))
}
latch?.await()
return isGranted
}
fun hasMediaPermission(): Boolean {
return activity.getSharedPreferences(activity.getString(R.string.preferences_key), 0)
.getBoolean(activity.getString(R.string.preferences_has_media_permission), false)
}
private fun setHasMediaPermission(v: Boolean) {
activity.getSharedPreferences(activity.getString(R.string.preferences_key), 0).edit()
.putBoolean(activity.getString(R.string.preferences_has_media_permission), v)
.apply()
}
fun hasAllowMedia(): Boolean {
return activity.getSharedPreferences(activity.getString(R.string.preferences_key), 0)
.getBoolean(activity.getString(R.string.preferences_allow_media), false)
}
fun setAllowMedia(v: Boolean) {
activity.getSharedPreferences(activity.getString(R.string.preferences_key), 0).edit()
.putBoolean(activity.getString(R.string.preferences_allow_media), v)
.apply()
}
}

View File

@ -1,95 +0,0 @@
import android.content.Context
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import android.security.keystore.KeyProperties.KEY_ALGORITHM_AES
import android.security.keystore.KeyProperties.PURPOSE_DECRYPT
import android.security.keystore.KeyProperties.PURPOSE_ENCRYPT
import android.util.Base64
import gallery.memories.service.Credential
import java.security.KeyStore
import javax.crypto.Cipher
import javax.crypto.KeyGenerator
import javax.crypto.SecretKey
import javax.crypto.spec.IvParameterSpec
class SecureStorage(private val context: Context) {
private val keyStore = KeyStore.getInstance("AndroidKeyStore")
private val keyAlias = "MemoriesKey"
init {
keyStore.load(null)
if (!keyStore.containsAlias(keyAlias)) {
generateNewKey()
}
}
fun saveCredentials(cred: Credential) {
val cipher = getCipher()
cipher.init(Cipher.ENCRYPT_MODE, getSecretKey())
val encryptedToken = cipher.doFinal(cred.token.toByteArray())
context.getSharedPreferences("credentials", Context.MODE_PRIVATE).edit()
.putString("url", cred.url)
.putBoolean("trustAll", cred.trustAll)
.putString("username", cred.username)
.putString("encryptedToken", Base64.encodeToString(encryptedToken, Base64.DEFAULT))
.putString("iv", Base64.encodeToString(cipher.iv, Base64.DEFAULT))
.apply()
}
fun getCredentials(): Credential? {
val sharedPreferences = context.getSharedPreferences("credentials", Context.MODE_PRIVATE)
val url = sharedPreferences.getString("url", null)
val trustAll = sharedPreferences.getBoolean("trustAll", false)
val username = sharedPreferences.getString("username", null)
val encryptedToken = sharedPreferences.getString("encryptedToken", null)
val ivStr = sharedPreferences.getString("iv", null)
if (url != null && username != null && encryptedToken != null && ivStr != null) {
val cipher = getCipher()
val iv = Base64.decode(ivStr, Base64.DEFAULT)
cipher.init(Cipher.DECRYPT_MODE, getSecretKey(), IvParameterSpec(iv))
val token = String(cipher.doFinal(Base64.decode(encryptedToken, Base64.DEFAULT)))
return Credential(url, trustAll, username, token)
}
return null
}
fun deleteCredentials() {
context.getSharedPreferences("credentials", Context.MODE_PRIVATE).edit()
.remove("url")
.remove("trustAll")
.remove("encryptedUsername")
.remove("encryptedToken")
.remove("iv")
.apply()
}
private fun generateNewKey() {
val keyGenerator = KeyGenerator.getInstance(KEY_ALGORITHM_AES, "AndroidKeyStore")
val keyGenSpec = KeyGenParameterSpec.Builder(
keyAlias,
PURPOSE_ENCRYPT or PURPOSE_DECRYPT
)
.setBlockModes(KeyProperties.BLOCK_MODE_CBC)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
.setUserAuthenticationRequired(false) // Change this if needed
.build()
keyGenerator.init(keyGenSpec)
keyGenerator.generateKey()
}
private fun getCipher(): Cipher {
val transformation =
"$KEY_ALGORITHM_AES/${KeyProperties.BLOCK_MODE_CBC}/${KeyProperties.ENCRYPTION_PADDING_PKCS7}"
return Cipher.getInstance(transformation)
}
private fun getSecretKey(): SecretKey {
return keyStore.getKey(keyAlias, null) as SecretKey
}
}

View File

@ -1,461 +0,0 @@
package gallery.memories.service
import android.annotation.SuppressLint
import android.app.Activity
import android.database.ContentObserver
import android.net.Uri
import android.os.Build
import android.provider.MediaStore
import android.util.Log
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.IntentSenderRequest
import androidx.activity.result.contract.ActivityResultContracts
import androidx.exifinterface.media.ExifInterface
import androidx.media3.common.util.UnstableApi
import gallery.memories.MainActivity
import gallery.memories.R
import gallery.memories.dao.AppDatabase
import gallery.memories.mapper.Fields
import gallery.memories.mapper.Response
import gallery.memories.mapper.SystemImage
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
import java.io.IOException
import java.time.Instant
import java.util.concurrent.CountDownLatch
@UnstableApi
class TimelineQuery(private val mCtx: MainActivity) {
private val TAG = TimelineQuery::class.java.simpleName
private val mConfigService = ConfigService(mCtx)
// Database
private val mDb = AppDatabase.get(mCtx)
private val mPhotoDao = mDb.photoDao()
// Photo deletion events
var deleting = false
var deleteIntentLauncher: ActivityResultLauncher<IntentSenderRequest>
var deleteCallback: ((ActivityResult?) -> Unit)? = null
// Observers
var imageObserver: ContentObserver? = null
var videoObserver: ContentObserver? = null
var refreshPending: Boolean = false
// Status of synchronization process
// -1 = not started
// >0 = number of files updated
var syncStatus = -1
init {
// Register intent launcher for callback
deleteIntentLauncher =
mCtx.registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { result: ActivityResult? ->
synchronized(this) {
deleteCallback?.let { it(result) }
}
}
}
/**
* Initialize content observers for system store.
* Runs the first sync pass.
*/
fun initialize() {
mPhotoDao.ping()
if (syncDeltaDb() > 0) {
mCtx.refreshTimeline()
}
registerHooks()
}
/**
* Destroy content observers for system store.
*/
fun destroy() {
if (imageObserver != null)
mCtx.contentResolver.unregisterContentObserver(imageObserver!!)
if (videoObserver != null)
mCtx.contentResolver.unregisterContentObserver(videoObserver!!)
}
/**
* Register content observers for system store.
*/
fun registerHooks() {
imageObserver = registerContentObserver(SystemImage.IMAGE_URI)
videoObserver = registerContentObserver(SystemImage.VIDEO_URI)
}
/**
* Register content observer for system store.
* @param uri Content URI
* @return Content observer
*/
private fun registerContentObserver(uri: Uri): ContentObserver {
val observer = object : ContentObserver(null) {
override fun onChange(selfChange: Boolean) {
super.onChange(selfChange)
// Debounce refreshes
synchronized(this@TimelineQuery) {
if (refreshPending) return
refreshPending = true
}
// Refresh after 750ms
Thread {
Thread.sleep(750)
synchronized(this@TimelineQuery) {
refreshPending = false
}
// Check if anything to update
if (syncDeltaDb() == 0 || mCtx.isDestroyed || mCtx.isFinishing) return@Thread
mCtx.refreshTimeline()
}.start()
}
}
mCtx.contentResolver.registerContentObserver(uri, true, observer)
return observer
}
/**
* Get system images by AUIDs
* @param auids List of AUIDs
* @return List of SystemImage
*/
fun getSystemImagesByAUIDs(auids: List<String>): List<SystemImage> {
val photos = mPhotoDao.getPhotosByAUIDs(auids)
if (photos.isEmpty()) return listOf()
return SystemImage.getByIds(mCtx, photos.map { it.localId })
}
/**
* Get the days response for local files.
* @return JSON response
*/
@Throws(JSONException::class)
fun getDays(): JSONArray {
return mPhotoDao.getDays(mConfigService.enabledBucketIds).map {
JSONObject()
.put(Fields.Day.DAYID, it.dayId)
.put(Fields.Day.COUNT, it.count)
}.let { JSONArray(it) }
}
/**
* Get the day response for local files.
* @param dayId Day ID
* @return JSON response
*/
@Throws(JSONException::class)
fun getDay(dayId: Long): JSONArray {
// Get the photos for the day from DB
val photos = mPhotoDao.getPhotosByDay(dayId, mConfigService.enabledBucketIds)
.map { it.localId to it }.toMap()
if (photos.isEmpty()) return JSONArray()
val fileIds = photos.keys.toMutableList()
// Get latest metadata from system table
val response = SystemImage.getByIds(mCtx, fileIds).map { image ->
// Mark file exists
fileIds.remove(image.fileId)
// Add missing fields to JSON
val json = image.json
photos[image.fileId]?.let { photo ->
json.put(Fields.Photo.AUID, photo.auid)
.put(Fields.Photo.BUID, photo.buid)
.put(Fields.Photo.DAYID, dayId)
}
json
}.let { JSONArray(it) }
// Remove files that were not found
mPhotoDao.deleteFileIds(fileIds)
return response
}
/**
* Get the image EXIF info response for local files.
* @param id File ID
* @return JSON response
*/
@Throws(Exception::class)
fun getImageInfo(id: Long): JSONObject {
val photos = mPhotoDao.getPhotosByFileIds(listOf(id))
if (photos.isEmpty()) throw Exception("File not found in database")
// Get image from system table
val images = SystemImage.getByIds(mCtx, listOf(id))
if (images.isEmpty()) throw Exception("File not found in system")
// Get the photo and image
val photo = photos[0]
val image = images[0];
// Augment image JSON with database info
val obj = image.json
.put(Fields.Photo.DAYID, photo.dayId)
.put(Fields.Photo.DATETAKEN, photo.dateTaken)
.put(Fields.Photo.PERMISSIONS, Fields.Perm.DELETE)
try {
val exif = ExifInterface(image.dataPath)
obj.put(Fields.Photo.EXIF, JSONObject().apply {
Fields.EXIF.MAP.forEach { (key, field) ->
put(field, exif.getAttribute(key))
}
})
} catch (e: IOException) {
Log.w(TAG, "Error reading EXIF data for $id")
}
return obj
}
/**
* Delete images from local database and system store.
* @param auids List of AUIDs
* @param dry Dry run (returns whether confirmation will be needed)
* @return JSON response
*/
@Throws(Exception::class)
fun delete(auids: List<String>, dry: Boolean): JSONObject {
synchronized(this) {
if (deleting) throw Exception("Already deleting another set of images")
deleting = true
}
val response = Response.OK
try {
// Get list of file IDs
val sysImgs = getSystemImagesByAUIDs(auids)
// Let the UI know how many files we are deleting
response.put("count", sysImgs.size)
// Let the UI know if we are going to ask for confirmation
response.put("confirms", Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
// Exit if dry or nothing to do
if (dry || sysImgs.isEmpty()) return response
// List of URIs
val uris = sysImgs.map { it.uri }
if (uris.isEmpty()) return Response.OK
// Delete file with media store
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val intent = MediaStore.createTrashRequest(mCtx.contentResolver, uris, true)
deleteIntentLauncher.launch(
IntentSenderRequest.Builder(intent.intentSender).build()
)
// Wait for response
val latch = CountDownLatch(1)
var res: ActivityResult? = null
deleteCallback = fun(result: ActivityResult?) {
res = result
latch.countDown()
}
latch.await()
deleteCallback = null;
// Throw if canceled or failed
if (res == null || res!!.resultCode != Activity.RESULT_OK) {
throw Exception("Delete canceled or failed")
}
} else {
for (uri in uris) {
mCtx.contentResolver.delete(uri, null, null)
}
}
// Delete from database
mPhotoDao.deleteFileIds(sysImgs.map { it.fileId })
// Clear UI cache
mCtx.busEmit("nativex:db:updated")
} finally {
synchronized(this) { deleting = false }
}
return response
}
/**
* Sync local database with system store.
* @param startTime Only sync files modified after this time
* @return Number of updated files
*/
private fun syncDb(startTime: Long): Int {
// Date modified is in seconds, not millis
val syncTime = Instant.now().toEpochMilli() / 1000;
// SystemImage query
var selection: String? = null
var selectionArgs: Array<String>? = null
// Query everything modified after startTime
if (startTime != 0L) {
selection = MediaStore.Images.Media.DATE_MODIFIED + " > ?"
selectionArgs = arrayOf(startTime.toString())
}
// Count number of updates
var updates = 0
try {
// Iterate all images from system store
for (image in SystemImage.cursor(
mCtx,
SystemImage.IMAGE_URI,
selection,
selectionArgs,
null
)) {
insertItemDb(image)
updates++
syncStatus = updates
}
// Iterate all videos from system store
for (video in SystemImage.cursor(
mCtx,
SystemImage.VIDEO_URI,
selection,
selectionArgs,
null
)) {
insertItemDb(video)
updates++
syncStatus = updates
}
// Store last sync time
mCtx.getSharedPreferences(mCtx.getString(R.string.preferences_key), 0).edit()
.putLong(mCtx.getString(R.string.preferences_last_sync_time), syncTime)
.apply()
} catch (e: Exception) {
Log.e(TAG, "Error syncing database", e)
}
// Reset sync status
synchronized(this) {
syncStatus = -1
}
// Number of updated files
return updates
}
/**
* Sync local database with system store.
* @return Number of updated files
*/
fun syncDeltaDb(): Int {
// Exit if already running
synchronized(this) {
if (syncStatus != -1) return 0
syncStatus = 0
}
// Get last sync time
val syncTime = mCtx.getSharedPreferences(mCtx.getString(R.string.preferences_key), 0)
.getLong(mCtx.getString(R.string.preferences_last_sync_time), 0L)
return syncDb(syncTime)
}
/**
* Sync local database with system store.
* Runs a full synchronization pass, flagging all files for removal.
* @return Number of updated files
*/
fun syncFullDb() {
// Exit if already running
synchronized(this) {
if (syncStatus != -1) return
syncStatus = 0
}
// Flag all images for removal
mPhotoDao.flagAll()
// Sync all files, marking them in the process
syncDb(0L)
// Clean up stale files
mPhotoDao.deleteFlagged()
}
/**
* Insert item into local database.
* @param image SystemImage
*/
@SuppressLint("SimpleDateFormat")
private fun insertItemDb(image: SystemImage) {
val fileId = image.fileId
val baseName = image.baseName
// Check if file with local_id and mtime already exists
val l = mPhotoDao.getPhotosByFileIds(listOf(fileId))
if (!l.isEmpty() && l[0].mtime == image.mtime) {
// File already exists, remove flag
mPhotoDao.unflag(fileId)
Log.v(TAG, "File already exists: $fileId / $baseName")
return
}
// Convert to photo
val photo = image.photo
// Delete file with same local_id and insert new one
mPhotoDao.deleteFileIds(listOf(fileId))
mPhotoDao.insert(photo)
Log.v(TAG, "Inserted file to local DB: $photo")
}
/**
* Set has_remote for list of AUIDs
* @param auids List of AUIDs
* @param value Value to set
*/
fun setHasRemote(auids: List<String>, buids: List<String>, value: Boolean) {
mPhotoDao.setHasRemote(auids, buids, value)
}
/**
* Active local folders response.
* This is in timeline query because it calls the database service.
*/
var localFolders: JSONArray
get() {
return mPhotoDao.getBuckets().map {
JSONObject()
.put(Fields.Bucket.ID, it.id)
.put(Fields.Bucket.NAME, it.name)
.put(Fields.Bucket.ENABLED, mConfigService.enabledBucketIds.contains(it.id))
}.let { JSONArray(it) }
}
set(value) {
val enabled = mutableListOf<String>()
for (i in 0 until value.length()) {
val obj = value.getJSONObject(i)
if (obj.getBoolean(Fields.Bucket.ENABLED)) {
enabled.add(obj.getString(Fields.Bucket.ID))
}
}
mConfigService.enabledBucketIds = enabled
}
}

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/coordinator"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.media3.ui.PlayerView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:alpha="0.0"
app:show_buffering="always"
/>
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:soundEffectsEnabled="true"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

View File

@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>

View File

@ -1,16 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="Theme.Memories" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/theme</item>
<item name="colorPrimaryVariant">@color/theme</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">200dp</dimen>
</resources>

View File

@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="theme">#2b94f0</color>
</resources>

View File

@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">16dp</dimen>
</resources>

View File

@ -1,20 +0,0 @@
<resources>
<string name="app_name">Memories</string>
<string name="min_server_version">6.1.0</string>
<string name="preferences_key">memories</string>
<string name="preferences_theme_color">themeColor</string>
<string name="preferences_theme_dark">themeDark</string>
<string name="preferences_last_sync_time">lastDbSyncTime</string>
<string name="preferences_has_media_permission">hasMediaPermission</string>
<string name="preferences_allow_media">allowMedia</string>
<string name="preferences_enabled_local_folders">enabledLocalFolders</string>
<!-- https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome -->
<string name="ua_chrome">"Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.76 Mobile Safari/537.36"</string>
<string name="ua_app_prefix">MemoriesNative/</string>
<string name="err_no_ver">Your server does not have the minimum required version of Memories</string>
<string name="err_logged_out">Logged out from server</string>
<string name="err_no_describe">Failed to connect to server. Reset app data if this persists.</string>
</resources>

View File

@ -1,25 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="Theme.Memories" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/theme</item>
<item name="colorPrimaryVariant">@color/theme</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.Memories.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Memories.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.Memories.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@ -1,12 +0,0 @@
buildscript {
ext.kotlin_version = '1.9.0'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.1.2' apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
}

View File

@ -1,23 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false

Some files were not shown because too many files have changed in this diff Show More