Skip to content

Instantly share code, notes, and snippets.

@RammusXu
Created July 15, 2015 15:11
Show Gist options
  • Save RammusXu/cd1fb3eca8d59b6db877 to your computer and use it in GitHub Desktop.
Save RammusXu/cd1fb3eca8d59b6db877 to your computer and use it in GitHub Desktop.
apkDownloader
class BrowseController < ApplicationController
def index
path = "public/apk_pool/"+ params[:folder] +"/*"
@apks = Dir.glob(path)
@apks.each do |apk|
puts apk
end
end
def show
@path = params[:path] || '/public/apk_pool'
@files = Dir.foreach(@path)
end
end
Rails.application.routes.draw do
get 'browse/' , to: 'browse#index'
get 'browse/:folder' , to: 'browse#index'
# get '/browse/*path' => 'browse#show', as: :browse
get 'download/index'
get 'download/apk_pool'
get 'download/file'
root 'download#index'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment