Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
605c4669
Commit
605c4669
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Populate lychee settings fields
parent
22ba4ad2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-app-lychee
+37
-0
37 additions, 0 deletions
src/freedombone-app-lychee
with
37 additions
and
0 deletions
src/freedombone-app-lychee
+
37
−
0
View file @
605c4669
...
...
@@ -41,6 +41,8 @@ LYCHEE_CODE=
LYCHEE_ONION_PORT
=
8105
LYCHEE_REPO
=
"https://github.com/electerious/Lychee"
LYCHEE_COMMIT
=
'27f207dcbac8488629ffc3b5a9cac78ae123bee9'
# version from Modules/Database.php
LYCHEE_VERSION
=
'030102'
LYCHEE_SHORT_DESCRIPTION
=
$'Photo album'
LYCHEE_DESCRIPTION
=
$'Photo album'
...
...
@@ -53,6 +55,28 @@ lychee_variables=(LYCHEE_REPO
DDNS_PROVIDER
MY_USERNAME
)
function
lychee_hashed_string
{
lycheestr
=
"
$1
"
{
echo
"
\$
cost = 10;"
;
echo
"if (extension_loaded('openssl')) {"
;
echo
"
\$
salt = strtr(substr(base64_encode(openssl_random_pseudo_bytes(17)),0,22), '+', '.');"
;
echo
"} elseif (extension_loaded('mcrypt')) {"
;
echo
"
\$
salt = strtr(substr(base64_encode(mcrypt_create_iv(17, MCRYPT_DEV_URANDOM)),0,22), '+', '.');"
;
echo
'} else {'
;
echo
"
\$
salt = '';"
;
echo
" for (
\$
i = 0;
\$
i < 22;
\$
i++) {"
;
echo
"
\$
salt .= substr(
\"
./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
\"
, mt_rand(0, 63), 1);"
;
echo
' }'
;
echo
'}'
;
echo
"
\$
salt = sprintf(
\"\$
2a
\$
%02d
\$\"
,
\$
cost) .
\$
salt;"
;
echo
"crypt(LYCHEE_STRING,
\$
salt);"
;
}
>
/tmp/lychee_string.php
php_str
=
$(
echo
/tmp/lychee_string.php |
sed
"s|LYCHEE_STRING|
$lycheestr
|g"
)
php
-r
"
$php_str
"
}
function
logging_on_lychee
{
echo
-n
''
}
...
...
@@ -395,7 +419,20 @@ function lychee_run_installation {
sed
-i
's|?|lychee_photos|g'
photos_table.sql
initialise_database lychee photos_table.sql
sed
-i
's|?|lychee_settings|g'
settings_table.sql
sed
-i
's|?|lychee_settings|g'
settings_content.sql
initialise_database lychee settings_table.sql
run_query lychee
"
$(
cat
settings_content.sql
)
"
sed
-i
's|?|lychee_albums|g'
albums_table.sql
initialise_database lychee albums_table.sql
# populate settings fields
lychee_identifier
=
$(
php
-r
"echo md5(microtime(true));"
)
run_query lychee
"UPDATE lychee_settings SET value = '
$lychee_identifier
' WHERE key = 'identifier' LIMIT 1"
run_query lychee
"UPDATE lychee_settings SET value = '
$LYCHEE_VERSION
' WHERE key = 'version'"
username_encrypted
=
$(
lychee_hashed_string
"root"
)
run_query lychee
"UPDATE lychee_settings SET value = '
$username_encrypted
' WHERE key = 'username'"
password_encrypted
=
$(
lychee_hashed_string
"
$LYCHEE_ADMIN_PASSWORD
"
)
run_query lychee
"UPDATE lychee_settings SET value = '
$password_encrypted
' WHERE key = 'password'"
}
function
lychee_create_config
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment