fossurl
32 | 42 |
├── .github └── FUNDING.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── gulpfile.js ├── package.json ├── src ├── CNAME ├── head.js ├── index.css ├── index.html ├── index.js ├── localserver.sh └── runme.py ├── static ├── banner.png ├── banner_2.png ├── browserstack.svg ├── dragonfly.png ├── fossurl-logo-small.png └── fossurl-logo.png └── yarn.lock /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 3 | patreon: # Replace with a single Patreon username 4 | open_collective: # Replace with a single Open Collective username 5 | ko_fi: # Replace with a single Ko-fi username 6 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 7 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 8 | liberapay: bauripalash # Replace with a single Liberapay username 9 | issuehunt: # Replace with a single IssueHunt username 10 | otechie: # Replace with a single Otechie username 11 | custom: ['https://paypal.me/bauripalash' , 'https://buymeacoffee.com/palash' , 'https://p-y.tm/9V-oX9y'] 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # parcel-bundler cache (https://parceljs.org/) 61 | .cache 62 | 63 | # next.js build output 64 | .next 65 | 66 | # nuxt.js build output 67 | .nuxt 68 | 69 | # vuepress build output 70 | .vuepress/dist 71 | 72 | # Serverless directories 73 | .serverless/ 74 | 75 | # FuseBox cache 76 | .fusebox/ 77 | 78 | #DynamoDB Local files 79 | .dynamodb/ 80 | 81 | #Output 82 | output/ 83 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | #### Change Log: 2 | 3 | **2.0** 4 | * New Design 5 | * Speed Improved 6 | * Removed Bootstrap and JQuery 7 | * Rewritten in ES6 and transpiled using Babel for supporting old browsers 8 | 9 | **2.0 alpha** 10 | * Added custom url support 11 | * Changed background to gradient -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at fossurl-report@palash.tk. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | **Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github) 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Palash Bauri 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | 3 | [](http://makeapullrequest.com) 4 | [](https://www.firsttimersonly.com/) 5 | 6 | #### [🌐 Open fossurl website](https://palashbauri.in/fossurl) 7 | 8 | 9 | ### What is Fossurl 10 | 11 | Fossurl is an simple URL Shortener Which Can Be Hosted For Free in Github/Gitlab Pages or in Static Site Hosting Service and It doesn't need you to buy any server! 12 | 13 | 14 | ### 🎯 Goal 15 | Implementing a Simple URL Shortner which can be used without need of any hardcore server side processing and **can be hosted on Static Site Hostings such as GitHub/Gitlab Pages** 16 | 17 | ### 💻 Stack 18 | * HTML 19 | * CSS 20 | * JavaScript 21 | * Database : [jsonconnect.com](https://jsonconnect.com/) 22 | (Previously , jsonstore was used but several downtimes forced me to switch to jsonbox.io, then to jsonconnect as jsonbox went offline) 23 | 24 | Jsonconnect.com [is a fork of Jsonbox.io](https://github.com/bauripalash/fossurl/issues/29) - learn more on [the project's homepage](https://github.com/jsonconnect/jsonconnect). 25 | 26 | 27 | ### 🛠️ Features 28 | * It's fast 29 | * It doesn't require any hosting server 30 | * You can use it just by forking the repo and running a script 31 | 32 | ### Where is my data stored? 33 | 34 | The connection between your shorten URL and the long one is stored by jsonconnect.com, and will be available as long as the server is alive. 35 | 36 | The server is set to [keep the data for 99999 days](https://github.com/jsonconnect/jsonconnect/issues/2#issuecomment-825011113), which is somewhere over 200 years 😎! 37 | 38 | ## 👻 Wanna Help Improve It? 39 | #### Steps: 40 | * Fork This Repo 41 | * Clone On Your Device or [**Open in Gitpod**](https://gitpod.io/#https://github.com/bauripalash/fossurl) 42 | * On Linux `cd` to `src` directory and on Windows do whatever it's necessary to change directory to `src` 43 | * If you're on Linux, check your version of Python with the command `python --version`. 44 | * If you have python 3 installed, type this command; `python -m http.server`. 45 | * If you use python 2, run `python -m SimpleHTTPServer` instead. 46 | * Make Changes and improvements 47 | * After Making Improvements , send a Pull Request 48 | 49 | #### Issues: 50 | * Create Issues if you find errors or bugs 51 | * Create Issues to submit improvement ideas 52 | 53 | --- 54 | **Thanks to** 55 | 56 | * [The Noun Project for the dragonfly icon on homepage](https://thenounproject.com/search/?q=dragonfly&i=2415046) 57 | * [The Noun Project for the dragonfly icon on README](https://thenounproject.com/search/?q=dragonfly&i=1451640) [(Both are Licensed under CC BY 3.0 US)](https://creativecommons.org/licenses/by/3.0/us/) 58 | * [Anthony Arutyunov](https://github.com/AnthonyArutyunov) for hosting Jsonconnect.com 59 | 60 | --- 61 | **⚠ Warning :** 62 | 63 | * Please Don't Use FossUrl to shorten any sensitive Information , important files or any other sensitive things which can create privacy issues for an individual or a company or an organisation. 64 | 65 | * **Sponsor :** 66 | [](https://browserstack.com) 67 | 68 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var htmlmin = require('gulp-htmlmin'); 3 | var postcss = require('gulp-postcss'); 4 | var cssnano = require('cssnano'); 5 | var uglify = require('gulp-uglify'); 6 | var babel = require('gulp-babel'); 7 | var del = require('del'); 8 | var zip = require("gulp-zip"); 9 | 10 | function compress(){ 11 | return gulp 12 | .src('output/*') 13 | .pipe(zip('package.zip')) 14 | .pipe(gulp.dest('output')); 15 | } 16 | 17 | function pre_js() { 18 | return gulp 19 | .src(['src/index.js']) 20 | .pipe(babel({ 21 | presets: ['@babel/env'] 22 | })) 23 | .pipe(gulp.dest('comp')); 24 | } 25 | 26 | function m_html() { 27 | return gulp 28 | .src('src/index.html') 29 | .pipe(htmlmin({ 30 | collapseWhitespace: true 31 | })) 32 | .pipe(gulp.dest('output')); 33 | } 34 | 35 | function m_css(){ 36 | var plugins = [ 37 | cssnano() 38 | ]; 39 | return gulp 40 | .src('src/index.css') 41 | .pipe(postcss(plugins)) 42 | .pipe(gulp.dest('output')); 43 | } 44 | 45 | function m_js(){ 46 | return gulp 47 | .src(['comp/index.js']) 48 | .pipe(uglify()) 49 | .pipe(gulp.dest('output')); 50 | } 51 | 52 | function copy_extras(){ 53 | return gulp 54 | .src(['src/CNAME' , 'src/runme.py' , 'src/head.js']) 55 | .pipe(gulp.dest('output')); 56 | } 57 | 58 | function clean(){ 59 | return del(["./comp"]); 60 | } 61 | 62 | function pack_clean(){ 63 | return del(["./output/CNAME" , "./output/head.js" , "./output/index.css" , "./output/index.html" , "./output/index.js" , "./output/runme.py"]); 64 | } 65 | 66 | gulp.task("html", m_html); 67 | gulp.task("css", m_css); 68 | gulp.task("js", m_js); 69 | gulp.task("pre_js", pre_js); 70 | gulp.task("clean" , clean); 71 | gulp.task("copy_extras" , copy_extras); 72 | gulp.task("compress" , compress); 73 | gulp.task("pack_clean" , pack_clean); 74 | 75 | 76 | gulp.task( 77 | "build", 78 | gulp.series("html", "css" , "pre_js" , "js" , "copy_extras" , "clean") 79 | ); 80 | 81 | gulp.task( 82 | "packit", 83 | gulp.series("build" , "compress" , "pack_clean") 84 | ); 85 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fossurl", 3 | "version": "2.0.0", 4 | "description": "Your Own URL Shortener which can be even hosted in Github and Gitlab Pages", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "gulp build", 8 | "packit": "gulp packit" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/bauripalash/fossurl.git" 13 | }, 14 | "keywords": [ 15 | "url", 16 | "url-shortener", 17 | "free" 18 | ], 19 | "author": "Palash Bauri", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/bauripalash/fossurl/issues" 23 | }, 24 | "homepage": "https://github.com/bauripalash/fossurl#readme", 25 | "dependencies": { 26 | "@babel/core": "^7.2.0", 27 | "@babel/preset-env": "^7.2.0", 28 | "cssnano": "^4.1.7", 29 | "del": "^3.0.0", 30 | "gulp": "^4.0.0", 31 | "gulp-babel": "^8.0.0", 32 | "gulp-htmlmin": "^5.0.1", 33 | "gulp-postcss": "^8.0.0", 34 | "gulp-uglify": "^3.0.1", 35 | "gulp-zip": "^4.2.0" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/CNAME: -------------------------------------------------------------------------------- 1 | HEY_PUT_YOUR_DOMAIN_HERE 2 | -------------------------------------------------------------------------------- /src/head.js: -------------------------------------------------------------------------------- 1 | var endpoint = "https://jsonconnect.com/connect_21ad6e588abb4198e45b"; 2 | 3 | function fetchJSON(a) { 4 | var f = new XMLHttpRequest; 5 | f.open("GET", a, false); 6 | f.send(null); 7 | return f.responseText 8 | } 9 | 10 | function isURL(a) { 11 | let url = a 12 | if (!a.startsWith("javascript:")) { 13 | return true; 14 | } else { 15 | return false; 16 | } 17 | } 18 | var hashh = window.location.hash.substr(1); 19 | if (window.location.hash != "") { 20 | var res = JSON.parse(fetchJSON(endpoint + "/?q=s:" + hashh))[0]; 21 | var data = res["l"]; 22 | console.log(data); 23 | if (data != null) { 24 | if (isURL(data)) { 25 | window.location.href = data; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | 5 | body { 6 | font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif; 7 | margin: 2em; 8 | margin: auto; 9 | text-align: center; 10 | background: whitesmoke; 11 | } 12 | 13 | h1, 14 | .h1 { 15 | color: #102E87; 16 | font-family: monospace; 17 | font-size: 2rem; 18 | 19 | } 20 | 21 | .h1 a { 22 | color: #102E87; 23 | text-decoration: none 24 | } 25 | 26 | .h1 a:visited { 27 | color: #102E87; 28 | text-decoration: none 29 | } 30 | 31 | .bold { 32 | font-weight: bold; 33 | } 34 | 35 | p { 36 | max-width: 600px; 37 | } 38 | 39 | form, 40 | .form { 41 | margin-bottom: 10px; 42 | padding: 15px; 43 | background-color: #1337a5; 44 | border: 1px solid #d6d6d6; 45 | box-shadow: 3px 3px 0px #bababa; 46 | display: inline-block; 47 | width: 98%; 48 | max-width: 380px; 49 | border-radius: 16px; 50 | } 51 | 52 | .main { 53 | margin-bottom: 25px; 54 | padding: 0px 10px 5px 10px; 55 | margin: 8px auto 8px; 56 | border: 2px solid #0e2877; 57 | box-shadow: 5px 6px 0px #0e2877; 58 | width: 95%; 59 | max-width: 600px; 60 | border-radius: 16px; 61 | } 62 | 63 | input { 64 | display: block; 65 | margin-bottom: 10px; 66 | padding: 5px; 67 | width: 100%; 68 | border: none; 69 | border-radius: 16px; 70 | ; 71 | font-size: 16px; 72 | } 73 | 74 | button { 75 | font-size: 20px; 76 | border-radius: 16px; 77 | display: inline-block; 78 | text-align: center; 79 | color: #0e2877; 80 | background-color: white; 81 | padding: 4px 8px; 82 | /*border: 0px solid grey;*/ 83 | border: none; 84 | cursor: pointer; 85 | } 86 | 87 | button:hover { 88 | background-color: cyan; 89 | color: black; 90 | } 91 | 92 | button:active { 93 | box-shadow: none; 94 | } 95 | 96 | li { 97 | margin-bottom: 5px; 98 | } 99 | 100 | footer { 101 | color: #0e2877; 102 | } 103 | 104 | .small-text { 105 | font-size: smaller; 106 | } 107 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 |