diff --git a/static/openInApp.js b/static/openInApp.js
new file mode 100644
index 0000000..1923617
--- /dev/null
+++ b/static/openInApp.js
@@ -0,0 +1,31 @@
+function detectOS() {
+ const userAgent = navigator.userAgent || navigator.platform
+
+ if (/android/i.test(userAgent)) {
+ return 'android';
+ }
+
+ if (/iPad|iPhone|iPod/.test(userAgent) || (/Macintosh/.test(userAgent) && 'ontouchend' in document)) {
+ return 'ios';
+ }
+
+ return 'unknown';
+}
+
+function openTweet(tweetId){
+ var preference = localStorage.getItem("openLinksPreference");
+ if (preference === "true"){
+ const os = detectOS();
+
+ url = `twitter://status?id=${tweetId}`
+ if(os === 'android'){
+ window.location = url;
+ }else if (os === 'ios'){
+ window.location.replace(url);
+ }
+
+ setTimeout(() => {
+ window.location = `https://x.com/i/status/${tweetId}`
+ }, 1000)
+ }
+}
\ No newline at end of file
diff --git a/static/preferences.html b/static/preferences.html
new file mode 100644
index 0000000..53915ff
--- /dev/null
+++ b/static/preferences.html
@@ -0,0 +1,25 @@
+
+
+
+ Preferences
+
+
+
+
Preferences
+
+
+
\ No newline at end of file
diff --git a/templates/image.html b/templates/image.html
index 86b0fea..122bf09 100644
--- a/templates/image.html
+++ b/templates/image.html
@@ -24,4 +24,4 @@
- {% endblock %} {% block body %} Redirecting you to the tweet in a moment. Or click here. {% endblock %}
\ No newline at end of file
+ {% endblock %} {% block body %} Redirecting you to the tweet in a moment. Or click here. {% endblock %}
\ No newline at end of file
diff --git a/templates/text.html b/templates/text.html
index 0c6c97d..e9dbcae 100644
--- a/templates/text.html
+++ b/templates/text.html
@@ -10,4 +10,4 @@
- {% endblock %} {% block body %} Redirecting you to the tweet in a moment. Or click here. {% endblock %}
\ No newline at end of file
+ {% endblock %} {% block body %} Redirecting you to the tweet in a moment. Or click here. {% endblock %}
\ No newline at end of file
diff --git a/templates/tweetCommon.html b/templates/tweetCommon.html
index c928956..137ea98 100644
--- a/templates/tweetCommon.html
+++ b/templates/tweetCommon.html
@@ -2,4 +2,6 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/templates/video.html b/templates/video.html
index 48ec6e4..77a7225 100644
--- a/templates/video.html
+++ b/templates/video.html
@@ -19,4 +19,4 @@
- {% endblock %} {% block body %} Redirecting you to the tweet in a moment. Or click here. {% endblock %}
\ No newline at end of file
+ {% endblock %} {% block body %} Redirecting you to the tweet in a moment. Or click here.{% endblock %}
\ No newline at end of file
diff --git a/twitfix.py b/twitfix.py
index c64ab1b..4624772 100644
--- a/twitfix.py
+++ b/twitfix.py
@@ -275,6 +275,14 @@ def favicon(): # pragma: no cover
def apple_touch_icon(): # pragma: no cover
return send_from_directory(os.path.join(app.root_path, 'static'), 'apple-touch-icon.png',mimetype='image/png')
+@app.route('/openInApp.js')
+def openInAppJs(): # pragma: no cover
+ return send_from_directory(os.path.join(app.root_path, 'static'), 'openInApp.js',mimetype='application/javascript')
+
+@app.route('/preferences')
+def preferences(): # pragma: no cover
+ return send_from_directory(os.path.join(app.root_path, 'static'), 'preferences.html', mimetype='text/html')
+
@app.route('/tvid/')
def tvid(vid_path):
url = f"https://video.twimg.com/{vid_path}.mp4"