diff --git a/expo/app.config.default.js b/expo/app.config.default.js
index 892f905..19a27d4 100644
--- a/expo/app.config.default.js
+++ b/expo/app.config.default.js
@@ -42,6 +42,7 @@ module.exports = {
usesNonExemptEncryption: false
},
infoPlist: {
+ ITSAppUsesNonExemptEncryption: false,
CFBundleAllowMixedLocalizations: true,
NSAppTransportSecurity: {
NSExceptionDomains: {
diff --git a/expo/features/feed/internals/FeedItemAmebloOptimizedView.tsx b/expo/features/feed/internals/FeedItemAmebloOptimizedView.tsx
index 9f2fb75..ff2cdfe 100644
--- a/expo/features/feed/internals/FeedItemAmebloOptimizedView.tsx
+++ b/expo/features/feed/internals/FeedItemAmebloOptimizedView.tsx
@@ -16,28 +16,43 @@ export default function FeedItemAmebloOptimizedView({ url }: FeedItemAmebloOptim
// TODO: Use the optimized content for web
return
Post content here
;
}
+ if (state.data?.optimizedHtml) {
+ return (
+ <>
+
+ >
+ );
+ }
+ // fallback
return (
<>
-
+
>
);
}
const UserAgent =
- 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36';
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1';
const AmebloEntryIDUrlRegExp = /\/([^/]+)\/entry-(\d+)\.html/;
const AmebloInitDataRegExp = /\s*window\.INIT_DATA\s*=\s*(\{.*\});\s*window\.RESOURCE_BASE_URL/; // /(?s)window\.INIT_DATA\s*=\s*(\{.*\});\s*window\.RESOURCE_BASE_URL/;
-async function getAmebloOptimizedContent(url: string): Promise {
+type AmebloContent = {
+ originalHtml: string;
+ optimizedHtml?: string;
+};
+
+async function getAmebloOptimizedContent(url: string): Promise {
const matched = url.match(AmebloEntryIDUrlRegExp);
if (matched == null || matched.length < 3) {
- return '';
+ throw new Error('invalid URL');
}
const id = matched[2];
const { html } = await fetchContent(url);
- const entryText = extractEntryText(html, id);
- return `
-
+ try {
+ const entryText = extractEntryText(html, id);
+ return {
+ originalHtml: html,
+ optimizedHtml: `
@@ -65,7 +80,13 @@ async function getAmebloOptimizedContent(url: string): Promise {
- `;
+ `
+ };
+ } catch {
+ return {
+ originalHtml: html
+ };
+ }
}
function extractEntryText(html: string, id: string) {