123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- {{with .Repository}}
- <div class="header-wrapper">
- <div class="ui container">
- <div class="ui vertically padded grid head">
- <div class="column">
- <div class="ui header">
- <div class="ui huge breadcrumb">
- <i class="mega-octicon octicon-{{if .IsPrivate}}lock{{else}}repo{{end}}"></i>
- <a href="{{AppSubURL}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
- <div class="divider"> / </div>
- <a href="{{$.RepoLink}}">{{.Name}}</a>
- </div>
- {{if not $.IsGuest}}
- <div class="ui right">
- {{if and $.IsRepositoryAdmin $.IsRepositoryOwner}}
- <!-- CORE INNOVATION: IPFS + Blockchain Integration Button -->
- <button class="ui teal button" id="unified-ipfs-button">
- <i class="cloud upload icon"></i> Add to IPFS + Blockchain
- </button>
- {{end}}
-
- <!-- Standard repository actions -->
- <div class="ui labeled button">
- <button class="ui basic button">
- <i class="eye icon"></i> Watch
- </button>
- <a class="ui basic label">{{.NumWatches}}</a>
- </div>
-
- <div class="ui labeled button">
- <button class="ui basic button">
- <i class="star icon"></i> Star
- </button>
- <a class="ui basic label">{{.NumStars}}</a>
- </div>
- </div>
- {{end}}
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- WEB3 INTEGRATION JAVASCRIPT -->
- <script>
- // INNOVATION: Multi-wallet Solana integration
- document.addEventListener('DOMContentLoaded', function() {
- const ipfsButton = document.getElementById('unified-ipfs-button');
- if (ipfsButton) {
- ipfsButton.addEventListener('click', handleIPFSUpload);
- }
- });
- async function handleIPFSUpload() {
- try {
- // STEP 1: Check for wallet connection
- if (!window.solana || !window.solana.isPhantom) {
- showWalletInstallPrompt();
- return;
- }
-
- // STEP 2: Connect wallet and check balance
- const wallet = await window.solana.connect();
- const hasBalance = await checkWalletBalance(wallet.publicKey.toString());
-
- if (!hasBalance) {
- showError('Insufficient balance. Need at least 0.01 SOL for transaction fees.');
- return;
- }
-
- // STEP 3: Upload to IPFS temporarily
- const ipfsHash = await uploadToIPFS();
-
- // STEP 4: Create blockchain transaction with IPFS hash
- const transaction = await createMemoTransaction(ipfsHash);
-
- // STEP 5: Request wallet signature
- const signature = await window.solana.signTransaction(transaction);
-
- // STEP 6: Permanent IPFS pinning after payment confirmation
- await permanentIPFSPin(ipfsHash, signature);
-
- // SUCCESS: Show professional success modal
- showSuccessModal(ipfsHash, signature);
-
- } catch (error) {
- if (error.message.includes('User rejected')) {
- showError('Transaction cancelled by user.');
- } else {
- showError('Upload failed: ' + error.message);
- }
- }
- }
- // INNOVATION: Progressive Web3 enhancement for Web2 users
- function showWalletInstallPrompt() {
- // Educational modal for traditional developers
- // Guides wallet installation without forcing it
- // ... implementation details protected ...
- }
- // BLOCKCHAIN INTEGRATION: Check wallet balance before operations
- async function checkWalletBalance(publicKey) {
- // Solana RPC call to verify sufficient balance
- // ... implementation details protected ...
- return true; // Simplified for demo
- }
- // IPFS INTEGRATION: Upload complete repository structure
- async function uploadToIPFS() {
- // POST to /repo/{owner}/{repo}/ipfs/temp_upload
- // Returns IPFS hash for blockchain transaction
- // ... implementation details protected ...
- return 'QmExampleHash'; // Simplified for demo
- }
- // MEMO TRANSACTION: Cost-efficient blockchain records
- async function createMemoTransaction(ipfsHash) {
- // Creates Solana memo transaction with repository data
- // Format: "GitBross Repository: {name} | IPFS: {hash} | Owner: {wallet}"
- // ... implementation details protected ...
- return {}; // Simplified for demo
- }
- // SECURITY: Permanent storage only after payment verification
- async function permanentIPFSPin(ipfsHash, signature) {
- // Verifies transaction on blockchain before permanent pinning
- // Prevents free storage abuse
- // ... implementation details protected ...
- }
- // UX INNOVATION: Professional cross-browser success modal
- function showSuccessModal(ipfsHash, signature) {
- // Professional modal with selectable text and copy buttons
- // Works across all browsers (Chrome, Firefox, Safari, Brave)
- // Clickable links to IPFS gateway and Solana Explorer
- // ... implementation details protected ...
- }
- </script>
- <!--
- FRONTEND INNOVATION SUMMARY:
- ===========================
- 1. PROGRESSIVE WEB3 ENHANCEMENT:
- - Web2 users see standard Git interface
- - "Add to IPFS + Blockchain" button appears for owners
- - Educational prompts guide wallet installation
- - No forced crypto onboarding
- 2. MULTI-WALLET SUPPORT:
- - Phantom (primary), Solflare, Backpack integration
- - Automatic wallet detection and connection
- - Fallback guidance for wallet installation
- 3. TRANSACTION-FIRST SECURITY:
- - Balance verification before any operations
- - Temporary IPFS upload, permanent only after payment
- - Clear error handling for cancelled transactions
- 4. PROFESSIONAL UX:
- - Cross-browser compatible success modals
- - Selectable text and copy buttons
- - Educational tooltips for Web3 concepts
- - Familiar Git workflow with Web3 benefits
- This creates the bridge between traditional Git workflows and
- decentralized Web3 benefits, enabling mass adoption.
- Full working implementation: https://gitbross.com
- -->
- {{end}}
|