Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rat Aint Tieba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Bing Chilling
Rat Aint Tieba
Commits
49c35b1b
Commit
49c35b1b
authored
1 year ago
by
John Xina
Browse files
Options
Downloads
Patches
Plain Diff
Several fixes and enhancement
parent
6821384f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app.py
+5
-5
5 additions, 5 deletions
app.py
proxify.py
+2
-3
2 additions, 3 deletions
proxify.py
shared.py
+4
-0
4 additions, 0 deletions
shared.py
with
11 additions
and
8 deletions
app.py
+
5
−
5
View file @
49c35b1b
...
...
@@ -28,9 +28,9 @@ def append_with_leading_clean(orig, content):
# Return the corresponding user name for an id.
async
def
cache_name_from_id
(
c
,
i
):
if
not
cache
.
get
(
i
):
r
=
await
c
.
get_user_info
(
i
,
require
=
aiotieba
.
enums
.
ReqUInfo
.
USER
_NAME
)
cache
.
set
(
i
,
r
)
if
not
cache
.
get
(
str
(
i
)
):
r
=
await
c
.
get_user_info
(
i
,
require
=
aiotieba
.
enums
.
ReqUInfo
.
NICK
_NAME
)
cache
.
set
(
str
(
i
)
,
r
)
# Normalize unicode characters to ASCII form.
def
normalize_utf8
(
s
):
...
...
@@ -100,7 +100,7 @@ async def _jinja2_filter_translate(frags, reply_id=0):
htmlfmt
=
''
if
reply_id
:
htmlfmt
+=
f
'
<a href=
"
/home/main?id=
{
reply_id
}
"
>@
{
cache
.
get
(
reply_id
)
}
</a>
'
htmlfmt
+=
f
'
<a href=
"
/home/main?id=
{
reply_id
}
"
>@
{
cache
.
get
(
str
(
reply_id
)
)
}
</a>
'
for
i
in
range
(
len
(
frags
)):
frag
=
frags
[
i
]
...
...
@@ -158,7 +158,7 @@ async def thread_view(tid):
for
floor
in
thread_info
:
for
comment
in
floor
.
comments
:
available_users
.
append
(
comment
.
author_id
)
cache
.
set
(
comment
.
author_id
,
comment
.
user
.
user
_name
)
cache
.
set
(
str
(
comment
.
author_id
)
,
comment
.
user
.
show
_name
)
all_users
=
{}
for
floor
in
thread_info
:
...
...
This diff is collapsed.
Click to expand it.
proxify.py
+
2
−
3
View file @
49c35b1b
...
...
@@ -108,9 +108,8 @@ class Asgiproxify():
task
=
asyncio
.
create_task
(
reverse_proxy_task
())
ev
=
await
receive
()
if
ev
[
'
type
'
]
==
'
http.disconnect
'
:
task
.
cancel
()
return
task
.
cancel
()
return
async
def
__call__
(
self
,
scope
,
receive
,
send
):
if
scope
[
'
type
'
]
!=
'
http
'
:
...
...
This diff is collapsed.
Click to expand it.
shared.py
+
4
−
0
View file @
49c35b1b
...
...
@@ -27,5 +27,9 @@ app.config['TESTING'] = False
######################################################################
app
.
config
[
'
CACHE_DEFAULT_TIMEOUT
'
]
=
60
#app.config['CACHE_TYPE'] = 'RedisCache'
app
.
config
[
'
CACHE_TYPE
'
]
=
'
SimpleCache
'
cache
=
Cache
(
app
)
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