Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zheng Yile
codiaclient
Commits
b1493656
Commit
b1493656
authored
Jun 28, 2021
by
Zheng Yile
Browse files
Merge branch 'dev' into gui-master
parents
71495e4f
427cbf61
Changes
1
Hide whitespace changes
Inline
Side-by-side
codiaclient/cachectrl.py
View file @
b1493656
...
...
@@ -8,17 +8,22 @@ from .utils import passwd_hash, cookie_encrypt
variables
=
{
'cache_on'
:
True
,
'logindic'
:
{},
'tmpPath'
:
""
'appDataPath'
:
""
,
"sessionPath"
:
""
,
}
from
os
import
environ
,
path
,
makedirs
variables
[
'tmpPath'
]
=
path
.
join
(
environ
[
'temp'
]
,
'codiaclient'
)
if
not
path
.
exists
(
variables
[
'tmpPath'
]):
makedirs
(
variables
[
'tmpPath'
])
variables
[
'tmpPath'
]
=
path
.
join
(
variables
[
'tmpPath'
],
".cache"
)
from
sys
import
platform
if
platform
==
'darwin'
:
variables
[
'appDataPath'
]
=
"~/Library/codiaclient"
elif
platform
==
'win32'
variables
[
'appDataPath'
]
=
path
.
join
(
environ
[
'AppData'
],
'codiaclient'
)
if
not
path
.
exists
(
variables
[
'appDataPath'
]):
makedirs
(
variables
[
'appDataPath'
])
variables
[
'sessionPath'
]
=
path
.
join
(
variables
[
'appDataPath'
],
".cache"
)
def
cache_for_login
(
userdic
,
passwd
,
cookie
=
None
,
passwd_store_on
=
0
):
file
=
variables
[
'
tmp
Path'
]
file
=
variables
[
'
session
Path'
]
if
not
variables
[
'cache_on'
]:
report
(
"Invalid reference of function 'cache_username_passwd_cookie'."
,
1
)
return
False
...
...
@@ -57,7 +62,7 @@ def cache_for_login(userdic, passwd, cookie=None, passwd_store_on=0):
def
update_cache_for_login
(
username
,
passwd
,
passwd_store_on
=
0
):
file
=
variables
[
'
tmp
Path'
]
file
=
variables
[
'
session
Path'
]
userdic
=
variables
[
'logindic'
][
username
]
username
=
userdic
[
'username'
]
useremail
=
userdic
[
'email'
]
...
...
@@ -89,7 +94,7 @@ def update_cache_for_login(username, passwd, passwd_store_on=0):
def
cache_load
():
file
=
variables
[
'
tmp
Path'
]
file
=
variables
[
'
session
Path'
]
if
not
variables
[
'cache_on'
]:
report
(
"Invalid reference of function 'cache_load'."
,
1
)
return
False
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment