diff --git a/package.json b/package.json index fd978a6..37c06e7 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "version": "0.0.1", "private": true, "scripts": { - "dev": "astro dev --host --port 2023", - "start": "astro dev --host --port 2023", + "dev": "astro dev --host --port 2024", + "start": "astro dev --host --port 2024", "build": "astro build", "preview": "astro preview", "push": "rsync -azP dist/ barta-india@51.222.206.100:/home/barta-india/public_html", @@ -14,6 +14,8 @@ "dependencies": { "@astrojs/tailwind": "^2.1.3", "@astrojs/vue": "^1.2.2", + "@bytescale/upload-widget-vue": "^4.13.0", + "@upload-io/vue-uploader": "^3.37.1", "astro": "^1.7.2", "astro-eslint-parser": "^0.14.0", "eslint": "^8.44.0", diff --git a/public/js/js-0.1.0.js b/public/js/js-0.1.0.js new file mode 100644 index 0000000..ad4f985 --- /dev/null +++ b/public/js/js-0.1.0.js @@ -0,0 +1,70 @@ +function getCookie(cname) { + let name = cname + "="; + let ca = document.cookie.split(';'); + for (let i = 0; i < ca.length; i++) { + let c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1); + } + if (c.indexOf(name) == 0) { + const cookieValue = c.substring(name.length, c.length); + // console.log(`Cookie ${cname} found with value: ${cookieValue}`); + return cookieValue; + } + } + // console.log(`Cookie ${cname} not found`); + return ""; +} + + +function makeProtectedRequest(apiUrl, renewUrl, access_token, formData) { + + return fetch(apiUrl, { + method: 'POST', + // mode: "cors", + headers: { + // 'Authorization': `Bearer ${accessToken}`, + 'Content-Type': 'application/json', + }, + // credentials: 'same-origin', + body: JSON.stringify(formData), + }) + .then(response => { + if (!response.ok) { + throw new Error('Request failed'); + } else if(response.status === 204) { + // Token is expired or invalid, trigger refresh + // console.log(access_token) + return renewToken(renewUrl, access_token).then(access_token_new => { + // Retry the original request with the new token + // console.log("formData :" +access_token_new) + formData.access_token=access_token_new; + return fetch(apiUrl, { + method: 'POST', + headers: { + // 'Authorization': `Bearer ${newAccessToken}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify(formData), + }); + }); + } + return response.json(); + }); +} + +function renewToken(renewUrl, access_token) { + return fetch(renewUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ tokenToRenew: access_token }), + }) + .then(response => response.json()) + .then(data => { + document.cookie = `access_token=${data.access_token}; path=/`; + // console.log('New Access Token:', data); + return data.access_token; + }); +} \ No newline at end of file diff --git a/public/robots.txt b/public/robots.txt index 5a4985c..e182545 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,5 +1,7 @@ User-agent: Googlebot Disallow: /nogooglebot/ +Disallow: /ad-file/ +Disallow: /add-news/ User-agent: * Allow: / diff --git a/src/components/About.vue b/src/components/About.vue new file mode 100644 index 0000000..12059ee --- /dev/null +++ b/src/components/About.vue @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 71cd561..68f7b1b 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -33,6 +33,7 @@ + diff --git a/src/components/HashRouting.vue b/src/components/HashRouting.vue new file mode 100644 index 0000000..aceefb9 --- /dev/null +++ b/src/components/HashRouting.vue @@ -0,0 +1,103 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/Home.vue b/src/components/Home.vue new file mode 100644 index 0000000..e43d980 --- /dev/null +++ b/src/components/Home.vue @@ -0,0 +1,22 @@ + + + \ No newline at end of file diff --git a/src/components/ImageUpload.vue b/src/components/ImageUpload.vue new file mode 100644 index 0000000..7c7d100 --- /dev/null +++ b/src/components/ImageUpload.vue @@ -0,0 +1,37 @@ + + + \ No newline at end of file diff --git a/src/pages/404.astro b/src/pages/404.astro index 49c3da9..297dff0 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -1,10 +1,19 @@ --- -import Layout from "../layouts/Layout.astro" +import Layout from "../layouts/Layout.astro"; --- - +
-

404 Page Not Found

+
+

+
-
\ No newline at end of file +
+ \ No newline at end of file diff --git a/src/pages/4041.astro b/src/pages/4041.astro new file mode 100644 index 0000000..2ad1fbc --- /dev/null +++ b/src/pages/4041.astro @@ -0,0 +1,81 @@ +--- +import Layout from "../layouts/Layout.astro"; +// import ImageUpload from "../components/ImageUpload.vue"; +--- + +
+
+ +

+ +
+
+
+
+ + diff --git a/src/pages/ad-file.astro b/src/pages/ad-file.astro new file mode 100644 index 0000000..ad58f0a --- /dev/null +++ b/src/pages/ad-file.astro @@ -0,0 +1,57 @@ +--- +import Layout from "../layouts/Layout.astro"; +--- + +
+
+

Upload File

+
+ + +
+ +
+
+
+
+ diff --git a/src/pages/add-news.astro b/src/pages/add-news.astro new file mode 100644 index 0000000..3d7e9a1 --- /dev/null +++ b/src/pages/add-news.astro @@ -0,0 +1,267 @@ +--- +import Layout from "../layouts/Layout.astro"; +import ImageUpload from "../components/ImageUpload.vue"; +--- + + +
+
+
+

Genarate New News

+
+ + +
+ + +
+
+ + +
+
+ +
+
+ + +
+ +
+
+ + + +
+
+
+ + + \ No newline at end of file diff --git a/src/pages/edit-news.astro b/src/pages/edit-news.astro new file mode 100644 index 0000000..505c89b --- /dev/null +++ b/src/pages/edit-news.astro @@ -0,0 +1,71 @@ +--- +import Layout from "../layouts/Layout.astro"; +--- + +
+
+
+
+

Edit News

+ + + + + + + + + +
IDStatusEdit
+
+
+
+
+
+ \ No newline at end of file diff --git a/src/pages/gen-news.astro b/src/pages/gen-news.astro new file mode 100644 index 0000000..cad6e6b --- /dev/null +++ b/src/pages/gen-news.astro @@ -0,0 +1,77 @@ +--- +import Layout from "../layouts/Layout.astro"; +--- + +
+
+
+

Genarate New News

+
+ + +
+ + +
+
+ + +
+
+ + +

+
+ + +
+
+
+
+
+ \ No newline at end of file diff --git a/src/pages/hash.astro b/src/pages/hash.astro new file mode 100644 index 0000000..4eb89cf --- /dev/null +++ b/src/pages/hash.astro @@ -0,0 +1,11 @@ +--- +import Layout from "../layouts/Layout.astro"; +import HashRouting from "../components/HashRouting.vue"; +--- + +
+
+ +
+
+
\ No newline at end of file diff --git a/src/pages/image.astro b/src/pages/image.astro new file mode 100644 index 0000000..28c8371 --- /dev/null +++ b/src/pages/image.astro @@ -0,0 +1,11 @@ +--- +import Layout from "../layouts/Layout.astro"; +import ImageUpload from "../components/ImageUpload.vue"; +--- + +
+
+ +
+
+
\ No newline at end of file diff --git a/src/pages/login.astro b/src/pages/login.astro new file mode 100644 index 0000000..a15cd86 --- /dev/null +++ b/src/pages/login.astro @@ -0,0 +1,133 @@ +--- +import Layout from "../layouts/Layout.astro"; +--- + +
+
+
+ + logo + Barta-India + +
+
+

Sign in to your account

+
+
+ + +
+
+ + +
+
+
+
+ +
+
+ +
+
+ Forgot password? +
+ +

+ Don't have an account yet? Sign up +

+
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/pages/multi-lang.astro b/src/pages/multi-lang.astro new file mode 100644 index 0000000..286392b --- /dev/null +++ b/src/pages/multi-lang.astro @@ -0,0 +1,158 @@ +--- +import Layout from "../layouts/Layout.astro"; +import ImageUpload from "../components/ImageUpload.vue"; +--- + + +
+
+
+

Genarate New News

+
+ +
+ + +
+
+ + +
+
+ +
+
+ +
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 232fe62..855f9a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1126,6 +1126,27 @@ "@babel/helper-validator-identifier" "^7.22.5" to-fast-properties "^2.0.0" +"@bytescale/sdk@^3.27.0": + version "3.30.0" + resolved "https://registry.yarnpkg.com/@bytescale/sdk/-/sdk-3.30.0.tgz#60ccc6313462c1e1806c49d7e4405944cce69da6" + integrity sha512-VCV4MrK5Ig7tjeWc5RKwfd9Zg6ihDv0Y1buctEg/FfY8nly15/bpFMhFDw50PzR3FuCmg7RprMQ76rj8G3iWCw== + +"@bytescale/upload-widget-vue@^4.13.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@bytescale/upload-widget-vue/-/upload-widget-vue-4.13.0.tgz#ce733f2938cbaf27de1545c0aee0cedad65527d5" + integrity sha512-CT/P72NahAnwVwzQi6gAuA5DlKmKV/+j4H4aypaoisdYI1ukH3OYrEKv4Vl52lHZ8PgfFDUqopXrC6PzrkDtNA== + dependencies: + "@bytescale/upload-widget" "^4.23.0" + +"@bytescale/upload-widget@^4.23.0": + version "4.23.0" + resolved "https://registry.yarnpkg.com/@bytescale/upload-widget/-/upload-widget-4.23.0.tgz#b662bba1fb21f39b0a6f927a263ad41dab6c629d" + integrity sha512-gG1JPGcAynn6y0XEbeFNk+7qYcMwQ7qmSvxwp+NEEpf9W12hkSGfoRulKtSKVf38oSmSag2Dks30PfEKiUnW7w== + dependencies: + "@bytescale/sdk" "^3.27.0" + classnames "^2.2.6" + preact "^10.6.5" + "@emmetio/abbreviation@^2.3.3": version "2.3.3" resolved "https://registry.yarnpkg.com/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz#ed2b88fe37b972292d6026c7c540aaf887cecb6e" @@ -1536,6 +1557,18 @@ "@typescript-eslint/types" "5.61.0" eslint-visitor-keys "^3.3.0" +"@upload-io/upload-api-client-upload-js@^2.18.0": + version "2.18.0" + resolved "https://registry.yarnpkg.com/@upload-io/upload-api-client-upload-js/-/upload-api-client-upload-js-2.18.0.tgz#948cf288ace5ef22a152b37096335fda2ef7cc5c" + integrity sha512-yPwsRCecXSilYn4q5ZDD4fyI2PVyUcLimv2LQcfpV3hRyzc8t82NuWHYEYpRZa5K68zxw2RljDf30geT1vJN9g== + +"@upload-io/vue-uploader@^3.37.1": + version "3.37.1" + resolved "https://registry.yarnpkg.com/@upload-io/vue-uploader/-/vue-uploader-3.37.1.tgz#ba3cca104b89c71bbf9ea45e421eb2293554633f" + integrity sha512-iY6tUGCoOxHsKg5myeXB38rLKpIU5F1awW4gw9ze6p6ne4GHI5M77AhHShjPEa2zylQh6wzny7F0AU4cfiRA+w== + dependencies: + uploader "^3.47.0" + "@vitejs/plugin-vue-jsx@^2.0.1": version "2.1.1" resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue-jsx/-/plugin-vue-jsx-2.1.1.tgz#7c13aa4e54f5ee8c9f37937b3d8c706c14369478" @@ -2150,6 +2183,11 @@ ci-info@^3.3.1: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.8.0.tgz#81408265a5380c929f0bc665d62256628ce9ef91" integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw== +classnames@^2.2.6: + version "2.5.1" + resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b" + integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== + cli-boxes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-3.0.0.tgz#71a10c716feeba005e4504f36329ef0b17cf3145" @@ -4762,6 +4800,11 @@ postcss@^8.1.10, postcss@^8.4.14, postcss@^8.4.18, postcss@^8.4.23: picocolors "^1.0.0" source-map-js "^1.0.2" +preact@^10.6.5: + version "10.19.3" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.19.3.tgz#7a7107ed2598a60676c943709ea3efb8aaafa899" + integrity sha512-nHHTeFVBTHRGxJXKkKu5hT8C/YWBkPso4/Gad6xuj5dbptt9iF9NZr9pHbPhBrnT2klheu7mHTxTZ/LjwJiEiQ== + preferred-pm@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/preferred-pm/-/preferred-pm-3.0.3.tgz#1b6338000371e3edbce52ef2e4f65eb2e73586d6" @@ -4807,6 +4850,11 @@ prismjs@^1.28.0: resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12" integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q== +progress-smoother@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/progress-smoother/-/progress-smoother-1.7.0.tgz#77a5d77b19ce55ef81fdf02007ba6213df08ee5e" + integrity sha512-ZIbSbPQ8SnEf5Sa0If9lfvn5URyrZfgTTh5DM+04j1GafiLIaWDWW+1AkYXzGl7JQvzAvCy5E1ZPOgx8XORyew== + prompts@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -5846,6 +5894,23 @@ update-browserslist-db@^1.0.11: escalade "^3.1.1" picocolors "^1.0.0" +upload-js@^2.22.0: + version "2.24.3" + resolved "https://registry.yarnpkg.com/upload-js/-/upload-js-2.24.3.tgz#cf18a2d4f726d247380d5b89b336a0c8b28f3e92" + integrity sha512-iiTowtr2uRw2coGXlqiN1ff/wfMPVMv2MqaZYqEYBSNGmxD1pLl9R9wU8BT/mK+Yn8fDx7utlPovXziS8PVaIA== + dependencies: + "@upload-io/upload-api-client-upload-js" "^2.18.0" + progress-smoother "^1.7.0" + +uploader@^3.47.0: + version "3.48.3" + resolved "https://registry.yarnpkg.com/uploader/-/uploader-3.48.3.tgz#5b7f8c57ff115e42ab66d9aed68b1c7f2a544f1a" + integrity sha512-BGXSS9O54m81TL5Ogn4OHISD/WPuIS3kvNCYomDl8cltPGzUMrHseU1sXHKGrFg65L28qJL6LnGA2fXUxpQVBQ== + dependencies: + classnames "^2.2.6" + preact "^10.6.5" + upload-js "^2.22.0" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"