Skip to content

Commit e28288e

Browse files
committed
➕ bluesky: switch to FxBluesky, add text only view
Closes #94
1 parent b3a12ce commit e28288e

5 files changed

Lines changed: 42 additions & 31 deletions

File tree

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ We're not affiliated with any of these services.
247247
- [vxreddit](https://github.com/dylanpdx/vxReddit)
248248
- [BiliFix](https://vxbilibili.com/)
249249
- [FixThreads](https://github.com/seriaati/fixthreads)
250-
- [VixBluesky](https://github.com/Lexedia/VixBluesky)
251250
- [phixiv](https://github.com/thelaao/phixiv)
252251
- [fixDeviantArt](https://github.com/Tschrock/fixdeviantart)
253252
- [FxMastodon](https://fx.zillanlabs.tech/)
@@ -483,12 +482,12 @@ _Are you aware of any other fixer that isn't included here? Feel free to open an
483482
</details>
484483

485484
- <img src="assets/bluesky.webp" alt="Bluesky" height="20"/> Bluesky
486-
- [VixBluesky • bskx.app](https://github.com/Lexedia/VixBluesky) *Used by FixTweetBot*
485+
- [VixBluesky • bskx.app](https://github.com/Lexedia/VixBluesky)
487486
- Other official public instances/redirects: `bskyx.app` (deprecated)
488487
- Other unofficial public instances/redirects: `girlcockbsky.app` (nsfw content)
489488
- [FixBluesky • bsyy.app](https://github.com/ThornbushHQ/FixBluesky)
490489
- [xbsky • xbsky.app](https://github.com/colduw/xbsky)
491-
- [FxBluesky • fxbsky.app](https://github.com/FxEmbed/FxEmbed)
490+
- [FxBluesky • fxbsky.app](https://github.com/FxEmbed/FxEmbed) *Used by FixTweetBot*
492491
- [vxBsky • vxbsky.app](https://github.com/dylanpdx/vxBsky)
493492
- [bskye • bskye.app](https://github.com/FerroEduardo/bskye)
494493
- [cbsky.app • cbsky.app](https://github.com/goeo-/cbsky.app)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""AddBlueskyTextView Migration."""
2+
3+
from masoniteorm.migrations import Migration
4+
5+
6+
class AddBlueskyTextView(Migration):
7+
def up(self):
8+
"""
9+
Run the migrations.
10+
"""
11+
with self.schema.table("guilds") as table:
12+
table.enum("bluesky_view", ["normal", "gallery", "text_only", "direct_media"]).default("normal").change()
13+
14+
def down(self):
15+
"""
16+
Revert the migrations.
17+
"""
18+
with self.schema.table("guilds") as table:
19+
table.enum("bluesky_view", ["normal", "gallery", "direct_media"]).default("normal").change()

database/models/Guild.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from masoniteorm.relationships import has_many
88

99

10-
__all__ = ('Guild', 'OriginalMessage', 'TwitterView', 'InstagramView', 'TiktokView', 'BlueskyView', 'EmbedEzView', 'GettableEnum')
10+
__all__ = ('Guild', 'OriginalMessage', 'FxEmbedView', 'InstagramView', 'TiktokView', 'EmbedEzView', 'GettableEnum')
1111

1212
from database.models.DiscordRepresentation import DiscordRepresentation
1313

@@ -26,7 +26,7 @@ class OriginalMessage(GettableEnum):
2626
DELETE = 'delete'
2727

2828

29-
class TwitterView(GettableEnum):
29+
class FxEmbedView(GettableEnum):
3030
NORMAL = 'normal'
3131
GALLERY = 'gallery'
3232
TEXT_ONLY = 'text_only'
@@ -42,11 +42,6 @@ class TiktokView(GettableEnum):
4242
GALLERY = 'gallery'
4343
DIRECT_MEDIA = 'direct_media'
4444

45-
class BlueskyView(GettableEnum):
46-
NORMAL = 'normal'
47-
DIRECT_MEDIA = 'direct_media'
48-
GALLERY = 'gallery'
49-
5045
class EmbedEzView(GettableEnum):
5146
NORMAL = 'normal'
5247
DIRECT_MEDIA = 'direct_media'
@@ -68,9 +63,9 @@ class Guild(DiscordRepresentation):
6863
'reply_silently': bool,
6964
'webhooks': bool,
7065
'original_message': OriginalMessage,
71-
'twitter_view': TwitterView,
66+
'twitter_view': FxEmbedView,
7267
'tiktok_view': TiktokView,
73-
'bluesky_view': BlueskyView,
68+
'bluesky_view': FxEmbedView,
7469
'instagram_view': InstagramView,
7570
'snapchat_view': EmbedEzView,
7671
'ifunny_view': EmbedEzView,

src/settings.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,21 @@ class WebsiteBaseSetting(BaseSetting):
133133
proxies: dict[str, str]
134134
is_view: bool = False
135135
is_translation: bool = False
136+
view_enum: Type[GettableEnum] | None = None
136137

137138
def __init__(
138139
self,
139140
interaction: discore.Interaction,
140141
view: SettingsView,
141-
ctx: DataElements,
142-
enum: Type[GettableEnum] = None
142+
ctx: DataElements
143143
):
144144
super().__init__(interaction, view, ctx)
145145
self.state = bool(self.ctx.guild[self.id])
146146
self.view_state = None
147-
self.view_enum = None
148147
self.translation = None
149148
if self.is_view:
150149
self.view_state = self.ctx.guild[f'{self.id}_view']
151-
if enum is not None:
152-
self.view_enum = enum
153-
else:
150+
if self.view_enum is None:
154151
enum_name = f'{self.id.title()}View'
155152
self.view_enum = getattr(__import__('database.models.Guild', fromlist=[enum_name]), enum_name)
156153
if self.is_translation:
@@ -307,9 +304,7 @@ class EmbedEZBaseSetting(WebsiteBaseSetting):
307304
proxies = {"EmbedEZ": "https://embedez.com"}
308305
is_view = True
309306
is_translation = True
310-
311-
def __init__(self, interaction: discore.Interaction, view: SettingsView, ctx: DataElements):
312-
super().__init__(interaction, view, ctx, enum=EmbedEzView)
307+
view_enum = EmbedEzView
313308

314309

315310
class ClickerSetting(BaseSetting):
@@ -1246,6 +1241,7 @@ class TwitterSetting(WebsiteBaseSetting):
12461241
proxies = {"FxTwitter": "https://github.com/FxEmbed/FxEmbed"}
12471242
is_translation = True
12481243
is_view = True
1244+
view_enum = FxEmbedView
12491245

12501246

12511247
class InstagramSetting(WebsiteBaseSetting):
@@ -1292,8 +1288,9 @@ class BlueskySetting(WebsiteBaseSetting):
12921288
id = 'bluesky'
12931289
name = 'Bluesky'
12941290
emoji = discore.config.emoji.bluesky
1295-
proxies = {"VixBluesky": "https://github.com/Lexedia/VixBluesky"}
1291+
proxies = {"FxBluesky": "https://github.com/FxEmbed/FxEmbed"}
12961292
is_view = True
1293+
view_enum = FxEmbedView
12971294

12981295

12991296
class SnapchatSetting(EmbedEZBaseSetting):

src/websites.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,10 @@ class TwitterLink(GenericWebsiteLink):
371371
fixer_name = "FxTwitter"
372372
is_translation = True
373373
subdomains = {
374-
TwitterView.NORMAL: '',
375-
TwitterView.GALLERY: 'g.',
376-
TwitterView.TEXT_ONLY: 't.',
377-
TwitterView.DIRECT_MEDIA: 'd.',
374+
FxEmbedView.NORMAL: '',
375+
FxEmbedView.GALLERY: 'g.',
376+
FxEmbedView.TEXT_ONLY: 't.',
377+
FxEmbedView.DIRECT_MEDIA: 'd.',
378378
}
379379
routes = generate_routes(
380380
["twitter.com", "x.com", "nitter.net", "xcancel.com", "nitter.poast.org", "nitter.privacyredirect.com", "lightbrd.com", "nitter.space", "nitter.tiekoetter.com"],
@@ -470,12 +470,13 @@ class BlueskyLink(GenericWebsiteLink):
470470

471471
id = 'bluesky'
472472
hypertext_label = 'Bluesky'
473-
fix_domain = "bskx.app"
474-
fixer_name = "VixBluesky"
473+
fix_domain = "fxbsky.app"
474+
fixer_name = "FxBluesky"
475475
subdomains = {
476-
BlueskyView.NORMAL: '',
477-
BlueskyView.DIRECT_MEDIA: 'r.',
478-
BlueskyView.GALLERY: 'g.',
476+
FxEmbedView.NORMAL: '',
477+
FxEmbedView.DIRECT_MEDIA: 'd.',
478+
FxEmbedView.GALLERY: 'g.',
479+
FxEmbedView.TEXT_ONLY: 't.',
479480
}
480481
routes = generate_routes(
481482
"bsky.app",

0 commit comments

Comments
 (0)