{"id":32382943,"url":"https://github.com/friedinger/webshare","last_synced_at":"2025-10-25T01:51:58.063Z","repository":{"id":148190469,"uuid":"598830652","full_name":"Friedinger/Webshare","owner":"Friedinger","description":"A simple, lightweight, self hosted webservice to easily share files and links via an short custom URL","archived":false,"fork":false,"pushed_at":"2024-03-28T23:29:49.000Z","size":178,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2024-03-29T23:24:21.912Z","etag":null,"topics":["filesharing","linkshortener","php","sharing"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Friedinger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-02-07T22:19:09.000Z","updated_at":"2024-04-14T17:39:59.401Z","dependencies_parsed_at":null,"dependency_job_id":"f01d1f8e-303c-49ed-8c1e-85c6216507ed","html_url":"https://github.com/Friedinger/Webshare","commit_stats":{"total_commits":94,"total_committers":1,"mean_commits":94.0,"dds":0.0,"last_synced_commit":"0128c75cbee124a0bb1600eb8566e4ba097af534"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Friedinger/Webshare","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friedinger%2FWebshare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friedinger%2FWebshare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friedinger%2FWebshare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friedinger%2FWebshare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Friedinger","download_url":"https://codeload.github.com/Friedinger/Webshare/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friedinger%2FWebshare/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280893629,"owners_count":26409279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filesharing","linkshortener","php","sharing"],"created_at":"2025-10-25T01:50:56.200Z","updated_at":"2025-10-25T01:51:58.055Z","avatar_url":"https://github.com/Friedinger.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webshare\n\nWebshare: A simple, lightweight, self hosted webservice to easily share files and links via an short custom URL.\n\nVersion 2.2\n\n## Features\n\n-   Share files with an easy to remember, custom URL\n-   Shorten every URL (custom service like Bitly)\n-   Set expiration dates for shares (deleted on first attempt post expiration)\n-   Store files in a custom directory on the webserver\n-   Store share data in a MySQL database\n-   Show existing shares in admin page\n-   Delete shares from admin page\n\n## Installation\n\n1. Download the source code from the [latest release](https://github.com/Friedinger/Webshare/releases/latest).\n2. Unzip the files and upload them to your webserver.\n3. Move the file to the correct location:\n    - The files in the _home_ directory must be **inside the root directory** of the webserver. They can be moved into a subdirectory and the content of the _index.php_ file can also be executed by another custom file for advanced usage. The _.htaccess_ file just redirects all requests to the _index.php_ file.\n    - The _webshare_ directory must be **outside directory** of the root directory of the webserver to prevent direct access. You can move the files to your own destination, only the files inside the _function_ directory should remain together in one directory.\n4. Create MySQL table for Webshare:\n\n    It should have the following structure:\n    | name | type | null | default |\n    | ---- | ---- | ---- | ---- |\n    | uri | varchar(50) | no | none |\n    | type | varchar(50) | no | none |\n    | value | varchar(200) | no | none |\n    | password | varchar(200) | yes | NULL |\n    | expireDate | datetime | yes | NULL |\n    | createDate | datetime | no | current_timestamp() |\n\n    Make _uri_ a primary key index to ensure unique short links.\n\n    For an easy installation you can use the _install.sql_ file provided with webshare.\n\n5. Adjust the _index.php_ file: Set the require paths to the _Webshare.php_ and _webshareConfig.php_ files so that they get loaded properly.\n6. Adjust config file:\n    - Set the webshare install path when you moved the _index.php_ file into a subdirectory of root directory.\n    - Set path to file storage.\n    - Set path to _admin_, _view_, _password_ and _delete_ page.\n    - Set the database login information for Webshare.\n    - Change the action executed on an error 404.\n    - Limit access to admin page by validating the login state (recommended) or use an authentication with an _.htaccess_ file.\n    - Change action if admin page was requested but user is not authenticated.\n\n## Customization\n\nTo customize your Webshare installation to your personal design, you can replace or modify the default sample pages provided in the _webshare_ directory. There are just some elements the pages must offer.\n\n### General outputs\n\nThe `Webshare\\Output` object provides a variety of information about the current share:\n\n-   `Webshare\\Output::$uri`: The uri of the share\n-   `Webshare\\Output::$value`: The value of the share, either the link or the filename. Should not be used in password page, because it provides information without entering the password.\n-   `Webshare\\Output::$expireDate`: The timestamp when the share will expire\n-   `Webshare\\Output::$createDate`: The timestamp of the share creation time\n-   `Webshare\\Output::$status`: Status information about the current share action, can only be used on some pages.\n-   `Webshare\\Output::link($uri, $text, $longLink)`: Function to output a link to an URI in webshare, for example the admin page. _$uri_ sets the URI to link to, _$text_ adjusts the text that is visible (default is the link itself), _$longLink_ controls wether the link should just be the URI / text or an complete link with hostname and option to copy it.\n\n### Admin page\n\nThe admin page must offer a form to add a share which consists of the following parts:\n\n```html\n\u003cform method=\"post\" enctype=\"multipart/form-data\"\u003e\n\t\u003cinput type=\"text\" name=\"uri\" pattern=\"[a-z0-9_-]+\" required /\u003e\u003cbr /\u003e\n\t\u003cinput type=\"file\" name=\"file\" /\u003e\u003cbr /\u003e\n\t\u003cinput type=\"text\" name=\"link\" /\u003e\u003cbr /\u003e\n\t\u003cinput type=\"text\" name=\"password\" /\u003e\u003cbr /\u003e\n\t\u003cinput type=\"datetime-local\" name=\"expireDate\" /\u003e\u003cbr /\u003e\n\t\u003cinput type=\"submit\" name=\"submit\" /\u003e\u003cbr /\u003e\n\u003c/form\u003e\n```\n\nTo display messages after attempting to add a share you can use the status provided with php in the `Webshare\\Output::$status` variable.\nIt can have the following values, check out sample admin page for an example of handling these values:\n\n-   `success`: The share was successfully added\n-   `errorUri`: Share adding failed because the uri is already in use\n-   `errorBoth`: Share adding failed because file and link were offered and not just one of them\n-   `errorUploadSize`: Share adding failed because upload size limit was exceeded\n-   `error`: Share adding failed for another reason\n\nTo display the list of existing shares, a table must be added to the admin page. The output object and its variable _$shareList_ output the table data, the links allow sorting the table by the different columns.\n\n```html\n\u003ctable\u003e\n\t\u003cth\u003e\u003ca href=\"?sort=uri\"\u003eURI\u003c/a\u003e\u003c/th\u003e\n\t\u003cth\u003e\u003ca href=\"?sort=type\"\u003eType\u003c/a\u003e\u003c/th\u003e\n\t\u003cth\u003e\u003ca href=\"?sort=value\"\u003eValue\u003c/a\u003e\u003c/th\u003e\n\t\u003cth\u003e\u003ca href=\"?sort=password\"\u003ePassword\u003c/a\u003e\u003c/th\u003e\n\t\u003cth\u003e\u003ca href=\"?sort=expireDate\"\u003eExpire Date\u003c/a\u003e\u003c/th\u003e\n\t\u003cth\u003e\u003ca href=\"?sort=createDate\"\u003eCreate Date\u003c/a\u003e\u003c/th\u003e\n\t\u003cth\u003eAction\u003c/th\u003e\n\t\u003c?= Webshare\\Output::$shareList ?\u003e\n\u003c/table\u003e\n```\n\nA sample admin page can be found [here](/webshare/adminPage_sample.php).\n\n### View page\n\nThe view page should display an preview of the requested file. Therefore the following php code must be included to output the preview.\n\n```php\n\u003c?= Webshare\\Output::$sharePreview ?\u003e\n```\n\nA sample view page can be found [here](/webshare/viewPage_sample.php).\n\n### Password page\n\nThe password page must contain a form to enter the password to access the protected share.\n\n```html\n\u003cform method=\"post\"\u003e\n\t\u003clabel\u003ePassword: \u003c/label\u003e\u003cinput type=\"password\" name=\"password\" /\u003e\u003cbr /\u003e\n\t\u003cinput type=\"submit\" value=\"Submit password\" name=\"submit\" /\u003e\u003cbr /\u003e\n\u003c/form\u003e\n```\n\nThe status of the password access is provided by the `Webshare\\Output::$status` variable. Its value is set to `incorrect` if the entered password is not correct. If the password matches the user is directly redirected to the share without displaying any message.\n\nA sample password page can be found [here](/webshare/passwordPage_sample.php).\n\n### Delete page\n\nThe delete page must include a form to confirm the deletion of a share. For that reason, a the following form should be used:\n\n```html\n\u003cform method=\"post\"\u003e\n\t\u003cinput type=\"hidden\" name=\"share\" value=\"\u003c?= Webshare\\Output::$uri ?\u003e\" /\u003e\n\t\u003cinput type=\"submit\" name=\"submit\" value=\"Delete\" /\u003e\u003cbr /\u003e\n\u003c/form\u003e\n```\n\nTo inform the user about a successful deletion, the status of the deletion is provided by the `Webshare\\Output::$status` variable. It can have the following values:\n\n-   `success`: The share was successfully deleted\n-   `error`: An error occurred during the deletion\n-   Something else or unset: Default output before confirming the deletion\n\nA sample password page can be found [here](/webshare/deletePage_sample.php).\n\n## Credit and license\n\n© 2023\n[Friedinger](https://friedinger.org \"friedinger.org\")\n\nLicense: [MIT License\n](https://github.com/Friedinger/Webshare/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriedinger%2Fwebshare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffriedinger%2Fwebshare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriedinger%2Fwebshare/lists"}