Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Falk Rehse
rss
Commits
1f300f5a
Commit
1f300f5a
authored
3 years ago
by
Falk Rehse
Browse files
Options
Downloads
Patches
Plain Diff
Update DB to allow for thumbnails
parent
4fc513a6
No related branches found
No related tags found
No related merge requests found
Pipeline
#76406
passed
3 years ago
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
rss/bot.py
+1
-1
1 addition, 1 deletion
rss/bot.py
rss/db.py
+19
-3
19 additions, 3 deletions
rss/db.py
with
20 additions
and
4 deletions
rss/bot.py
+
1
−
1
View file @
1f300f5a
...
...
@@ -31,7 +31,7 @@ from mautrix.errors.request import MForbidden
from
maubot
import
Plugin
,
MessageEvent
from
maubot.handlers
import
command
,
event
from
.db
import
Database
,
Feed
,
Entry
,
Subscription
from
.db
import
Database
,
Feed
,
Entry
,
Thumbnail
,
Subscription
class
Config
(
BaseProxyConfig
):
...
...
This diff is collapsed.
Click to expand it.
rss/db.py
+
19
−
3
View file @
1f300f5a
...
...
@@ -30,8 +30,8 @@ Subscription = NamedTuple("Subscription", feed_id=int, room_id=RoomID, user_id=U
notification_template
=
Template
,
send_notice
=
bool
)
Feed
=
NamedTuple
(
"
Feed
"
,
id
=
int
,
url
=
str
,
title
=
str
,
subtitle
=
str
,
link
=
str
,
subscriptions
=
List
[
Subscription
])
Entry
=
NamedTuple
(
"
Entry
"
,
feed_id
=
int
,
id
=
str
,
date
=
datetime
,
title
=
str
,
summary
=
str
,
content
=
str
,
link
=
str
)
Entry
=
NamedTuple
(
"
Entry
"
,
feed_id
=
int
,
id
=
str
,
date
=
datetime
,
title
=
str
,
summary
=
str
,
content
=
str
,
link
=
str
,
thumbnail_id
=
str
)
Thumbnail
=
NamedTuple
(
"
Thumbnail
"
,
id
=
str
,
url
=
str
,
mime_type
=
str
,
size
=
int
)
class
Database
:
db
:
Engine
...
...
@@ -65,7 +65,13 @@ class Database:
Column
(
"
title
"
,
Text
,
nullable
=
False
),
Column
(
"
summary
"
,
Text
,
nullable
=
False
),
Column
(
"
content
"
,
Text
,
nullable
=
False
),
Column
(
"
link
"
,
Text
,
nullable
=
False
))
Column
(
"
link
"
,
Text
,
nullable
=
False
),
Column
(
"
thumbnail_id
"
,
Integer
,
ForeignKey
(
"
thumbnail.id
"
),
nullable
=
True
))
self
.
thumbnail
=
Table
(
"
thumbnail
"
,
metadata
,
Column
(
"
id
"
,
String
(
255
),
primary_key
=
True
),
Column
(
"
url
"
,
String
(
255
),
nullable
=
False
),
Column
(
"
mime_type
"
,
String
(
255
),
nullable
=
False
),
Column
(
"
size
"
,
Integer
,
nullable
=
False
))
self
.
version
=
Table
(
"
version
"
,
metadata
,
Column
(
"
version
"
,
Integer
,
primary_key
=
True
))
self
.
upgrade
()
...
...
@@ -109,6 +115,16 @@ class Database:
if
version
==
1
:
self
.
db
.
execute
(
"
ALTER TABLE subscription ADD COLUMN send_notice BOOLEAN DEFAULT true
"
)
version
=
2
if
version
==
2
:
self
.
db
.
execute
(
"
ALTER TABLE entry ADD COLUMN thumbnail_id VARCHAR(255)
"
)
self
.
db
.
execute
(
"""
CREATE TABLE IF NOT EXISTS thumbnail (
id VARCHAR(255) NOT NULL,
url VARCHAR(255) NOT NULL,
mime_type VARCHAR(255) NOT NULL,
size INTEGER NOT NULL,
PRIMARY KEY (id)
"""
)
version
=
3
self
.
db
.
execute
(
self
.
version
.
delete
())
self
.
db
.
execute
(
self
.
version
.
insert
().
values
(
version
=
version
))
...
...
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