Compare commits
No commits in common. "ae211e0e95e295bd7ff3faa67709116dc1fc8023" and "3e46dc78cb53134cbfd215333c41becc0f025426" have entirely different histories.
ae211e0e95
...
3e46dc78cb
4 changed files with 10 additions and 50 deletions
24
ctl
24
ctl
|
|
@ -9,37 +9,33 @@ fi
|
|||
if [ "$action" = "init" ]; then
|
||||
cd "`dirname "$0"`"
|
||||
BASE=`pwd`
|
||||
SUDO=""
|
||||
PANDORA_USER=`ls -l update.py | cut -f3 -d" "`
|
||||
if [ `whoami` != $PANDORA_USER ]; then
|
||||
SUDO="sudo -H -u $PANDORA_USER"
|
||||
fi
|
||||
$SUDO python3 -m venv --system-site-packages .
|
||||
python3 -m venv --system-site-packages .
|
||||
|
||||
branch=`cat .git/HEAD | sed 's@/@\n@g' | tail -n1`
|
||||
|
||||
# Work around broken venv module in Ubuntu 16.04 / Debian 9
|
||||
if [ ! -e bin/pip ]; then
|
||||
$SUDO bin/python3 -m pip install -U --ignore-installed "pip<9"
|
||||
bin/python3 -m pip install -U --ignore-installed "pip<9"
|
||||
fi
|
||||
if [ ! -d static/oxjs ]; then
|
||||
$SUDO git clone --depth 1 -b $branch https://git.0x2620.org/oxjs.git static/oxjs
|
||||
git clone --depth 1 -b $branch https://git.0x2620.org/oxjs.git static/oxjs
|
||||
fi
|
||||
$SUDO mkdir -p src
|
||||
mkdir -p src
|
||||
if [ ! -d src/oxtimelines ]; then
|
||||
$SUDO git clone --depth 1 -b $branch https://git.0x2620.org/oxtimelines.git src/oxtimelines
|
||||
git clone --depth 1 -b $branch https://git.0x2620.org/oxtimelines.git src/oxtimelines
|
||||
fi
|
||||
for package in oxtimelines python-ox; do
|
||||
cd ${BASE}
|
||||
if [ ! -d src/${package} ]; then
|
||||
$SUDO git clone --depth 1 -b $branch https://git.0x2620.org/${package}.git src/${package}
|
||||
git clone --depth 1 -b $branch https://git.0x2620.org/${package}.git src/${package}
|
||||
fi
|
||||
cd ${BASE}/src/${package}
|
||||
$SUDO ${BASE}/bin/python setup.py develop
|
||||
${BASE}/bin/python setup.py develop
|
||||
done
|
||||
cd ${BASE}
|
||||
$SUDO ./bin/pip install -r requirements.txt
|
||||
./bin/pip install -r requirements.txt
|
||||
if [ ! -e pandora/gunicorn_config.py ]; then
|
||||
$SUDO cp pandora/gunicorn_config.py.in pandora/gunicorn_config.py
|
||||
cp pandora/gunicorn_config.py.in pandora/gunicorn_config.py
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -86,21 +86,6 @@ def load_config(init=False):
|
|||
|
||||
# enable default filters if needed
|
||||
default_filters = [f['id'] for f in config['user']['ui']['filters']]
|
||||
available_filters = [key['id'] for key in config['itemKeys'] if key.get('filter')]
|
||||
unknown_ids = set(default_filters) - set(available_filters)
|
||||
if unknown_ids:
|
||||
sys.stderr.write('WARNING: unknown item keys in default filters: %s.\n' % list(unknown_ids))
|
||||
unused_filters = [key for key in available_filters if key not in default_filters]
|
||||
if len(unused_filters) < len(unknown_ids):
|
||||
sys.stderr.write('you need at least 5 item filters')
|
||||
else:
|
||||
auto_filters = unused_filters[:len(unknown_ids)]
|
||||
default_filters += auto_filters
|
||||
for key in auto_filters:
|
||||
config['user']['ui']['filters'].append({
|
||||
"id": key, "sort": [{"key": "items", "operator": "-"}]
|
||||
})
|
||||
sys.stderr.write(' using the following document filters instead: %s.\n' % auto_filters)
|
||||
for key in config['itemKeys']:
|
||||
if key['id'] in default_filters and not key.get('filter'):
|
||||
key['filter'] = True
|
||||
|
|
@ -108,22 +93,6 @@ def load_config(init=False):
|
|||
|
||||
# enable default document filters if needed
|
||||
default_filters = [f['id'] for f in config['user']['ui']['documentFilters']]
|
||||
available_filters = [key['id'] for key in config['documentKeys'] if key.get('filter')]
|
||||
unknown_ids = set(default_filters) - set(available_filters)
|
||||
if unknown_ids:
|
||||
sys.stderr.write('WARNING: unknown document keys in default filters: %s.\n' % list(unknown_ids))
|
||||
unused_filters = [key for key in available_filters if key not in default_filters]
|
||||
if len(unused_filters) < len(unknown_ids):
|
||||
sys.stderr.write('you need at least 5 item filters')
|
||||
else:
|
||||
auto_filters = unused_filters[:len(unknown_ids)]
|
||||
default_filters += auto_filters
|
||||
for key in auto_filters:
|
||||
config['user']['ui']['documentFilters'].append({
|
||||
"id": key, "sort": [{"key": "items", "operator": "-"}]
|
||||
})
|
||||
sys.stderr.write(' using the following document filters instead: %s.\n' % auto_filters)
|
||||
|
||||
for key in config['documentKeys']:
|
||||
if key['id'] in default_filters and not key.get('filter'):
|
||||
key['filter'] = True
|
||||
|
|
|
|||
|
|
@ -107,8 +107,6 @@ class Command(BaseCommand):
|
|||
print(sql)
|
||||
cursor.execute(sql)
|
||||
transaction.commit()
|
||||
for i in models.Item.objects.filter(sort=None):
|
||||
i.save()
|
||||
if rebuild:
|
||||
print("Updating sort values...")
|
||||
ids = [i['id'] for i in models.Item.objects.all().values('id')]
|
||||
|
|
@ -117,5 +115,3 @@ class Command(BaseCommand):
|
|||
if options['debug']:
|
||||
print(i)
|
||||
i.update_sort()
|
||||
for i in models.Item.objects.filter(sort=None):
|
||||
i.save()
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ fi
|
|||
git clone https://git.0x2620.org/pandora.git /srv/pandora
|
||||
cd /srv/pandora
|
||||
git checkout $BRANCH
|
||||
chown -R $PANDORA:$PANDORA /srv/pandora
|
||||
./ctl init
|
||||
|
||||
# create config.jsonc from templates in git
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue